Supabase RLS missing: what it means and how to fix it
"RLS missing" means a table in your Supabase project has Row Level Security turned off. With RLS off, the public anon key is not safe to expose — the API will serve every row in that table to anyone who asks. This page shows how to find it, how to fix it, and how to check automatically.
What Row Level Security actually does
Supabase puts a database behind a public API. The anon key is designed to be shipped in a browser, and that is safe only because Row Level Security decides which rows each request may touch. RLS is the lock. The key is not the lock.
When RLS is missing on a table, the lock is absent. The anon key becomes a skeleton key for that table: read every row, and depending on the table's grants, write them too.
Most common cause: a migration created the table and never ran alter table ... enable row level security;. AI builders do this constantly, because the app works perfectly in the UI without RLS — the data is exposed through the API, not through the screen.
Find every table without RLS
Run this in the Supabase SQL editor. It lists public tables whose Row Level Security is off:
select n.nspname as schema,
c.relname as table_name
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where c.relkind = 'r'
and n.nspname = 'public'
and c.relrowsecurity = false
order by 1, 2;
Then check which have RLS on but are not forced, and which have no policies at all:
-- RLS on, but the owner can still bypass it
select n.nspname as schema, c.relname as table_name
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where c.relkind = 'r'
and n.nspname = 'public'
and c.relrowsecurity = true
and c.relforcerowsecurity = false;
-- Every policy, by table
select schemaname, tablename, policyname, cmd, qual, with_check
from pg_policies
where schemaname = 'public'
order by 1, 2;
The fix: enable RLS, then write a real policy
Turning RLS on with no policies denies everyone, which is safe but often breaks the app. Enable it and add the policy that expresses who may see what:
alter table public.your_table enable row level security;
create policy "own rows"
on public.your_table
for all
to authenticated
using (auth.uid() = user_id)
with check (auth.uid() = user_id);
Then force it, so the table owner and service paths are held to the same rules:
alter table public.your_table force row level security;
If a table is server-only and never read by the client, leave RLS on with no policy — that is the safe default. If the app reads it, it needs a policy.
Three mistakes that leave the door open even with RLS on
using (true): a policy that allows everyone. RLS is on, but it no longer protects anything.- No
WITH CHECKon writes: the policy controls what a user reads but not what they write, so new rows can be pointed at another account. - No
FORCE: the table owner and some service paths bypass the policies entirely.
Upload your supabase/migrations and source; get a plain-English list of missing RLS, open policies, and exposed keys, with the exact fix SQL. Free and read-only — the upload is discarded after the scan.
Questions people ask
Is the anon key safe to expose?
Yes — when RLS is correctly enabled and every table has a policy that scopes rows. No — on any table where RLS is off, where the policy is using (true), or where a write policy has no WITH CHECK.
Does RLS protect against the service_role key?
No. The service_role key bypasses RLS by design and must never reach a browser or a public repo. If it leaked, rotate it and move it server-side.
Can a scan fix it automatically?
BellerBuild generates the fix SQL and a suggested migration you can review and apply. It does not write to your live database.
Does this work for a project I built with Cursor, Bolt, Lovable, or v0?
Yes. The scan reads the migrations and source those tools generate. The tool is not the risk — the defaults it generated are.