RLS reviews usually start with pg_tables and pg_policies: is RLS on, and do the policies look right? That misses two surfaces where access is granted without a per-table row ever appearing.
K — pg_default_acl (grants on future tables)
ALTER DEFAULT PRIVILEGES FOR ROLE migration_role IN SCHEMA public GRANT SELECT ON TABLES TO anon; leaves no row in information_schema.role_table_grants and no policy on the table, because the table does not exist yet. When a migration later creates it, the grant attaches automatically.
The catalog check reads pg_default_acl, expands defaclacl with aclexplode(), and flags entries where defaclobjtype='r' (tables), the schema is public or unspecified, and the grantee is anon, authenticated or PUBLIC. It reports the creator role and the exact privileges, and suggests ALTER DEFAULT PRIVILEGES ... REVOKE ... ON TABLES FROM ... plus a separate review of tables that already exist — revoking defaults does not undo grants already attached.
L — views over RLS tables without security_invoker
A normal view is evaluated with the view owner's rights, not the caller's. If the owner is BYPASSRLS, a superuser, or the base table's own owner on a table without FORCE ROW LEVEL SECURITY, the view can read rows the caller's policies would hide.
Important nuance I verified on PostgreSQL 17: enabling FORCE ROW LEVEL SECURITY on the base table does not close the case where the view owner has BYPASSRLS. FORCE constrains the table owner; it does not constrain a role with BYPASSRLS. Only ALTER VIEW ... SET (security_invoker = true) makes the view evaluate policies as the caller.
The catalog check joins pg_rewrite dependency edges (pg_depend with classid='pg_rewrite'::regclass, refclassid='pg_class'::regclass, deptype='n') from views in public to RLS-enabled base tables, then flags views whose reloptions lack security_invoker=true when the owner has BYPASSRLS/superuser or owns the base table without FORCE.
Why these belong in a nightly diff
Both surfaces change outside the normal policy workflow: one is set by a migration role once and affects objects created weeks later; the other is a property of a view that nobody touches after the table policies are fixed. A one-off audit goes stale silently.
I added K and L to a free, read-only nightly monitor (now 12 catalog checks). It takes a baseline on the first run, reports only NEW/RESOLVED fingerprints afterwards, and stops instead of writing an empty baseline if credentials break. The same checks are available as standalone SQL. Start here: Supabase RLS Drift Monitor — free n8n workflow + 12 SQL checks
If you want a human to read the results and separate real exposure from noise, that is a separate fixed-scope service: Supabase RLS Spot Check. Work starts only after payment is secured; no discount, no surprise scope.
Honest limits
These are catalog checks, not proof of a leak. They report suspicious configuration; they do not read application rows, do not run as service_role, and do not modify anything. I verified the SQL against a local PostgreSQL 17 fixture, not against hosted Supabase projects. Hosted defaults and the exact revision a project runs are outside what a public catalog query can tell you. Zero findings does not mean safe.
Top comments (2)
The default-privileges gap is the one that would scare me most, because it leaves nothing in the usual grant views to find — a migration role quietly grants SELECT to anon on tables that do not exist yet, and the exposure only materializes weeks later when a migration creates the table. Your second finding is the sharper nuance though: I had assumed FORCE ROW LEVEL SECURITY on the base table closed the view hole, and learning that it does not constrain a BYPASSRLS view owner — only security_invoker does — is the kind of Postgres 17 detail worth the whole post. Of the 12 checks in your nightly monitor, which one has actually caught a live misconfiguration most often in real apps?
Honest answer: I don't have that measurement. The monitor is published as a workflow and I've verified all 12 checks against a synthetic PostgreSQL 17 fixture, but I have no live-app deployment telemetry, so I can't claim any check "catches drift most often" — that would be a frequency claim I can't support.
What I can say: pg_default_acl is the one I would look at first in a catalogue pass, because a GRANT ... ON TABLES TO anon run as a default leaves no row in role_table_grants until a future table exists. The view-owner case is the one I would verify second, because FORCE ROW LEVEL SECURITY only changes the table's own enforcement: a BYPASSRLS owner still reads through a non-security_invoker view. Both are catalogue signals, not proof of a leak — a clean scan means "no signal found", not "safe".
On intentional changes: there is no approval workflow in the free workflow today. The diff reports NEW and RESOLVED; after you review a NEW finding and decide it is expected, you replace the stored baseline with the current snapshot. If you need an explicit allow-list so approved changes stop alerting, that is a real feature gap, not something the current workflow does.