Guide to safely fetching user-supplied URLs from Cloudflare Workers
A developer explains how to fetch user-provided URLs from a Cloudflare Worker without exposing internal resources to request forgery. The post notes that Workers avoid some risks, such as cloud metadata services on localhost, but can still be directed at internal hostnames, origins trusting only Cloudflare IPs, or very large files. It lists the validation checks applied in order, including protocol and port restrictions, rejection of reserved hostnames, and resolving DNS over HTTPS to confirm all addresses are public. The article also covers IPv6 edge cases where IPv4 addresses can be embedded, and manual redirect handling so each hop is re-validated.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in