Supabase RLS checker: is your anon key exposing data?
Check which Supabase tables an anonymous visitor can read, understand anon vs service_role keys, and fix RLS and grants before (and after) Supabase's 30 Oct 2026 change.
If your app uses supabase-js in the browser, your project URL and anon (publishable) key are public. That's by design. What protects your data is Row Level Security (RLS) plus grants. This page explains how to check both, by hand or with a free scan.
Grants vs RLS
- Grants decide whether a role (
anon,authenticated) can touch a table at all. - RLS policies decide which rows that role can see or change.
Supabase puts it this way: "Grants are a separate layer: they control whether a role can access a table at all, while RLS controls which rows that role can see" (changelog). Until now, existing projects granted select, insert, update, delete on new public tables to anon and authenticated by default (Securing your API). With those default grants, an RLS mistake means anyone can access the data.
The 30 October 2026 change
On 30 Oct 2026, Supabase applies "don't auto-expose new tables" to all existing projects. Tables you already have keep their grants. New tables need an explicit GRANT before the Data API can reach them. If a grant is missing, you get:
{"code":"42501","message":"permission denied for table your_table"}
What to watch for: an AI assistant may "fix" this by running grant all ... to anon or turning RLS off. Grant the minimum instead:
grant select, insert, update, delete on public.notes to authenticated;
alter table public.notes enable row level security;
create policy "owner can read" on public.notes
for select to authenticated using ((select auth.uid()) = user_id);
Which key is which
| Key | Safe in browser? |
|---|---|
Publishable sb_publishable_... / legacy anon (JWT) |
Yes, but only if RLS is right |
Secret sb_secret_... / legacy service_role (JWT) |
Never. Bypasses RLS |
Source: Supabase API keys. If a service_role key has ever been in your frontend or git history, rotate it now. |
Manual check (5 minutes)
- Dashboard: Table Editor → look for "RLS disabled". Run Security Advisor (Database → Advisors). It flags tables with RLS off and other issues.
- SQL:
select schemaname, tablename, rowsecurity
from pg_tables where schemaname = 'public' order by rowsecurity;
- As a signed-out visitor:
curl "https://YOUR-REF.supabase.co/rest/v1/YOUR_TABLE?select=*&limit=1" -H "apikey: YOUR_ANON_KEY"
Getting rows back for private data means it's exposed. [] means either RLS is blocking you (good) or the table is empty.
4. Views: views can bypass RLS. On Postgres 15+, create them with (security_invoker = true) (Postgres docs: CREATE VIEW).
5. Write paths: test insert/update/delete as a second signed-in user. A read-only outside scan can't prove these are safe.
Common RLS mistakes in AI-generated apps
using (true)on tables that hold user data- An
insertpolicy with nowith check - Tables added by hand in the dashboard after the AI set up the rest
- RLS turned off "temporarily" to fix an error
- A
security definerfunction or view that returns every row
Free automated check
KeyMoat finds the Supabase URL and key your live site ships with, flags a leaked service_role or sb_secret_ key, and checks whether a sample of up to 8 tables returns rows to an anonymous visitor (row counts only, no data downloaded). It can't test write policies, views in depth, or what signed-in users can see. It's read-only and needs only your URL. Only scan apps you own.
Re-scan after 30 October and after every AI-generated migration. Monitoring (from $5/mo) does this weekly and emails you about new exposures.
Further reading: Supabase RLS docs, CVE-2025-48757.
Run a free, read-only scan of your live app
Paste your URL. Checks leaked keys, exposed files, security headers and anonymous Supabase access. Only scan sites you own.
Scan my site free →