Is your Supabase RLS off? A 5-minute check
Updated Oct 29, 2026 · For apps built with Lovable, Bolt, Cursor, Replit or v0 on Supabase
Short answer: if Row Level Security (RLS) is off on a table in your public schema, anyone can read that table using the anon key that already ships in your site's JavaScript. Here's how to check every table and fix it.
Why this matters
Supabase apps talk to the database straight from the browser, using your project URL and the anon key. That key is meant to be public. What protects your data is RLS: rules on each table that decide which rows a request may see or change. AI coding tools often create tables that work fine while you test as the owner, without the policies that stop strangers.
Step 1: list tables with RLS off
In the Supabase dashboard, open the SQL Editor and run:
select schemaname, tablename, rowsecurity
from pg_tables
where schemaname = 'public'
order by rowsecurity, tablename;
Any row where rowsecurity is false is a table without RLS. The dashboard's Security Advisor also flags these as "RLS disabled in public".
Step 2: see what a stranger sees
Run this from your own terminal against your own project, using the anon key from your frontend:
curl "https://YOUR-PROJECT.supabase.co/rest/v1/profiles?select=*&limit=5" \
-H "apikey: YOUR_ANON_KEY" \
-H "Authorization: Bearer YOUR_ANON_KEY"
If real user rows come back, any visitor can do the same. Repeat for each table that holds personal or paid data. Only test projects you own.
Step 3: the two-account test
RLS can be on but too loose, for example a policy of using (true). Sign up a second test account, log in as it, and try to load the first account's records by changing an id in the URL or request. If you can see them, a policy needs tightening.
Step 4: fix it
Turn RLS on, then add owner-only policies. For a table with a user_id column:
alter table public.profiles enable row level security;
create policy "Users read own rows" on public.profiles
for select to authenticated using (auth.uid() = user_id);
create policy "Users update own rows" on public.profiles
for update to authenticated
using (auth.uid() = user_id) with check (auth.uid() = user_id);
Write one policy per operation (select, insert, update, delete) and name the role, so it's clear who each rule covers. Once RLS is on, anything without a matching policy is denied, so add the policies your app actually needs, then re-run steps 2 and 3 to confirm.
Can a user make themselves "pro" or admin?
Yes, if the row they own also holds their plan or role. An "update own rows" policy like the one above checks which row a user changes, not which columns, so a logged-in user can open the browser console and set their own plan, is_admin or credits column. To test it, log in, then run an update on your own profile row that changes the plan column. If it succeeds, anyone can upgrade for free.
Fix it by letting users update only the columns they're meant to edit, and changing plan or role only from your server (for example, a Stripe webhook using the service_role key):
-- Users may edit only these columns on their own row
revoke update on public.profiles from authenticated;
grant update (full_name, avatar_url) on public.profiles to authenticated;
Alternatively, move plan and role into a separate table that users can read but not write. (Supabase docs: Column level security.)
Step 5: "42501 permission denied" after Oct 30, 2026? Add a grant, don't turn RLS off
On October 30, 2026, Supabase applies a change to all existing projects: new tables you create in the public schema are no longer granted to the anon, authenticated and service_role roles automatically. Until you add a grant, supabase-js, REST and GraphQL calls to that table fail. Tables you already have keep their current grants. (Source: Supabase changelog.)
The error looks like this, and the hint names the exact grant that is missing:
{
"code": "42501",
"message": "permission denied for table your_table",
"hint": "Grant the required privileges to the current role with: GRANT SELECT ON public.your_table TO anon;"
}
Don't "fix" it by disabling RLS or granting everything on every table. Grants decide whether a role can touch a table at all; RLS decides which rows it can see. A grant without RLS opens the whole table to anyone with your anon key. Supabase recommends shipping the grant, RLS and policies together in the same migration (Securing your API):
-- 1. Grant only what each role needs
grant select, insert, update, delete on public.notes to authenticated;
grant select, insert, update, delete on public.notes to service_role;
-- (grant to anon only if logged-out visitors really need this table)
-- 2. Turn on RLS
alter table public.notes enable row level security;
-- 3. Owner-only policy
create policy "Users read own notes" on public.notes
for select to authenticated using (auth.uid() = user_id);
If an AI coding tool creates your tables, ask it to include all three steps in every migration, and check that its fix for a 42501 error adds a grant rather than switching RLS off. Then re-run steps 1 to 3 above. Supabase's Security Advisor and the Data API exposure badge in the Table Editor list tables worth reviewing. More detail: Database API 42501 errors.
Common questions
Is the Supabase anon key a secret?
No. The anon (publishable) key is meant to be in your frontend. It is safe only when Row Level Security is enabled with correct policies on every table in an exposed schema, because anyone can use that key to call your database API.
What happens if RLS is off on a table?
Anyone who has your project URL and anon key, both visible in your site's JavaScript, can read and often change every row in that table through Supabase's REST API.
I enabled RLS and now my app shows no data. Why?
With RLS on and no policies, Supabase denies all access through the API. Add policies that allow exactly the access each user needs, such as reading only rows where user_id matches auth.uid().
Should I ever put the service_role key in my frontend?
Never. The service_role key bypasses RLS entirely. Keep it on the server only, and rotate it right away if it was ever shipped to a browser or committed to a repo.
Can users change their own plan or admin flag in Supabase?
Yes, if RLS lets them update their own profile row and that row holds the plan or role column. RLS policies limit which rows a user can change, not which columns. Revoke update on the table from the authenticated role, grant update only on the columns users should edit, and change plan or role only from the server.
Why does my new Supabase table return 42501 permission denied?
From October 30, 2026, Supabase no longer grants new tables in the public schema to the anon, authenticated and service_role roles automatically, so the Data API rejects requests until you add an explicit grant. Fix it with a grant for only the operations each role needs, plus enable row level security and policies in the same migration. Do not turn RLS off to make the error go away.
Did Supabase's Oct 30, 2026 change lock down my existing tables?
No. The change only affects new tables created in the public schema after it reaches your project; tables you already had keep their current grants and stay reachable through supabase-js, REST and GraphQL. So an older table with RLS off is still readable with your public anon key. Run the Step 1 query to find those tables, then enable RLS and add policies, or revoke the grants on any table the browser never needs. Tables in the storage, auth, realtime and custom schemas, and apps that only use a direct Postgres connection, are not affected. Source: Supabase changelog.
Are files in a public Supabase Storage bucket protected by RLS?
No. Supabase says a public bucket bypasses access controls for retrieving and serving files, so anyone with a file's URL can download it. Use public buckets only for files meant to be public, like avatars or blog images. Put IDs, invoices and other private uploads in a private bucket with RLS policies on storage.objects, and share them through short-lived signed URLs. (Source: Supabase Storage buckets.)
How common is open Supabase data in Lovable apps?
Common enough to check yours. A 2026 study by Crissy Field GmbH looked at 34,545 Lovable projects that use Supabase, found in Common Crawl data from December 2025 to September 2026. Of the 24,664 sites that sent database records on page load, 7,403 (30%) had tables with email addresses that the researchers could read with further read-only requests using the public key. The authors note this is not a confirmed leak rate, since some emails may be public or test data and the sample is not representative. Earlier, CVE-2025-48757 found 170 of 1,645 Lovable showcase apps with missing or weak RLS. (Sources: Crissy Field research report, statement on CVE-2025-48757.)
I turned RLS on. Why can strangers still read every row?
Because RLS being on is not enough if a policy still says yes for everyone. A common leftover in vibe-coded apps is using (true) (sometimes as for all, or named for a "service" role but missing a to service_role clause). Postgres combines permissive policies with OR, so one open policy next to a tight owner-only policy still exposes every row. Drop the open policy, keep policies scoped with auth.uid(), always name the role with to, and re-run the two-account test. Source: Supabase Row Level Security docs.
What's the difference between USING and WITH CHECK in an RLS policy?
USING filters which existing rows a SELECT, UPDATE, or DELETE can see or target (like an automatic WHERE). WITH CHECK validates the new row on INSERT, and the resulting row on UPDATE, so a user cannot insert a row for someone else or reassign ownership. SELECT and DELETE use USING only; INSERT uses WITH CHECK only; UPDATE should use both. If an UPDATE policy has no WITH CHECK, Postgres falls back to the USING expression for both. A common vibe-coded bug is an UPDATE policy with only USING (auth.uid() = user_id) and no WITH CHECK: that still blocks reading someone else's row to edit when USING is tight, but skipping WITH CHECK (or pairing a loose USING with a missing check) can let ownership be stolen. Set both on every update policy so user_id cannot be reassigned:
create policy "Users can update their own profile."
on profiles for update
to authenticated
using ( (select auth.uid()) = user_id ) -- existing row
with check ( (select auth.uid()) = user_id ); -- resulting row
Source: Supabase Row Level Security docs.
LaunchSafeAI checks your live app for open tables, leaked keys and broken auth, shows you the exact request that proves each issue, and re-tests after the fix. Start with a free scan.