Expand description
SSRF defenses for server-side cross-registry resolution (RFC-ACDP-0006 §7).
§Single source of SSRF policy
This module is the single source of truth for ACDP’s SSRF policy
across both the client and server features. The server-scoped
path (crate::registry::safe_http) does not reimplement any of this
— it only re-exports SsrfPolicy from here (see
src/registry/safe_http.rs). Any change to blocked IP ranges, the
HTTPS-only rule, redirect limits, or DNS-rebinding handling therefore
applies to client and server alike; there is no second copy to keep
in sync. Do not add a divergent implementation under registry/.
When a registry resolves a foreign acdp:// reference on behalf of a
consumer, it must defend against attacker-supplied URIs that target the
registry’s own internal network. This module implements the policy
decisions enumerated by §7:
- §7.1 Reject loopback, RFC 1918 / 4193 private ranges, link-local,
multicast, the AWS / GCP metadata endpoint (
169.254.169.254), and the IPv6 equivalents. - §7.2 HTTPS-only.
- §7.3 Response-size caps.
- §7.5 Maximum redirects, same-authority only.
- §7.6 DNS rebinding protection. [
SsrfPolicy::pin_resolved_ip] resolves a hostname once, validates every returned IP, and returns a [SocketAddr] that the caller pins intoreqwest::Client::builder().resolve(host, addr)— so the filter and the connection use the same IP, defeating a hostile DNS server flipping the answer between the two. Per §7.1 the resolution is rejected outright if any returned IP is forbidden — a public answer cannot mask a private one.
Structs§
- Ssrf
Policy - SSRF policy applied to outbound HTTP requests.
- Ssrf
Rejection - A rejection produced by the
classify_*SSRF checks: a stableSsrfReasondiscriminant plus a human-readable detail.
Enums§
- Ssrf
Reason - Stable, machine-readable reason an SSRF check rejected a target.
Constants§
- MAX_
CONTEXT_ BYTES - Maximum body bytes for a context retrieval (RFC-ACDP-0006 §7.3).
- MAX_
METADATA_ BYTES - Maximum body bytes for capabilities or DID documents (§7.3).
- MAX_
REDIRECTS - Maximum HTTP redirects to follow (§7.5).