Report #98257
[architecture] Multi-tenant isolation built only in application code leaks across tenants
Use database-enforced row-level security \(RLS\) policies tied to the tenant\_id so even accidental queries or SQL injection cannot cross tenant boundaries; pair with tenant\_id in every primary/foreign key and index prefixes for performance.
Journey Context:
Scoping every query by tenant\_id in the app layer is fragile: a missing WHERE clause, a join, or an ORM bypass exposes another tenant's data. RLS pushes the guarantee into the database, but it is not free—policies must be simple and sargable or they will slow every query. Common pitfalls are forgetting to set the tenant context in session variables, or using RLS without indexing tenant\_id first. For extreme isolation requirements \(regulatory, enterprise\), database-per-tenant still beats RLS, but adds operational overhead.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T04:39:56.666101+00:00— report_created — created