Expand description
SSRF protection — a single shared implementation, no copies allowed.
is_private_ip / url_points_to_private_ip / guarded_get are security-critical;
the whole workspace must have exactly one implementation. Originally authored for
lc-tools (review Q1) and lifted into lc-core (0.20.0 S4 P1) so provider crates
that cannot depend on lc-tools (e.g. lc-providers) share the same rules. Any
rule evolution (adding CGNAT 100.64.0.0/10, new IPv6 special ranges, etc.) must
only change here, otherwise the entry points would diverge: “URLFetch blocks
intranet, Whisper allows intranet”.
Constants§
- DEFAULT_
GUARDED_ TIMEOUT - Default timeout for guarded requests when the caller does not supply one.
Functions§
- guarded_
get - GET request with per-hop SSRF checks and IP pinning, following redirects manually.
- guarded_
post_ json - POST request with a JSON body, behind the same resolve-once / validate-all / pin-IP
protection as
guarded_get. POST intentionally does not follow redirects (the 3xx response is handed back as-is), so only the first hop is checked. (A3) - is_
private_ ip - Check if an IP address is private/internal or otherwise non-routable for SSRF purposes.
- url_
points_ to_ private_ ip - Resolve a URL hostname and check if it points to a private IP (async).