Requests and files
Stop the server fetching addresses an attacker picks, check every uploaded file, keep file paths inside their folder, and limit redirects and sharing.
- Required 9
Required
Fetch only allowed addresses
RequiredWhen the server fetches an address a user gave, allow only the hosts it needs. Never reach internal or cloud metadata addresses.
Check every uploaded file
RequiredAccept only the file types you need, check them by content, limit their size, and store them where they cannot run.
Keep file paths inside their folder
RequiredNever build a file path from user input without proving the result stays inside the allowed folder.
Redirect only to your own pages
RequiredA redirect that takes its target from the address must only go to your own pages or an allow-list.
Share data across sites on purpose
RequiredAllow other sites to read your API only from a fixed list of origins. Never copy the request's
Origininto the reply when cookies are allowed.Check the origin of WebSocket connections
RequiredAccept a WebSocket connection only from your own origins, and only after checking the user's login, as for any other request.
Treat data from other APIs as untrusted
RequiredCheck and limit what comes back from partner and third-party APIs, as you would for user input.
Unpack archives safely
RequiredKeep every entry of an uploaded zip or tar file inside the target folder, and stop unpacking at a fixed total size and file count.
Keep private pages out of shared caches
RequiredMark every reply that depends on the logged-in user
Cache-Control: private, and never let a CDN cache by file extension alone.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers security testing playbook: https://agentwranglers.se/playbook/adversarial-testing/requests-and-files.