Tenant data export is scoped to the requesting tenant
Why it matters
Data export endpoints that query broadly and filter in application memory load every tenant's records into a single server process — a cross-tenant data commingling event that violates CWE-285 and OWASP A01. For GDPR Art. 20 (Data Portability) compliance, the exported data must be scoped to the requesting tenant's own records. Beyond compliance, an export endpoint that generates a file for Tenant A and returns a download link that Tenant B can also use constitutes a direct data breach with a durable artifact.
Severity rationale
Low because export endpoints are typically authenticated and require deliberate action, but successful exploitation produces a durable file artifact containing another tenant's data.
Remediation
Always scope export queries at the database level and validate tenant ownership on download of async-generated export files:
// Scope the query — never filter in application memory
const data = await db.project.findMany({
where: { organizationId: session.user.organizationId },
include: { documents: true, members: true }
})
// For async exports, tie the job to the org and validate on download
const exportJob = await db.exportJob.create({
data: { organizationId: session.user.organizationId, status: 'pending' }
})
// Download handler — verify ownership before serving the file
const job = await db.exportJob.findFirst({
where: { id: params.jobId, organizationId: session.user.organizationId }
})
if (!job) return new Response('Not found', { status: 404 })
Place export logic in src/app/api/export/route.ts and audit it separately from general data routes — export endpoints are high-value targets because they return bulk data in a single response.
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-200 — Exposure of Sensitive Information to an Unauthorized Actor
- owasp:2021 · A01 — Broken Access Control
- gdpr · Art. 20 — Right to Data Portability
- soc2:2017 · CC6.7 — Restriction of information transmission, movement, and removal
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 (CC6.7) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2