ShipBastion / Security guides / Supabase RLS security audit: find tables anyone can 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.
- Search your built assets for "service_role" and for JWTs whose payload has role service_role.
- Check storage buckets: public buckets serve every file to anyone with the URL.
- 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
Security checklist for apps built with Cursor, Lovable, Bolt and v0
A pre-launch security checklist for AI-built apps: leaked keys in bundles, Supabase RLS, exposed .env and source maps, security headers, TLS...
Check your JavaScript bundles for leaked API keys
How API keys end up in frontend bundles, which keys are safe to be public and which are not, how to grep your built JS and source maps, and ...
ShipBastion vs Vibe App Scanner
Honest ShipBastion vs Vibe App Scanner comparison: $19/mo vs $29/mo, 221 vs 150+ secret rules, all 12 Mozilla Observatory tests, TLS 1.0/1.1...