# Attachment 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

- Skill: `wsh7ash/attachment-ownership-checks` (Agent Skill)
- Install (CLI): `npx get-skill add wsh7ash/attachment-ownership-checks`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wsh7ash/attachment-ownership-checks/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: Wsh7Ash (https://skillmd.com/u/wsh7ash)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/wsh7ash/attachment-ownership-checks

---


# 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

1. Map every file path: upload, metadata update, retrieval, listing and deletion, including asynchronous processing.
2. Upload labeled fixtures from each of your two test accounts to establish ownership of each object.
3. Request each file with the other account's credential and with a bare unauthenticated request.
4. Inspect retrieval URLs for embedded signatures or tokens, checking lifetime, scope and revocability.
5. Check storage-layer authorization by testing direct storage URLs, since application checks may not apply there.
6. 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**

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

```text
signed url: expiry=3600s scope=single-object revocable=yes -> acceptable
expiry=none object=folder -> report
```

**3. Result row**

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

## References

- [OWASP API Security Top 10](https://owasp.org/www-project-api-security/)
- [OWASP - file upload guidance](https://owasp.org/)

