ShipBastion AI Watch — $19/mo

ShipBastion / Security guides / Supabase RLS security audit: find tables anyone can read

Guide · VibeShield · Updated 2026-11-30 · 7 min read

Supabase RLS security audit: find tables anyone can read

Your Supabase anon key ships in every frontend bundle by design. That is safe only if Row Level Security is enabled on every table in an exposed schema. This guide shows how to check, fix and verify it.

Free scan. Sign in with Google to see the full report; paid plans start with a 7-day free trial.

1. List tables without RLS

Run this in the SQL editor. Any row returned is a table the anon key may read or write through the REST API.

select schemaname, tablename
from pg_tables
where schemaname = 'public' and rowsecurity = false;

2. Enable RLS and add an owner policy

Enabling RLS with no policy denies everything to anon and authenticated roles. Then grant exactly what each role needs.

alter table public.profiles enable row level security;

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

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

3. Test what the public key can read

Use the anon key from your own bundle. An empty array or a 401 is what you want; real rows mean the table is public.

curl 'https://<project-ref>.supabase.co/rest/v1/profiles?select=*&limit=1' \
  -H "apikey: <anon-key>" \
  -H "Authorization: Bearer <anon-key>"

4. Never ship the service_role key

The service_role key bypasses RLS entirely. If it appears in a JS bundle, rotate it in Project Settings immediately and move the calls to a server or Edge Function.

  1. Search your built assets for "service_role" and for JWTs whose payload has role service_role.
  2. Check storage buckets: public buckets serve every file to anyone with the URL.
  3. Re-run the anon test after every migration.

Try it on your own domain

Free scan, no card. Pro is $19/mo after a 7-day free trial and covers all four scanners: VibeShield, CiteReady, InboxShield and BrandShield.

FAQ

Is the Supabase anon key a secret?

No. It is meant to be public; RLS policies are what protect your data.

Can ShipBastion test my Supabase project?

Yes. VibeShield detects the Supabase URL and anon key in your bundles and tests anonymous reads on up to 20 tables.

Related