Supabase RLS is off. Anyone can read that table.
Updated 2026-10-13 · Plain English, written for founders who built with Lovable, Bolt, Cursor or similar.
Supabase gives every app two things that end up in the browser: your project URL and the anon key. That is fine and expected. The only thing standing between that key and your data is row level security (RLS). If RLS is off on a table, or its policy says USING (true), anyone who opens your site can read the whole table with one request. No login, no hacking skill.
This is the most common serious problem in apps built with Lovable, Bolt and Cursor. In 2025 a researcher found more than 170 Lovable-built apps leaking user data exactly this way (CVE-2025-48757).
Check from the outside
This is what a stranger does. Open your live app, open DevTools, and search the loaded JavaScript for supabase.co. Next to it you will find your project URL and a long key starting eyJ (or sb_publishable_ on newer projects). Then ask for a table:
curl "https://YOUR-PROJECT.supabase.co/rest/v1/profiles?select=*&limit=5" \ -H "apikey: YOUR_ANON_KEY"
[]: no rows came back to an anonymous visitor. Good (or the table is empty).- Rows of real data: anyone on the internet can read this table. Treat it as a leak.
- An error saying the relation does not exist: wrong table name; try the names your app uses.
Only do this against your own project.
Check from the dashboard
In the Supabase SQL editor, list every public table and whether RLS is on:
select tablename, rowsecurity from pg_tables where schemaname = 'public' order by rowsecurity, tablename;
Any row with rowsecurity = false is readable and writable by the anon key, unless you have revoked its grants. Then look for policies that let everyone through even though RLS is on:
select tablename, policyname, cmd, roles, qual, with_check from pg_policies where schemaname = 'public' and (qual = 'true' or with_check = 'true');
A qual of true on a SELECT policy means every row is visible to every role listed. That is right for a public blog posts table. It is wrong for profiles, orders, messages or anything with an email address in it.
Fix it
Turn RLS on, then add a policy that ties each row to its owner. This example assumes a user_id column that holds the Supabase auth user id:
alter table public.profiles enable row level security; create policy "Users read their own profile" on public.profiles for select to authenticated using ((select auth.uid()) = user_id); create policy "Users create their own profile" on public.profiles for insert to authenticated with check ((select auth.uid()) = user_id); create policy "Users update their own profile" on public.profiles for update to authenticated using ((select auth.uid()) = user_id) with check ((select auth.uid()) = user_id); -- Replace any old catch-all policy: drop policy if exists "Enable read access for all users" on public.profiles;
- Turning RLS on with no policies blocks everything for the anon and logged-in roles. Your app may break until the policies exist. That is the safe way round: broken beats leaking.
- Write
WITH CHECKon inserts and updates. Without it a user can write a row with someone else'suser_id, or change their ownrolecolumn toadmin. - Views skip RLS by default. A view over a protected table runs as its owner. On Postgres 15 and later, create views with
with (security_invoker = true)so the caller's policies apply. - Wrapping
auth.uid()in(select ...)lets Postgres evaluate it once per query instead of once per row. Same result, much faster on big tables.
After the fix
- Re-run the curl from above. It should now return
[]for the anon key. - Log in as one test user and try to read a second test user's row. "RLS is on" and "users cannot read each other's data" are different claims, and only the second one matters.
- If the table held personal data while it was open, read what to do if data leaked. You usually cannot tell who read it, so plan as if someone did.
Check your app
SecureIndie looks for this mistake. The free quick check covers the basics from outside (exposed files, keys in your site's code, headers) in about a minute. Database rules, payment webhooks and AI endpoints need the full audit, which also reads your code and proves what a visitor can actually reach.
Questions
Is the Supabase anon key a secret?
No. It ships in every browser bundle by design. It is only safe because row level security decides what that key can read. With RLS off, the anon key reads everything.
I turned RLS on. Am I safe?
Not necessarily. A policy written as USING (true) lets every visitor read every row, with RLS technically enabled. Check what the anon key can actually read, not just the switch.
Does the Supabase security advisor catch this?
It flags tables with RLS disabled, which is a good start. It does not tell you whether a policy that is switched on still lets one user read another user's rows.
Related guides
- Your Supabase service_role key is in the browser.
- Your AI API key is in your frontend. Anyone can spend your money.
Checks covered: SUPA-RLS-001, SUPA-RLS-002, SUPA-WRITE-004 · If you think data already leaked