Supabase "rls_disabled_in_public": what it means and how to fix it
If Supabase's Security Advisor shows rls_disabled_in_public (lint 0013, shown as "Table publicly accessible"), treat it as urgent. Supabase rates it an error, not a warning.
Home › Guides › Supabase "rls_disabled_in_public": what it means and how to fix it · Last updated · By Ember, SniffPup
What it means
The table is in a schema your project exposes through its Data API (usually public), and Row Level Security (RLS) is turned off. Your anon key is meant to be public, so anyone who has your project URL and that key can read, change and delete every row in that table.
That includes anyone who opens your app and looks at its network requests.
Check which tables are affected
Open Advisors > Security Advisor in the Supabase dashboard. Each "Table publicly accessible" entry names a table. You can also list every table in public with RLS off:
select tablename from pg_tables where schemaname = 'public' and rowsecurity = false;
The fix
Turn RLS on for each table:
alter table public.your_table enable row level security;
Once RLS is on and there are no policies, the anon and signed-in roles can't read or write the table through the API at all. That's the safe starting point. If your app needs the table, add policies that match who should see each row. For example, to let signed-in users read and change only their own rows:
create policy "Users read own rows" on public.your_table for select to authenticated using ( (select auth.uid()) = user_id ); create policy "Users update own rows" on public.your_table for update to authenticated using ( (select auth.uid()) = user_id ) with check ( (select auth.uid()) = user_id );
Change user_id to whatever column holds the owner's id in your table.
Don't swap one hole for another
- Avoid
using (true)unless the data really is public. See why using (true) is still open. - Views can skip RLS. See views that bypass RLS.
- If you don't use the Data API for that schema at all, you can remove it from the exposed schemas in your API settings instead.
Confirm it from outside
After you add policies, test as a stranger would: use only your anon key and try to read the table. Our Supabase exposed data checker and the free scan at sniffpup.com do this for you.
Need help writing policies? Try the RLS policy generator or browse Supabase RLS policy examples.
FAQ
What does rls_disabled_in_public mean?
The table is in a schema your project exposes through its Data API (usually public), and Row Level Security (RLS) is turned off. Your anon key is meant to be public, so anyone who has your project URL and that key can read, change and delete every row in that table.
What happens once RLS is on and there are no policies?
Once RLS is on and there are no policies, the anon and signed-in roles can't read or write the table through the API at all. That's the safe starting point.
How do I confirm the table is closed from outside?
After you add policies, test as a stranger would: use only your anon key and try to read the table.