row-level security
A database feature that filters which rows each query may see or change, using policies the database enforces itself.
In more detail
In PostgreSQL you enable RLS on a table and write a policy such as tenant_id = current_setting('app.tenant'). Even a query that forgets its WHERE clause then only sees the current tenant’s rows, as long as the session setting is correct and reset between requests.
Related terms
- multi-tenancy — One running system serving several separate customers, called tenants, while keeping each one's data and settings apart.
- PostgreSQL — A widely used open source relational database server with strict typing, rich data types and extensions.
- connection pool — A set of already open database connections that a program reuses instead of opening a new one for each request.
- defense in depth — Using several independent protections, so that if one fails another still limits the damage.
Taught in
- Multi-Tenant Identity: Tenant Isolation & Middleware — Production Full-Stack Engineering