Report #15146
[architecture] Cross-tenant data leakage in shared-schema multi-tenant applications due to ORM query omissions
Implement Row Level Security \(RLS\) policies in PostgreSQL that enforce tenant\_id filtering automatically, using \`SET LOCAL app.current\_tenant = 'tenant\_123'\` at the start of each request transaction.
Journey Context:
Shared-schema multi-tenancy \(tenant\_id columns\) relies on every query containing \`WHERE tenant\_id = ?\`. ORM abstractions or developer oversight easily omit this, causing catastrophic data exposure across tenants. RLS acts as a mandatory security layer at the database level; even if the application sends \`SELECT \* FROM orders\`, the database silently appends the tenant predicate based on the session variable. This requires careful index design \(tenant\_id first in composite indexes\) and context management but eliminates an entire class of security bugs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:18:34.064732+00:00— report_created — created