pub fn is_blocked_address(ip: IpAddr, allow_private: bool) -> boolExpand description
SSRF guard parameterised by whether private/internal addresses are permitted.
Applied by the fetch stage to addresses obtained from DNS resolution (to defeat DNS rebinding): an allowlisted hostname that resolves to a blocked address is refused.
- The always-blocked ranges are refused regardless of
allow_private: loopback, link-local (incl. the169.254.169.254cloud-metadata endpoint), unspecified, broadcast, multicast, carrier-grade NAT, documentation/test, and reserved (0.0.0.0/8,240.0.0.0/4). - The private/internal ranges — RFC1918 (
10/8,172.16/12,192.168/16) and IPv6 ULA (fc00::/7) — are refused only whenallow_privateisfalse. Setting ittrue(viaSOF_RESOLVE_ALLOW_PRIVATE_ADDRESSES) lets an allowlisted hostname point at an internal load balancer / reverse proxy.