Fix guides

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"

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;

After the fix

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

Checks covered: SUPA-RLS-001, SUPA-RLS-002, SUPA-WRITE-004 · If you think data already leaked