Guide · November 5, 2026
Supabase RLS check: find open tables in 5 minutes
If your app talks to Supabase from the browser with the anon (publishable) key, Row Level Security is the only lock on your data. Grants decide whether a role can touch a table; RLS decides which rows. Miss either one and anyone with your project URL and public key can read or change rows.
Shortcut: run our free live-site check. It probes your public JavaScript for leaked keys and tries to read Supabase tables while logged out, the way a stranger would.
1. Confirm the browser only has the public key
Open your live site logged out. In DevTools → Sources (or Network, filtered to JS), search for service_role, sb_secret_, and eyJ JWTs. A Supabase anon / publishable key is normal. A service_role key or any sb_secret_ key in the bundle is a critical leak — rotate it, then remove it from the frontend.
2. Turn RLS on for every table in public
In the SQL editor:
select tablename, rowsecurity
from pg_tables
where schemaname = 'public'
order by 1;
Any false is a table the API can reach without row filters. Turn RLS on:
alter table public.your_table enable row level security;
Expect the app to look broken right after. With RLS on and no policies, Postgres denies everything. That is correct. Access now has to be granted on purpose.
Supabase's Oct 30, 2026 change stopped giving anon / authenticated default grants on new public tables. Existing tables keep their old grants, so an open table stays open until you fix it. (Supabase: securing your API)
3. Kill USING (true) and write policies that name a role
select schemaname, tablename, policyname, roles, cmd, qual, with_check
from pg_policies
where schemaname = 'public'
order by 1, 2;
Remove any policy whose qual or with_check is literally true (or a tautology) unless the data is meant to be public. Prefer one policy per operation that names a role and checks the owner:
create policy "Users read their own rows"
on public.orders for select
to authenticated
using ( (select auth.uid()) = user_id );
create policy "Users insert their own rows"
on public.orders for insert
to authenticated
with check ( (select auth.uid()) = user_id );
Policies with no TO clause default to PUBLIC, which includes anon. Name the role on purpose.
4. Lock privileged columns on UPDATE
An owner-scoped UPDATE policy still lets a user change every column on their own row — including is_admin, role, plan, or credits. Fix with column grants or a BEFORE UPDATE trigger that resets privileged fields. Supabase Column Level Security (and a trigger) both work; pick one and test it.
5. Views and SECURITY DEFINER functions
- Views run as the view owner by default and can bypass the underlying tables' RLS. On Postgres 15+:
alter view public.v set (security_invoker = true); SECURITY DEFINERfunctions inpublicare callable viarpc()with the anon key unless you revoke execute. Checkauth.uid()inside, setsearch_path = '', and revoke execute from roles that don't need them.
6. Prove it from the outside
With only the anon key (no session), try:
curl -s "https://YOUR_PROJECT.supabase.co/rest/v1/your_table?select=*&limit=5" \
-H "apikey: YOUR_ANON_KEY" \
-H "Authorization: Bearer YOUR_ANON_KEY"
Real user rows in the response means the table is open. Empty / permission error is what you want for private data.
Or skip the curl and run the free VibePreflight check against your live URL. It looks for leaked keys, exposed /.env / /.git, and Supabase tables readable while logged out, and gives a copy-paste fix prompt for each finding.
Want a second pair of eyes?
The paid report scans your repo and optional live URL for RLS gaps, privileged-column UPDATE holes, views without security_invoker, and secrets — with a ranked fix list. See a sample report, or get your own. The free guardrail pack adds agent rules so Cursor / Claude Code stop shipping the same holes.
The VibePreflight team