What is the smallest test that would make you trust an RLS policy?

by

For multi-tenant apps, “RLS is enabled” is not evidence that rows are isolated. The failure I keep looking for is simple: user A can read or mutate a row owned by tenant B through a permissive relationship or missing ownership condition.

I built a tiny red/green fixture around that exact case. The broken policy fails the cross-tenant assertion; the one-file fix passes the same test suite. It runs locally without a Supabase project, credentials, Docker, or production data:

My current minimum proof is: same-tenant access succeeds, cross-tenant read returns zero rows, cross-tenant write changes zero rows, and the assertions run under the application role rather than an admin role.

What additional case has caught a real RLS bug for you—joins, SECURITY DEFINER functions, storage objects, service-role leakage, or something else? I’d like to turn the strongest answer into the next reproducible fixture.If you prefer a human review of your own policies, the 24-hour three-table scope is here (sanitized SQL only, no secrets; $15.20 launch price, $7.60 deposit today):

3 views

Add a comment

Replies

Be the first to comment