Not because of a bug. Not because of a breach. Because the permissions were wrong.
Row-Level Security (RLS) is not a nice-to-have. It’s the difference between a system that protects every customer’s data at the source and one that trusts the application layer to never make a mistake. RLS is the gate that lives inside your database. It decides who sees what, row by row, before any data leaves the server.
When you store multi-tenant data, the naïve path is filtering in application code. The problem: one missed WHERE clause and your customer sees someone else’s records. Row-Level Security in PostgreSQL and other modern databases eliminates that risk. You define policies inside the database. They run automatically. They cannot be bypassed accidentally by forgetting a filter upstream.
Emacs and Row-Level Security may not seem connected at first—but if you work with Emacs as your development environment, you know the precision it enables when working close to the metal. That same precision is what RLS gives to your data access layer. When you edit, test, and deploy SQL from Emacs, you can craft RLS policies that are both airtight and maintainable. For example, in PostgreSQL you might write:
ALTER TABLE orders ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON orders
FOR SELECT USING (tenant_id = current_setting('my.tenant_id')::int);
Once this is in place, no query can pull rows outside the tenant’s scope—no matter how it’s called from the application code.