Fix guide · tested 18 October 2026 · updated 14 November 2026

How to fix "RLS disabled in public" in Supabase

Supabase's Security Advisor reports "RLS disabled in public" (lint 0013, level ERROR) when a table in the public schema has Row Level Security turned off.

Supabase flags "RLS disabled in public" when a table in the public schema has Row Level Security off. Because public tables are reachable through Supabase's APIs with the publishable key (or the legacy anon key) that ships in your front end, anyone can then read, insert, update and delete every row. Fix it in three steps: run alter table public.your_table enable row level security;, add a policy for each operation your app needs (for example, users can only select their own rows), and revoke grants the anon role shouldn't have. Then test signed out and as a second user.

How we tested this: We ran every SQL statement on this page on PostgreSQL 17.11 with Supabase-style anon and authenticated roles and a stand-in for auth.uid(), not on a live Supabase project, on 18 October 2026. Before the fix, the anon role could count all rows; after it, anon got "permission denied", one signed-in user saw only their own row, and an update to another user's row changed 0 rows. On 14 November 2026 we added the 30 October 2026 grant change, the index step and the related Advisor lints from Supabase's changelog, RLS guide and lint docs, read that day. Those additions are quoted from Supabase, not re-run in our test.

Why it matters

Supabase's own lint documentation puts it bluntly: if RLS isn't enabled on a public table, anyone with your project URL can create, read, update and delete rows in it. Your project URL and publishable key aren't secrets. They're in the JavaScript every visitor downloads, so this isn't a theoretical risk. Supabase's API keys guide (read 28 November 2026) says it is deprecating the legacy anon and service_role keys in early 2027 in favour of publishable (sb_publishable_) and secret (sb_secret_) keys. The risk doesn't change: the publishable key only reaches what Row Level Security allows, so RLS is still what protects your rows. It's the mechanism behind CVE-2025-48757, which affected apps generated by Lovable (see is Lovable secure?, or get your app checked with our Lovable security audit).

Enabling RLS on its own makes the table deny everything to the anon and authenticated roles until you add policies. That's safe, but it can break your app, so add the policies your app needs in the same change.

Check it first (read-only)

Run this in the Supabase SQL editor. It only reads the system catalog and changes nothing. Every row it returns is a table in public with RLS 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 in ('r', 'p')
  and n.nspname = 'public'
  and not c.relrowsecurity
order by 2;

You can also open Advisors → Security Advisor in the Supabase dashboard, which runs the same lint. To see it from outside, our free Supabase exposure checker shows which tables return rows to a signed-out visitor.

The fix, step by step

  1. Decide who should see each table. For each table the check returned, write down who should read and write it: nobody signed out, only the row's owner, or everyone (for example a public product list). That decides the policies.
  2. Enable RLS. Run alter table public.profiles enable row level security; for each table, replacing profiles with the table name. From this point the anon and authenticated roles can't read or write it until a policy allows it.
    alter table public.profiles enable row level security;
  3. Add a policy per operation. Add only the policies your app needs. This pair lets signed-in users read and update only their own profile row. Supabase recommends wrapping auth.uid() in a select and naming the role with to authenticated, so the policy doesn't run for signed-out requests.
    create policy "Users can read own profile"
    on public.profiles for select
    to authenticated
    using ((select auth.uid()) = id);
    
    create policy "Users can update own profile"
    on public.profiles for update
    to authenticated
    using ((select auth.uid()) = id)
    with check ((select auth.uid()) = id);
  4. Index the column your policies filter on. Supabase's RLS guide (read 14 November 2026) says to add an index on every column your policies filter on, because Postgres checks the policy against each candidate row and an unindexed column turns a read into a sequential scan. For a policy on user_id, this is the index. (On profiles, id is the primary key, so it's already indexed.)
    create index if not exists notes_user_id_idx
    on public.notes using btree (user_id);
  5. Revoke grants anon shouldn't have. Supabase's RLS guide says adding policies doesn't take grants back. Tables created before Supabase's 30 October 2026 change usually still carry select, insert, update and delete grants for anon and authenticated, so revoke what signed-out visitors shouldn't do. In our test, a table with RLS on but no policy for insert still returned "new row violates row-level security policy" to anon, which is safe, but revoking the grant makes the intent explicit and stops a future permissive policy from opening it.
    revoke insert, update, delete on public.profiles from anon;
    -- if signed-out visitors should not read it at all:
    revoke select on public.profiles from anon;
  6. Test signed out and as a second user. Re-run the read-only check (it should return no rows), then use your app in a private window and with two test accounts. Signed out, private tables should return nothing or an error. Signed in as user A, you should never see user B's rows. Supabase's guide recommends pgTAP tests (supabase test db) that assert allow and deny for each operation and role.

If a table should be public

Some tables are meant to be readable by everyone, such as a list of products or published blog posts. Keep RLS on anyway and add an explicit read policy, for example create policy "Anyone can read published posts" on public.posts for select to anon, authenticated using (published = true);. That keeps writes closed and documents the decision, and Supabase's advisor stops flagging the table.

New tables since 30 October 2026

Supabase's changelog (read 14 November 2026) says that from 30 October 2026, new tables in the public schema on all projects no longer get automatic grants for anon, authenticated and service_role. Existing tables keep theirs. A new table is unreachable through the Data API until you grant access, and the API answers with error 42501 ("permission denied for table"). RLS works the same as before: grants decide whether a role can touch the table at all, policies decide which rows.

The risk is the quick fix. If a new table returns 42501, don't grant it to anon while RLS is off, because that opens it to everyone and brings back this advisor error. Put the table, RLS, its policies and only the grants each role needs in one migration:

alter table public.notes enable row level security;
create policy "Owners read their notes" on public.notes
  for select to authenticated using ((select auth.uid()) = user_id);
grant select, insert, update, delete on public.notes to authenticated;

Supabase's RLS guide also links to an event-trigger recipe that turns RLS on automatically for every new table, if you want a safety net.

Related Security Advisor findings

Two INFO-level lints often show up next to this one. Policy Exists RLS Disabled (0007) means you wrote policies but never enabled RLS, so they do nothing yet: the fix is the same enable row level security line. RLS Enabled No Policy (0008) means RLS is on with no policies, so the API can read nothing from that table. That's safe, and sometimes intended for server-only tables, but if your app needs the table, add the policies from step 3.

If you don't use the Data API at all

Supabase's lint documentation gives one more option: if you never query these tables from the browser, remove the public schema from the exposed schemas in your project's API settings. That makes everything in it unreachable over the API. Most apps built with Lovable, Bolt or v0 do query from the browser, so for them RLS with policies is the fix.

Common mistakes

FAQ

What does "RLS disabled in public" mean in Supabase?

A table in the public schema has Row Level Security turned off. Because public tables are reachable through Supabase's APIs with your publishable (or legacy anon) key, anyone can read and change every row until you enable RLS and add policies.

Will enabling RLS break my app?

It can. With RLS on and no policies, the anon and authenticated roles get no rows back. Add the policies your app needs in the same change, then test signed out and as two users.

Is the Supabase anon key a secret?

No. The anon key, and the publishable key (sb_publishable_) that Supabase now recommends instead, are designed to be public and ship in your front-end code. That's why RLS policies, not the key, are what protect your data. Supabase says it is deprecating the legacy anon and service_role keys in early 2027 (API keys guide, read 28 November 2026).

Do I still need to revoke grants after adding policies?

Supabase's RLS guide says adding policies doesn't remove existing grants. With RLS on, anything no policy allows is still denied, but revoking grants anon doesn't need makes the intent explicit and safer against a future permissive policy.

How do I check RLS without changing anything?

Run the read-only catalog query on this page in the SQL editor, or open the Security Advisor in the dashboard. Both list public tables with RLS off and change nothing.

Why does my new Supabase table return 42501 permission denied?

Since 30 October 2026, Supabase no longer grants new public tables to anon, authenticated and service_role automatically (Supabase changelog, read 14 November 2026). Enable RLS, add policies, then grant only the operations each role needs, in one migration. Don't grant to anon with RLS off.

Want someone to check it for you?

We check this as part of the $49 AI Site Audit. See how we test and what we don't check.

How this guide was made: researched and drafted with AI assistance, then every step was run and checked as described above on 18 October 2026. Editorial responsibility: ChikuOS. Found a problem? Email hello@chikuos.com.

Chat