---
title: "Requests and files · Agent Wranglers"
url: https://agentwranglers.se/playbook/adversarial-testing/requests-and-files
updated: 2026-10-20
licence: "All rights reserved"
---

# Requests and files

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

> Stop the server fetching addresses an attacker picks, check every uploaded file, keep file paths inside their folder, and limit redirects and sharing.

**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`.

## Required

- [Fetch only allowed addresses](https://agentwranglers.se/playbook/adversarial-testing/requests-and-files/block-server-side-request-forgery): When 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](https://agentwranglers.se/playbook/adversarial-testing/requests-and-files/safe-file-uploads): Accept 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](https://agentwranglers.se/playbook/adversarial-testing/requests-and-files/block-path-traversal): Never build a file path from user input without proving the result stays inside the allowed folder.
- [Redirect only to your own pages](https://agentwranglers.se/playbook/adversarial-testing/requests-and-files/block-open-redirects): A 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](https://agentwranglers.se/playbook/adversarial-testing/requests-and-files/strict-cors): Allow other sites to read your API only from a fixed list of origins. Never copy the request's `Origin` into the reply when cookies are allowed.
- [Check the origin of WebSocket connections](https://agentwranglers.se/playbook/adversarial-testing/requests-and-files/websocket-origin): Accept 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](https://agentwranglers.se/playbook/adversarial-testing/requests-and-files/third-party-api-data): Check and limit what comes back from partner and third-party APIs, as you would for user input.
- [Unpack archives safely](https://agentwranglers.se/playbook/adversarial-testing/requests-and-files/safe-archive-extraction): Keep 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](https://agentwranglers.se/playbook/adversarial-testing/requests-and-files/private-responses-uncached): Mark every reply that depends on the logged-in user `Cache-Control: private`, and never let a CDN cache by file extension alone.

- Previous: [Data and secrets](https://agentwranglers.se/playbook/adversarial-testing/data-and-secrets)
- Next: [Abuse and limits](https://agentwranglers.se/playbook/adversarial-testing/abuse-and-limits)
- [All chapters](https://agentwranglers.se/playbook/adversarial-testing)
