Attachment and File Ownership Checks
Review how uploaded files and attachments are authorized, covering retrieval URLs, multipart operations and storage backends
Use when: the API accepts uploads or serves attachments, whether from your own object storage or an application server
Avoid when: the product stores no user-supplied files and exposes no download routes
Procedure
- Map every file path: upload, metadata update, retrieval, listing and deletion, including asynchronous processing.
- Upload labeled fixtures from each of your two test accounts to establish ownership of each object.
- Request each file with the other account's credential and with a bare unauthenticated request.
- Inspect retrieval URLs for embedded signatures or tokens, checking lifetime, scope and revocability.
- Check storage-layer authorization by testing direct storage URLs, since application checks may not apply there.
- Verify that metadata endpoints (list, thumbnail, preview) enforce the same rule as the primary download.
Signals
- A direct storage URL works without any application credential, using only an identifier you observed.
- A signed URL outlives the session it was issued for and remains valid far longer than intended.
- Metadata or thumbnail endpoints return information while the main download is correctly refused.
- Deletion succeeds for a file owned by another test account, which is write-side object-level failure.
Patterns
1. Fixture set
alice upload -> file-a.png label=ALICE-ALPHA
bob upload -> file-b.png label=BOB-BETA
request file-a.png as bob -> expect 403/404
2. URL review
signed url: expiry=3600s scope=single-object revocable=yes -> acceptable
expiry=none object=folder -> report
3. Result row
path=/api/files/{id} download=bob:403 metadata=bob:200 delete=bob:403 -> metadata gap
Pitfalls
- Testing only the application download route while a direct storage URL remains open.
- Ignoring metadata, preview and thumbnail routes, which frequently lag behind the primary authorization check.
- Treating an unauthenticated 404 as proof of safety when the identifier merely changed format.
Done when
- Upload, download, metadata, delete and direct-storage paths have each been tested with both accounts' credentials.
- Signed URL lifetime, scope and revocability are documented with the observed values.