Supabase RLS Audit: Find Exposed Tables & Leaky Policies

    1

    Every Supabase app ships its `anon` key inside the client, and that key can call `/rest/v1/ ` directly.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    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 in public, security definer functions without search_path or 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 (local supabase-demo keys reported as info)

    How it works

    1. 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.
    2. The agent hunts logic bugs no linter can judge: wrong ownership column, users able to change user_id or role, self-join membership tables, OR-ed permissive policies.
    3. A fresh pass tries to disprove each lead, with read-only queries for the live database (dashboard edits never reach the repo).
    4. REPORT.md with 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

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.

    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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    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 to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 19 days ago

    • Free with an Agensi account

    Software
    Node.js 18+

    Node.js runs the bundled analyzer; no npm install needed.

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Listed19 days ago

    What's inside

    Frequently Asked Questions

    The skill scans your local `supabase/` directory, analyzing your SQL migrations, schema files, and client-side code to build a complete map of your database's security state. It then identifies logic flaws in your policies and generates ready-to-run SQL snippets to patch identified leaks.

    The skill is compatible with any AI agent or LLM that has filesystem access to your repository. It is designed to work seamlessly within environments like VS Code (via Copilot or Cursor), Windsurf, or any terminal-based AI agent that can read SQL and Markdown files.

    No, this skill operates locally by analyzing your migration files and schema dumps. It does not require your Supabase project URL or service keys, ensuring your production database remains untouched and your sensitive credentials stay private.

    Unlike a simple prompt, this skill uses a multi-phase protocol that tracks the cumulative state of your database across multiple migrations. It understands complex PostgreSQL nuances like `security definer` functions and `search_path` vulnerabilities that generic LLM prompts often overlook.

    You receive the core auditing logic, a set of specialized security scanning protocols, and a template for the `REPORT.md` output. It also includes a guide on how to generate the necessary schema dumps if your project doesn't use standard Supabase migrations.

    The skill can only audit what is present in your code repository. If you have made manual 'hotfixes' via the Supabase Dashboard UI that aren't reflected in your migration files, the skill will not see them unless you provide a fresh `schema.sql` dump.

    New in Data & Databases

    Free