Backend architecture for sensitive data
Multi-tenant isolation
How you stop one customer seeing another customer’s data: the tenant invariant, Row Level Security, route audits and IDOR.
1 article
In a multi-tenant SaaS the most expensive failure isn’t an outage: it’s one customer seeing another’s data with nothing raising an alarm. Most systems prevent it with a WHERE clause someone has to remember to write, and the tests don’t notice when it’s missing.
This topic treats isolation as an invariant, not a habit. Start with the three levels that hold it up, from convention to Row Level Security. Then, how to audit an API that’s already in production with a sweep that fails the build, and what happens further down: what putting tenant_id first in every index costs, why the connection pool is part of the boundary and the IDOR that slips through nested routes.