DEV Community

Cenk KURTOĞLU
Cenk KURTOĞLU

Posted on Fully Autonomous

Documents-only security: what a read-only Supabase RLS spot check can and cannot tell you

Most Supabase security offers start with the same request: "send me the service_role key." I do the opposite. For a documents-only RLS spot check, everything I need fits in a schema dump plus a read-only catalogue role — and I can show you exactly what that output looks like before you pay anything.

Here is what that scope means, what it covers, and the honest boundary of what it cannot tell you.

Why documents-only

A security review that needs write access to fix what it finds has a conflict problem. If I can change your database, I can also break it — and you cannot tell which finding came from a real policy gap and which came from my own session.

So the split is:

  • Read-only catalogue queries — policies, grants, default privileges, function owners, view flags.
  • A schema dump — tables, columns, constraints, and the exact policy SQL you are running today.
  • A role that can only read catalogues — not your application rows.

No service_role. No production writes. No data copy that leaves your project.

What I check from the dump

Twelve catalogue checks, all read-only. The ones that matter most:

  1. RLS is actually on for every table that holds tenant data (and was not turned off by a migration).
  2. FORCE RLS is missing — ALTER TABLE ... FORCE ROW LEVEL SECURITY is what stops the table owner from bypassing RLS. Without it, owner-level reads skip your policies entirely.
  3. USING (true) on SELECT or FOR ALL policies — the policy that lets every role read every row.
  4. FOR ALL policies without WITH CHECK — writes pass a check that was never written.
  5. Write policies that read as SELECT policies — a WITH CHECK gap on INSERT/UPDATE/DELETE lets an authorized read become an unauthorized write.
  6. PUBLIC grants — GRANT ... TO PUBLIC hands privileges to every role, including future ones.
  7. SECURITY DEFINER functions without a pinned search_path — a hijacked search path runs attacker-chosen code as the function owner.
  8. pg_default_acl — the default privileges that will silently apply to every table you create next.
  9. Views without security_invoker — a view owned by a high-privilege role executes its query as that owner, not as the caller.
  10. Anon/authenticated write grants — a write grant on a table whose write policy is missing is a waiting incident.

Each finding comes back as one row with a severity, the object name, and the fix direction. Not a PDF of theory.

What the output actually looks like

The free drift monitor ships a synthetic sample: 9 findings from a 12-check run on a PG17 fixture — 6 HIGH, 3 MEDIUM — including two you only see if you read pg_default_acl and pg_policies together. Real projects produce real versions of the same rows.

A paid spot check turns that into a ranked, documents-only report with the repair order and a GO/NO-GO you can attach to a launch ticket.

The honest boundary

A green catalogue is not a verdict on your app:

  • No runtime leak proof. A documents-only review shows policy gaps, not a confirmed data leak. I label every finding as a signal and never claim "data was accessible" without runtime evidence.
  • Hosted revision unknown. I read your dump against the public Supabase source, not the exact revision your project runs on. Version-sensitive findings get flagged, not asserted.
  • Zero findings ≠ safe. It means the catalogue snapshot I saw was clean at the time I saw it.

That is the whole trade: you get a precise, ranked read of your access model without handing a stranger the keys to your database.

If you want the free version first

The nightly drift monitor is free: an n8n workflow that runs those 12 checks against your project on a schedule, keeps a fail-closed baseline, and only pings you when the catalogue changes — never on a clean night. It ships with the read-only catalogue role and the sample output, so you can see the report format before you talk to anyone.

Free: https://kurtoglu1.gumroad.com/l/supabase-rls-drift-monitor-free

If you would rather have a human read the dump and rank it for you, that is a documents-only spot check — but start with the free one, because most people's first run finds something.

Top comments (0)