File storage is segregated by tenant
Why it matters
Flat storage namespaces are a common AI-generated blind spot: code stores files as uploads/{uuid} with no tenant prefix, so any authenticated user who discovers a file key — via URL scraping, shared links, or support screenshots — can download another tenant's files. CWE-732 (Incorrect Permission Assignment for Critical Resource) and OWASP A01 both apply. Beyond privacy, tenant-to-tenant file exposure violates SOC 2 CC6.1 data classification requirements and, when files contain PII, triggers GDPR Art. 33 breach notifications.
Severity rationale
High because a flat storage namespace lets any authenticated user retrieve another tenant's files by constructing or guessing the storage key, with no further privilege required.
Remediation
Prefix every storage key with the tenant identifier at upload time, and validate ownership before generating a signed retrieval URL:
// S3 key generation — always include tenant prefix
const key = `tenants/${session.user.organizationId}/uploads/${crypto.randomUUID()}-${filename}`
// Retrieval — verify ownership before signing
const fileRecord = await db.files.findFirst({
where: { id: fileId, organizationId: session.user.organizationId }
})
if (!fileRecord) return new Response('Not found', { status: 404 })
const signedUrl = await s3.getSignedUrl('getObject', { Bucket, Key: fileRecord.s3Key, Expires: 300 })
For Supabase Storage, write a bucket RLS policy that checks auth.jwt()->>'org_id' = storage.foldername(name)[1] so the storage engine itself enforces isolation without relying on application code.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Multi-Tenancy Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-285 — Improper Authorization
- cwe · CWE-732 — Incorrect Permission Assignment for Critical Resource
- owasp:2021 · A01 — Broken Access Control
- gdpr · Art. 33 — Notification of a personal data breach to the supervisory authority
- soc2:2017 · C1.1 — Identification and protection of confidential information
Taxons
History
- 2026-04-18·v1.0.0·Initial import from saas-multi-tenancy·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (C1.1) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2