- Home
- Skills
- Data & Databases
- Supabase RLS Audit: Find Exposed Tables & Leaky Policies
Supabase RLS Audit: Find Exposed Tables & Leaky Policies
Every Supabase app ships its `anon` key inside the client, and that key can call `/rest/v1/ ` directly.
Free
Works with the AI Agents you already use
Supabase RLS Audit: Find Exposed Tables & Leaky Policies
Example session with this skill installed
audit the RLS policies in this supabase project
- Read your context and instructions
- Compiled the supabase rls audit
Summary
Real output from the bundled analyzer on the intentionally vulnerable test project in the repo (tests/fixtures/vuln_app: two migrations, a Flutter client and a web env file). The agent then confirms each lead, checks the live database with read-only queries, and writes a fix migration per finding.
Analyzer leads (excerpt)
supabase-rls-audit · vuln_app · 2 SQL files · 8 tables (6 with RLS) · 7 policies · 2 views · 1 security definer functions
CRITICAL RLS-KEY-002 service role referenced in Flutter app code
lib/supabase.dart:5
CRITICAL RLS-TBL-001 public.orders never gets "enable row level security" in any migration
supabase/migrations/20240101000000_init.sql:12
CRITICAL RLS-POL-006 "Anyone can send" on public.messages (for insert to anon) lets anonymous callers write
supabase/migrations/20240101000000_init.sql:21
CRITICAL RLS-TBL-002 RLS on public.invoices is turned off
supabase/migrations/20240201000000_debug.sql:2
CRITICAL RLS-KEY-002 NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY is a client-exposed variable
web/.env.example:2
HIGH RLS-POL-001 "Profiles are public" on public.profiles (for select to public) is readable by anyone with the anon key (columns include phone)
supabase/migrations/20240101000000_init.sql:9
HIGH RLS-POL-002 "Signed in users manage documents" on public.documents (for all to authenticated): signed-in only on a write policy
supabase/migrations/20240101000000_init.sql:25
HIGH RLS-POL-004 "Admins read projects" on public.projects (for select to public) reads user_metadata
supabase/migrations/20240101000000_init.sql:37
HIGH RLS-VIEW-001 public.order_summary has no security_invoker = true
supabase/migrations/20240101000000_init.sql:44
MEDIUM RLS-POL-003 "Read notes" on public.notes (for select to authenticated) lets every signed-in user read every row
supabase/migrations/20240101000000_init.sql:30
MEDIUM RLS-VIEW-002 public.daily_stats is a materialized view in an exposed schema
supabase/migrations/20240101000000_init.sql:47
MEDIUM RLS-FN-001 public.get_all_emails is security definer without set search_path
supabase/migrations/20240101000000_init.sql:50
MEDIUM RLS-FN-002 public.get_all_emails is security definer, callable via /rpc, and never checks auth.uid()
What happens next
Leads are hints, not findings. For example, public.orders has no RLS: the agent confirms it in pg_class, shows the request an attacker makes with the anon key (supabase.from('orders').select('*')), and writes alter table public.orders enable row level security; plus ownership policies using (select auth.uid()) = user_id in a new migration. using (true) on products would be rejected as an intentional public catalogue.
Connects securely to your tools. The creator never sees your data.
About this skill
Every Supabase app ships its anon key inside the client, and that key can call /rest/v1/<any table> directly. Row Level Security is the only thing between it and your data, and it fails in the same few ways: a table created without enable row level security (or disabled "temporarily"), using (true) on a table with phone numbers, write policies that only check "is signed in", admin checks that read user-editable user_metadata, views and security definer functions that bypass every policy, or the service_role key in a Flutter app or a NEXT_PUBLIC_ variable.
What it checks
- Tables: RLS missing or disabled by a later migration, RLS with no policies
- Policies:
using (true)(severity raised when the table has personal columns), sign-in-only checks, anonymous writes,user_metadata,(select auth.uid())performance - Views & functions: views without
security_invoker, materialized views inpublic, security definer functions withoutsearch_pathor caller checks - Storage: public buckets, write policies without owner/folder checks
- Keys: service_role JWTs and
sb_secret_keys in the repo, service role exposed to clients (localsupabase-demokeys reported as info)
How it works
- A zero-dependency analyzer (Node 18+, 18 rules) replays your migrations in order and reports the final state: a policy dropped later is gone, a view fixed with
alter view … set (security_invoker = true)is fixed. Handles pg_dump-style SQL, dollar-quoted bodies and monorepos with several Supabase projects. JSON and SARIF output. - The agent hunts logic bugs no linter can judge: wrong ownership column, users able to change
user_idorrole, self-join membership tables, OR-ed permissive policies. - A fresh pass tries to disprove each lead, with read-only queries for the live database (dashboard edits never reach the repo).
REPORT.mdwith the attacker's request and a fix migration for every finding, plus an RLS coverage table.
The scripts only read your project files. No network calls, no database connection, no shell commands.
Open source
Created and maintained by the author. MIT-licensed source, GitHub Action and issue tracker: https://github.com/MBotirjonDev/supabase-rls-audit
Requires local migration files or a schema dump for analysis. Cannot detect configuration changes made exclusively in the Supabase Dashboard without a corresponding repository update.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 19 days ago
- Free with an Agensi account
Requires