The application becomes the proxy
Features such as webhooks, URL previews, remote imports, and SSO metadata ask a server to retrieve a user-influenced location. A crafted destination can redirect that trusted request toward loopback services, cloud metadata, internal control planes, or an attacker-chosen host.
Block private, link-local, loopback, and unsupported schemes, but expect parsing differences, redirects, IPv6 forms, and DNS changes to challenge validation. Normalize once with one parser and validate the resolved destination at connection time.
Build a narrow outbound path
The durable control is network policy: the fetcher should reach only the destinations it genuinely needs. Put risky fetch operations in a small isolated service with no cloud credentials and no access to internal management networks.
Allowlist destinations when the business workflow has a known set. If arbitrary internet access is required, route it through an egress proxy that enforces scheme, port, address range, redirects, response size, and time limits.
- Resolve and check every redirect target, not only the first URL.
- Disable unsupported protocols and nonstandard ports.
- Set strict connect, response, and total timeouts.
- Cap response bytes and avoid returning raw fetched content to the caller.
Test from the workload’s point of view
A URL that looks harmless outside production may resolve differently inside the cluster. Test the deployed network identity and observe blocked egress attempts so policy mistakes become visible.
SSRF prevention works best as layered disagreement: input validation, safe resolution, credential isolation, and outbound network rules all have to fail before the request reaches something valuable.