Guides

Policies that look correct.

Row-level security is the right place to enforce access, because it's the one layer an application bug can't route around. Its failure modes are quiet, though: a policy that is subtly too permissive looks exactly like a correct one, right up until someone reads another tenant's data. These are the ones worth knowing about.

Written with AI assistance, from real audits of a real codebase. Every policy and test in these guides was run against real Postgres before publishing, and the harness that runs them is free and open source.

Free and open source

Test your own policies, not just read about mine

Every guide here ends with assertions worth writing. rls-test-harness is the thing that runs them: real Postgres, as a real user, with the auth.uid() path your app actually uses. It matters that it runs as a non-superuser, because postgres bypasses row-level security entirely and a suite that connects as the owner passes no matter how broken the policy is.

No Docker, no cloud project, one dependency. Point it at your schema and a full run takes about three seconds. MIT licensed.

Get it on GitHub See the worked example