Cenk Kurtoğlu©26

Supabase security · 7 minute read

Two Supabase RLS gaps a per-table policy review will not show you

Most RLS reviews start with pg_tables and pg_policies: is RLS on, and do the policies look right? Two access paths never appear in that view — one because the table does not exist yet, the other because the read goes through a view owned by a different role.

Check K: grants attached to future tables

ALTER DEFAULT PRIVILEGES FOR ROLE migration_role IN SCHEMA public GRANT SELECT ON TABLES TO anon; does not create a row in information_schema.role_table_grants and does not create a policy. The grant lives in pg_default_acl and attaches automatically when a migration later creates a table.

The read-only catalog check reads pg_default_acl, expands defaclacl with aclexplode(), and flags rows 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. The fix hint is deliberate: revoke the default, then review existing tables separately — revoking defaults does not undo grants already attached.

Check L: views that read as their owner

A normal view is evaluated with the view owner's rights, not the caller's. If that owner is a superuser, has BYPASSRLS, or owns the base table on a table without FORCE ROW LEVEL SECURITY, the view can return rows the caller's policies would hide.

The nuance matters. On PostgreSQL 17 I verified that 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, not a role with BYPASSRLS. Only ALTER VIEW ... SET (security_invoker = true) makes the view evaluate policies as the caller. A view owned by a plain table owner does stop being a finding once FORCE is enabled.

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 is 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 once by a migration role and affects objects created weeks later; the other is a property of a view nobody touches after the table policies are fixed. A one-time audit goes stale silently. A nightly baseline diff reports only new fingerprints, and fails closed when credentials break instead of writing an empty baseline.

K and L are checks eleven and twelve in the free, read-only RLS drift monitor; the standalone SQL runs them without n8n. Use a read-only role — no service_role, no superuser — and try it on a scratch database first.

Get the free RLS Drift Monitor (13 checks, n8n + SQL) →

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. The SQL was verified 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. If you want a person to read the results and separate real exposure from noise, that is a separate fixed-scope review: Supabase RLS Spot Check. Work starts only after payment is secured.

Related: detect Supabase RLS drift with a read-only nightly check · USING vs WITH CHECK: the clause a policy review skips.

Free entry

If you would rather run these checks yourself

Honest limit: a catalog check is not proof of a leak, and an empty log is not proof the key was never used. Zero findings does not mean safe. If you want a human: $29 self-run kit · $95 spot check (five tables, one working day) · $195 full audit — work starts only after payment is secured.

Template bundle

Review all 20 frontend starters in one bundle

20 editable frontend starters with live demos are $79 — one payment, no subscription.

View the Bundle — $79↗