Supabase RLS checklist for AI-built apps
Short answer
A Supabase app is safe to put on the internet only when every table in exposed schemas has Row Level Security enabled, every policy names the caller for private data, and the secret key is not in the client. Grants and RLS are different switches: after October 30, 2026 new tables are not exposed to the Data API until you GRANT, and a GRANT without RLS makes the table public to the publishable key. Verify with pg_tables, pg_policies, and one signed-out request — not with the dashboard’s green RLS badge.
Last updated · Sekrd Research
- The publishable key is public. RLS is the access control. The secret key bypasses RLS.
- Enabling RLS with no policy denies access. A policy of USING (true) allows access to every row.
- From October 30, 2026, new tables in existing projects are not granted to the Data API automatically. Existing tables keep their grants.
The checklist
- Inventory tables with RLS off. Supabase’s docs recommend this as the first query. Include storage if you store user files there; the objects table is
storage.objects.
select n.nspname as schema, c.relname as table
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where c.relkind = 'r'
and n.nspname in ('public', 'storage')
and c.relrowsecurity = false;
Anything in that list that holds user data gets ENABLE ROW LEVEL SECURITY before you write a policy. Enabling RLS without a policy blocks the Data API, which is the safe default. The dashboard badge “RLS enabled” does not tell you what the policy allows. USING (true) is covered in why “enabled” is not closed.
- Read every policy.
select schemaname, tablename, policyname, roles, cmd, qual, with_check
from pg_policies
where schemaname in ('public', 'storage')
order by tablename, cmd;
For a private table you want, per command you actually use:
SELECTwithUSING ((select auth.uid()) = user_id)— Supabase asks for theselectwrapper so the planner caches the call.INSERTwithWITH CHECK, not onlyUSING.USINGdoes not constrain new rows.UPDATEwith both, so a user cannot reassignuser_idto someone else.DELETEwithUSING.
A policy aimed at public or anon on a table of emails, sessions, or orders is a bug unless you have decided that table is a public blog. TO authenticated is not enough by itself: every signed-in user is authenticated.
- Do not confuse GRANT with RLS. Since May 30, 2026 for new projects and October 30, 2026 for existing ones, a new table is invisible to the API until you grant privileges. The timeline and the SQL are in the Data API change. Grant
anononly what anonymous visitors should do. Then add RLS. A grant without RLS is a public table. - Views and security-definer functions. A view owned by a privileged role can bypass RLS on the underlying tables depending on
security_invoker. In Postgres 15 and later, setsecurity_invoker = onfor views that should respect the caller’s RLS. A function markedSECURITY DEFINERruns as its owner and skips the caller’s policies; keep those functions narrow, and revoke execute fromanonandpublicunless anonymous users must call them. - Storage. Private uploads need a policy on
storage.objects. A bucket flagged public serves files by URL with no policy at all — fine for logos, wrong for ID documents. Two Storage server bugs are separate from policies: the October 14 signed-upload bypass (fix 1.80.2) and the November 6 role none bypass (fix 1.89.9). - The secret key is not a policy.
sb_secret_and the legacy service_role key bypass every policy. They belong in Edge Function secrets and on servers. Finding one in the bundle is a hard block. See publishable versus secret keys. - Prove it while signed out. Copy the project URL and the publishable key from the frontend, then request one private table with no user JWT. Zero rows, or a permission error, is what you want. A row means the checklist is not done, whatever the dashboard says.
curl -s "https://PROJECT.supabase.co/rest/v1/profiles?select=id&limit=1" \
-H "apikey: PUBLISHABLE_KEY" \
-H "Authorization: Bearer PUBLISHABLE_KEY"
Use your own project. Do not point this at someone else’s.
When an agent adds the next table
Paste the checklist into the same change as the migration. Lovable, Bolt, Cursor, and v0 all create tables from a prompt, and the prompt rarely includes a policy. Re-run the two queries after each migration. A free scan of the live site catches a secret key in the bundle; a deep scan can read policies when you connect the project. Plans are on /pricing.
Frequently asked questions
What is a Supabase RLS checklist for a new app?
Enable Row Level Security on every exposed table, add per-command policies that check auth.uid() for private data, grant Data API access only to roles that should have it, set storage policies, keep the secret key off the client, and request a private table with only the publishable key while signed out.
Does enabling RLS secure the table?
Enabling RLS with no policy denies access, which is safe. A policy whose expression is true allows every row. You have to read the policy, not the badge.
Do I still need RLS after Supabase’s October 30, 2026 change?
Yes. That change stops automatic GRANTs on new tables. A table you then grant to anon or authenticated is still fully readable unless RLS policies restrict rows. Existing tables were not changed.
Sources
Don't ship until you're sekrd
Run a free scan to find the vulnerabilities your AI missed.
Scan Your App Free