Cache keys include the tenant identifier
Why it matters
CWE-524 (Use of Cache Containing Sensitive Information) combined with OWASP A01 describes exactly this failure: a cache key like dashboard-stats that is populated by Tenant A's first request and then returned unchanged to Tenant B. Unlike database-layer isolation gaps, cache leaks are silent — no error is raised, the data looks valid, and the victim tenant never knows they received another org's numbers. The window for cross-tenant exposure is bounded only by the cache TTL, which is often measured in minutes or hours.
Severity rationale
High because a cache key collision silently serves one tenant's business data to another tenant with no error or signal that a leak has occurred.
Remediation
Prefix every cache key for tenant-specific data with the tenant identifier. Apply this to Redis, Upstash, Next.js unstable_cache, and React Query/SWR cache keys:
// Instead of:
const cacheKey = `dashboard-stats`
// Do this:
const cacheKey = `tenant:${session.user.organizationId}:dashboard-stats`
// For Next.js unstable_cache:
const getData = unstable_cache(
async () => fetchDashboardStats(orgId),
[`org-${orgId}-dashboard-stats`],
{ tags: [`org-${orgId}`, 'dashboard-stats'] }
)
// Invalidate with tenant scope:
await revalidateTag(`org-${orgId}`)
Audit cache invalidation paths too — a key-scoped write is safe, but a global flushAll in a multi-tenant cache is a denial-of-service risk for other tenants.
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-524 — Use of Cache Containing Sensitive Information
- cwe · CWE-285 — Improper Authorization
- owasp:2021 · A01 — Broken Access Control
- 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