PatchPaste · Guides

Last updated 13 November 2026

Supabase RLS check: is your table readable by anyone?

If your app was built with Lovable, Bolt, Cursor or v0 on Supabase, your public anon key is already in your JavaScript. That is normal. The only thing stopping a stranger reading your users or orders table with that key is Row Level Security (RLS). Here is how to check it in about five minutes.

Short answer: run the SQL in step 1, make sure every table in public shows rowsecurity = true, remove any USING (true) policy for anon, then test logged out (step 3). Or scan your live app free and we'll test it from the outside.

1. Find tables with RLS turned off

Open the SQL editor in your Supabase dashboard and run:

select tablename, rowsecurity
from pg_tables
where schemaname = 'public'
order by rowsecurity, tablename;

Every row with rowsecurity = false is a table the anon key can read, if your API exposes the public schema (it does by default). The dashboard's Security Advisor flags the same thing as “RLS disabled in public”.

2. Look for policies that let everyone in

RLS being on is not enough if a policy waves everyone through. AI tools often “fix” a permission error by adding one.

select tablename, policyname, roles, cmd, qual, with_check
from pg_policies
where schemaname = 'public';

Red flags: qual = true (that's USING (true)) on a policy for {anon} or {public}, and any INSERT/UPDATE policy with with_check = true for anon. That is fine for genuinely public data (a list of blog posts), not for profiles, orders, messages or anything with an email in it.

3. Test it logged out, like a stranger would

Copy your project URL and anon key (Settings → API, or from your site's JavaScript) and run, for each table:

curl "https://YOUR-REF.supabase.co/rest/v1/profiles?select=*&limit=1" \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_ANON_KEY"

Then sign in as a test user and try to read or edit another user's row. RLS that only checks “is logged in” still leaks everyone's data to every signed-up user.

4. Fix it

Turn RLS on and add a policy tied to the signed-in user. Replace profiles and user_id with your table and column:

alter table public.profiles enable row level security;

create policy "Users read own profile"
  on public.profiles for select
  to authenticated
  using ((select auth.uid()) = user_id);

create policy "Users update own profile"
  on public.profiles for update
  to authenticated
  using ((select auth.uid()) = user_id)
  with check ((select auth.uid()) = user_id);

Working in Lovable or Cursor? Paste this prompt instead:

Enable Row Level Security on every table in the public schema. For each table that holds user data, add SELECT/INSERT/UPDATE/DELETE policies so users can only access rows where user_id = auth.uid(). Remove any policy that uses USING (true) for the anon or public role unless that table is meant to be public. Do not disable RLS to fix errors; add the correct policy instead. List every policy you created.

5. Don't forget the side doors

6. Re-check after every deploy

RLS gets switched off in a hurry, usually by an AI fixing a “new row violates row-level security policy” error. A table that was safe last week can be open today. PatchPaste scans are free, so you can scan again after each deploy.

Supabase RLS FAQ

Is it safe that my Supabase anon key is in my frontend?

Yes, on its own. The anon (or sb_publishable_) key is meant to be public. It only becomes a problem when a table in an exposed schema has Row Level Security turned off, or has a policy like USING (true) for the anon role. Then that public key can read the table.

How do I check if RLS is enabled on all my Supabase tables?

Run this in the Supabase SQL editor: select tablename, rowsecurity from pg_tables where schemaname = 'public'; Any row where rowsecurity is false is a table without RLS. The Security Advisor in the dashboard also flags 'RLS disabled in public'.

RLS is on but I have no policies. Is that safe?

Yes for reads by strangers: with RLS on and no policy, the anon and authenticated roles get no rows back. Your app may break until you add policies, which is why people (and AI tools) are tempted to switch RLS off. Add a policy instead.

What does a policy with USING (true) do?

It lets every row through for the roles it applies to. On a SELECT policy for anon or public, it makes the table readable by anyone with your public key, which is the same as having no RLS at all for that table.

What about the service_role or sb_secret_ key?

That key bypasses RLS completely. It must never appear in browser code. If it has shipped in your JavaScript, treat it as leaked: rotate it in the Supabase dashboard and move it to server-only environment variables.

Can an outside scan check my RLS without my password?

Partly. PatchPaste finds your Supabase URL and public key in your live site, then makes read-only requests for at most one row from common table names. That catches the classic open-table mistake. It cannot see pages behind a login, so also run the SQL check above.

If Security Advisor already flags a table, start with RLS Disabled in Public.

Check your live app free

Paste your URL. We find your Supabase key, test common tables read-only (at most one row, never stored), and check for leaked secret keys, exposed files and missing headers. Free report; £9 one-off if you want the paste-in fixes.

Free. No login. No code access.

Want to see one first? View a sample report.