Security checklists are easy to write and hard to act on. Below is the actual report produced by twelve read-only catalogue checks against a deliberately drifting local PostgreSQL 17 container. It is a synthetic fixture: no customer project, no hosted database, no production connection. The point is the shape of the output and the kind of state it catches.
The access used
The checks ran as a catalogue-only role created from a small SQL template: CONNECT on the database and USAGE on public, with no SELECT grant on any application table. All twelve checks completed. A direct SELECT * FROM public.orders under the same role returned permission denied for table orders.
That boundary is the design constraint. A nightly drift check should see security-relevant catalogue state without seeing customer rows. No service_role, no superuser, no BYPASSRLS, no writes.
The fixture
-
public.orders— row level security disabled. -
public.accounts— RLS on but notFORCEd; a plain view sits over it. -
public.events— RLS on, permissiveSELECT ... USING (true)policy. -
public.lookup—SECURITY DEFINER, no pinnedsearch_path, ownerpostgres. -
ALTER DEFAULT PRIVILEGES ... GRANT SELECT ON TABLES TO anon.
The output (nine rows)
| Severity | Check | Object | Signal |
|---|---|---|---|
| HIGH | A | public.orders |
RLS disabled |
| HIGH | C | public.events :: p_read_all |
Permissive SELECT/ALL with USING (true)
|
| HIGH | G | public.lookup |
Definer function without pinned search_path
|
| HIGH | H |
public.lookup (owner postgres) |
Definer owned by a role that bypasses RLS |
| HIGH | K | default privileges | Future tables will grant SELECT to anon
|
| HIGH | L | public.accounts_view |
View runs with owner rights; owner bypasses RLS |
| MEDIUM | B ×2 |
accounts, events
|
RLS on but not FORCEd — owner bypasses policies |
| MEDIUM | J | public.lookup / PUBLIC |
API role can EXECUTE the function directly |
Each row also carries a suggested fix and a fingerprint. The fingerprint is what makes a nightly diff useful: the first run captures a baseline, later runs report only new or resolved fingerprints.
Why two of these need the catalogue
Check K lives in pg_default_acl. It will never appear in role_table_grants until the future table exists. Check L is a property of the view (security_invoker), not of the underlying table's policies. A per-table policy review can be perfectly thorough and still miss both.
How to read the report
Every row is a catalogue signal plus a suggested fix, not proof of a leak. A view flagged by L may be intentional. A definer function flagged by G may have a fully qualified body. The value is timing: you see the state change while the migration diff is still fresh.
The inverse matters just as much. Zero findings means no catalogue signal was found — not that the database is safe. It cannot tell you whether a policy matches intent, whether a key is exposed in a browser bundle, or whether a hosted platform rewrites a grant. The workflow is also fail-closed: a broken credential stops the run instead of recording an empty baseline.
No hosted defaults, revision numbers, or affected-version ranges are claimed here. Test on a scratch database before pointing any monitor at a real project.
The workflow, standalone SQL, catalogue-only role template, start guides, and this verbatim sample output are in the free package: Supabase RLS Drift Monitor.
Top comments (1)
The number that sells this for me is not the nine findings — it is the twelve checks running as a catalogue-only role that cannot read a single application row. That constraint is what makes a nightly drift check safe to actually run, and the fingerprint per finding is what makes the nightly diff usable instead of a wall of repeated warnings. The finding I would have missed is K, the default-privileges grant to anon: nothing is wrong today, and the next table created inherits the hole. Your line that zero findings means no catalogue signal was found, not that the database is safe, is the honest frame most security posts skip. Quick question: of the six HIGH findings, which one do you fix first on a real app — the RLS-disabled table, or the default-privileges grant that quietly reopens it later?