PatchPaste · Guides
Last updated 13 November 2026
Supabase "RLS Disabled in Public": why your table is open, and the fix
Supabase Security Advisor, or Lovable's scan, shows a red ERROR: Table publicly accessible, or "RLS Disabled in Public". You may not have written a single policy yet. Here is what that finding means, why turning RLS on is only half the job, and how to finish it without making the table public again.
public) has Row Level Security turned off. Supabase's docs call this "a critically unsafe configuration": anyone with your project URL can create, read, update and delete every row through the Data API. Fix: alter table public.your_table enable row level security; then revoke leftover grants and add a policy for each operation, scoped to the caller (for example (select auth.uid()) = user_id). Do not turn RLS back off, and do not add using (true) just to make the screen fill again.What the lint says
In Supabase's Advisors docs this is 0013_rls_disabled_in_public, level ERROR, summary "Table publicly accessible". The ramification is: "Anyone with your project URL can read, edit, and delete all data in this table because Row-Level Security is not enabled." The rationale adds that tables in the public schema are accessible over Supabase APIs, and that exposing full create, read, update and delete to the internet is "a critically unsafe configuration".
In a Lovable, Bolt, Cursor or v0 app, that project URL and the public anon (publishable) key are already in the JavaScript every visitor downloads. The key itself is meant to be public. What is not meant to be public is a table with RLS off. See is the anon key safe to expose?.
Why it is so common on AI-built apps
- A new table in
publicoften starts with RLS off. The app works immediately, so nothing looks wrong. - On many existing projects, new tables also start with grants already given to
anonandauthenticated. Supabase's Row Level Security guide says adding policies does not take those grants back. - When someone later turns RLS on and the app goes blank, an AI assistant often "fixes" it by switching RLS off again, or by adding
using (true).
From 30 October 2026, new tables on existing projects may also fail with 42501 permission denied until you grant access. That is a separate issue. See the 42501 fix. Do not answer it by leaving RLS off.
The fix
Do this in one migration, for each flagged table. The official enable step is:
alter table public.your_table enable row level security;
Supabase's RLS guide says that once RLS is enabled, no data is accessible through the API with a publishable key until you create policies. Next, set the grants to match the app, then write a policy per operation:
revoke all on table public.your_table from anon, authenticated; -- Signed-in users manage their own rows. Signed-out visitors get nothing. grant select, insert, update, delete on table public.your_table to authenticated; create policy "Users can view their own rows" on public.your_table for select to authenticated using ( (select auth.uid()) = user_id ); create policy "Users can create their own rows" on public.your_table for insert to authenticated with check ( (select auth.uid()) = user_id ); create policy "Users can update their own rows" on public.your_table for update to authenticated using ( (select auth.uid()) = user_id ) with check ( (select auth.uid()) = user_id ); create policy "Users can delete their own rows" on public.your_table for delete to authenticated using ( (select auth.uid()) = user_id );
If a table is meant to be public (for example a list of published articles), keep RLS on anyway and write a select policy for anon, with no write grants. The official announcements example uses using ( true ) only for that public-read case, after revoking write grants.
If you never use the Data API and talk to Postgres only from a server, Supabase also documents another option: remove public from the Exposed schemas in API settings, so nothing in that schema is reachable over the API.
Related Advisor findings
- 0007_policy_exists_rls_disabled ("Security policy not enforced"): you already wrote policies, but RLS is still off, so they have no effect. Enable RLS.
- 0008_rls_enabled_no_policy ("No access rules defined"): RLS is on and no policy exists, so the API returns nothing. Add a scoped policy, not
using (true). - 0023_sensitive_columns_exposed ("Sensitive data publicly accessible"): RLS is off and the table has columns that look like passwords, tokens or personal identifiers. Enable RLS first.
- 0024_permissive_rls_policy ("Security policy allows unrestricted access"): RLS is on, but a policy uses
using (true)orwith check (true). See RLS using (true).
Fixes to refuse
- "Turn RLS off so the app works again." That is the finding you just fixed. The table is open to anyone with your project URL.
- "Add a using (true) policy so the list fills." That lets every caller read every row. See RLS using (true).
- "Put the service_role or sb_secret_ key in the frontend." That key bypasses RLS completely. See exposed service_role key.
- "Filter by user in the frontend." The API still returns every row to anyone who calls it directly.
Check it worked
- Re-run Security Advisor. The 0013 error should be gone for that table.
- Logged out: open the app in a private window, or call
/rest/v1/your_table?select=*&limit=1with only the anon key. Private rows should not come back. An empty list is what you want for signed-out visitors. - As a second test user: sign in as another account and confirm you see only that account's rows.
- From outside: scan the live URL. PatchPaste tests a short list of common table names with your public anon key (read-only, at most one row, discarded). It will not see every table, so steps 1 to 3 still matter.
A prompt to paste into Lovable
Supabase Security Advisor reports "Table publicly accessible" or "RLS Disabled in Public" (0013_rls_disabled_in_public). Do not disable RLS and do not add using (true) or with check (true) policies. Do not put the service_role key in the frontend. 1) List every public table with RLS off. 2) For each table, tell me whether signed-out visitors should read it, and which signed-in user should see or change each row. 3) Write one migration per table that: enables RLS; revokes all on the table from anon and authenticated; grants back only the operations each role needs; and adds a policy per operation, scoped to (select auth.uid()) = user_id (or a public-read select policy for anon only if the data is meant to be public, with no write grants). 4) Tell me how to test each table logged out and as a second user.
Related: Supabase RLS check, RLS using (true), select returns an empty array, CVE-2025-48757 and Is my Lovable app secure?
RLS Disabled in Public FAQ
What does "RLS Disabled in Public" mean?
It is Supabase Security Advisor lint 0013_rls_disabled_in_public, level ERROR, summary "Table publicly accessible". A table in an exposed schema (usually public) has Row Level Security turned off, so anyone with your project URL can create, read, update and delete every row through the Data API.
Is the public anon key the problem?
No. The anon (publishable) key is meant to be in your frontend. It only becomes dangerous when a table in an exposed schema has RLS off, or a policy that lets every row through. The official ramification is that anyone with your project URL can read, edit and delete all data in the table. In a Lovable or Bolt app that URL and key are already in the JavaScript every visitor downloads.
How do I fix it?
Enable RLS, revoke leftover grants, then add a policy for each operation your app needs. Official enable step: alter table public.your_table enable row level security; After that, no data is accessible through the API with the publishable key until you create policies. Follow with revoke all on table public.your_table from anon, authenticated; then grant back only what the app needs, and policies scoped to (select auth.uid()) = user_id.
My app went blank after I turned RLS on. Why?
That is RLS doing its job: there is no policy yet, so the API returns no rows (Supabase lint 0008). Do not turn RLS back off and do not add using (true). Add a scoped policy for each operation, in the same change.
I already wrote policies. Why is the error still there?
Policies do nothing until RLS is on. That is a separate lint, 0007_policy_exists_rls_disabled ("Security policy not enforced"). Run alter table public.your_table enable row level security; and the policies you already wrote will start to apply.
Can PatchPaste find this?
Yes, in part. If the table name is on the short list PatchPaste tests (for example users, profiles or orders), the free scan will show that the table answers to your public anon key (read-only, at most one row, discarded). It cannot list every table or read your database settings, so still run Security Advisor and a logged-out test of each table you care about.
RLS on? Check the live app for free
Paste your live URL for a free A to F report. PatchPaste checks whether common Supabase tables answer to your public anon key without a login (read-only, at most one row, discarded), searches the JavaScript your site sends for secret keys, and flags exposed .env/.git/source maps and missing headers. It does not sign in or read your database settings, so it will not list every table. Fix prompts for that report are a one-off £9 (or £29 for 10). Scans are free to rerun after each change.
Want to see one first? View a sample report.
Sources (checked 13 Nov 2026): Supabase Database Advisors (0013_rls_disabled_in_public ERROR, ramification, rationale and enable-RLS fix; also 0007_policy_exists_rls_disabled, 0008_rls_enabled_no_policy, 0023_sensitive_columns_exposed and 0024_permissive_rls_policy); Supabase Row Level Security (enable RLS, then revoke and re-grant, a policy per operation, and that no data is accessible through the API with a publishable key until you create policies). Screen wording varies between Supabase Studio and Lovable.