Repository navigation
Description
Summary
Two origin/observability hardening items: an SSRF primitive in HTTP origin pull-through, and a missing non-loopback warning on the metrics bind.
M — SSRF on HTTP origin pull-through (no redirect policy)
crates/cache/src/origin/http.rs:220-242 builds the reqwest client with no redirect::Policy, so the default (follow up to 10) applies; acknowledged at :304-316. parse_origin_url validates the configured base URL (scheme http/https, no query/fragment) but an origin that 3xx-redirects to http://169.254.169.254/... or an internal 127.0.0.1/RFC-1918 address causes the node to issue that request. BLAKE3 verification does not mitigate — the request is still sent and response/timing is observable. Operator-configured origins cap severity, but a compromised/misconfigured origin (or one whose redirect target an attacker influences) turns pull-through into an SSRF primitive; the Content-Length/max_bytes cap does not address the request being sent at all.
Fix: set an explicit redirect::Policy::none() (origins should serve {base}/{hash} directly; query/fragment already rejected, so redirects aren't an expected mode), or a custom policy re-validating each hop's host against a deny-list of loopback/link-local/private ranges. Add a test for a 3xx-to-internal-address origin response.
LOW — metrics_bind accepts non-loopback with no guard or warning
crates/common/src/config/mod.rs:998-1001, crates/node/src/runtime/mod.rs:323-329 — unlike the admin RPC server (hardcoded 127.0.0.1, runtime/mod.rs:402), observability.metrics_bind is operator-settable with default 127.0.0.1 but no validation/warning if set to 0.0.0.0 or a public IP. appendix-local-admin-http states metrics is "loopback-only"; the code permits otherwise. The OpenMetrics endpoint exposes peer-table size, gossip rejection reasons, pull-through byte volumes, GC/connection stats — useful reconnaissance.
Fix: emit a tracing::warn! at bind time when metrics_bind is non-loopback (matching the existing operator-warning pattern), or reject non-loopback in resolve unless an explicit opt-out flag is set.
Filed from a repository review.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
fix: defuse HTTP origin SSRF and warn on non-loopback metrics_bind (#579
fix: batch of nine quick-win review follow-ups (#845 #864) (#867)
feat(cache): wire range_pull helper into origin adapters and engine (#…