The render crate's compatibility loader (a pooled ureq agent behind RenderResourceCache::default) fetched images and fonts with no network policy at all. A page-owned runtime never uses it (it is cache-only and fetches through obscura-net), but every standalone caller did: the paint_file tool, library users rendering a bare DOM, and a JS runtime with no page transport. Markup referencing http://127.0.0.1/, http://169.254.169.254/ or a hostname that resolves to a private address made the renderer connect to it. Move is_forbidden_ip and env_allows_private_network into a new zero-dependency obscura-ssrf crate so obscura-net and obscura-render enforce one deny-set (obscura-net re-exports both, so its API and the wreq transport are unchanged). Install a ureq resolver on the render agent that rejects any resolved address in the deny-set unless OBSCURA_ALLOW_PRIVATE_NETWORK is set, which covers literal addresses, DNS rebinding, and every redirect hop. A resolver refusal surfaces as a DNS transport error; the retry loop now returns immediately on those instead of sleeping through 600ms of backoff for a request it will not make.
10 lines
262 B
TOML
10 lines
262 B
TOML
[package]
|
|
name = "obscura-ssrf"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
description = "Shared SSRF deny-set and private-network opt-in for Obscura's network transports and renderer."
|
|
|
|
[dependencies]
|