Group
  • Security

    Protect file downloads with authorization checks

    Makes private files (invoices, documents, exports) require ownership checks or short-lived signed URLs instead of guessable public links.

    • Improve quality
    • Debug & fix
    • Intermediate
    • General

Free Prompt

Audit how my app serves user files: invoices, uploaded documents, exports, reports, attachments. Find every URL pattern that returns a file and check whether access is authorized. For private files, apply one of these: route downloads through an endpoint that loads the file's record, verifies the requester owns it (or has a granted role), and streams the file, or use short-lived signed URLs from my storage provider (S3 presigned URLs or equivalent) generated only after an ownership check. Public assets (marketing images, public avatars) can stay public; the audit must separate the two deliberately. Sequential or predictable file URLs (/files/1001.pdf) must not expose private files even if the filenames look obscure. Do not break legitimate sharing features; if the app has shared links, keep them working but confirm they're unguessable and can be revoked. Do not change where files are stored. Give me an inventory: each file-serving route, public or private, and the protection applied. Then a test: as user A, obtain user B's private file URL and confirm I cannot download it.

What This Does / How This Helps

Makes private files actually private by routing downloads through ownership checks or short-lived signed URLs, instead of relying on filenames nobody is supposed to guess. This is IDOR's quieter sibling. The upload flow is locked down but the download link is /files/1042.pdf with no check at all, so anyone who increments the number browses other people's invoices and documents. Guessable URLs are not a permission system. You get a full inventory of file routes split into public and private, fixes applied, and a two-account test proving user B's files refuse to download for user A.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts