Static Postgres & Supabase Security Instrument

Audit Supabase RLS migrations before a leaky policy hits production.

Paste any .sql migration or drop files below. Runs deterministically in your browser tab (connect-src 'none') across 8 security rules with exact line numbers and copy-paste SQL fixes.

1. Migration SQL Input

No signup, no database connection, no network requests.

Sample Mode
20260301_billing_invoices.sql 0 lines
Load fixture:

2. Audit Verdict & SQL Fixes

Deterministic static checks across tables, policies, RPCs, and secrets.

-- --
Critical0
High0
Medium0
RLS Tables0/0
Static Scanner Scope & Limitations:

    Self-Enforcing Pull Request Guardrail

    Add to GitHub Actions CI in 30 seconds

    Block unguarded tables and SECURITY DEFINER bugs automatically on every pull request.

    .github/workflows/supabase-rls-guard.yml

    Zero dependencies · writes full report to GitHub Job Summary

    name: Supabase RLS Guard
    on:
      pull_request:
        paths:
          - 'supabase/migrations/**'
          - 'src/**'
    
    jobs:
      rls-audit:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: PabloIan92/supabase-rls-auditor@v1
            with:
              path: '.'
              fail-on: 'critical'

    Also available as CLI & MCP Tool

    Run locally in terminal or directly from Cursor, Claude Desktop, and Windsurf agents.

    git clone https://github.com/PabloIan92/supabase-rls-auditor
    python3 -m auditor.cli ./supabase --format md --fail-on critical

    Need automated agentic audits via MCP? Call the hosted Pay-Per-Event Apify Actor ($0.05/audit).

    Open Apify MCP Actor →

    Transparent Pricing · No Hidden Upsells

    Free in browser. Upgrade only if you want turnkey CI packs or agent APIs.

    Every core check in this scanner is free and open-source. Paid tiers save setup time for shipping teams.

    Open Source

    Browser Scanner & CLI

    $0 / forever

    • 8 static RLS, RPC, storage & secret rules
    • 100% client-side privacy (zero uploads)
    • Composite GitHub Action & Markdown/JSON export
    View GitHub Repository
    Pay-Per-Event MCP · Apify

    Automated MCP Actor

    $0.05 / audit

    • Hosted MCP endpoint for Cursor, Claude & Windsurf
    • Structured JSON findings + remediation patches via API
    • No subscription — pay only per run on Apify Store
    Run MCP Actor on Apify →

    Field Reference

    3 Supabase RLS traps that quietly expose production data

    1. Public tables without ENABLE RLS

    Every table created in public is exposed over PostgREST automatically. Without ALTER TABLE ... ENABLE ROW LEVEL SECURITY, anyone with your public anon key can read or mutate every row.

    ALTER TABLE public.invoices
      ENABLE ROW LEVEL SECURITY;

    2. Permissive USING (true) & missing TO role

    Policies written during prototyping with USING (true) or without TO authenticated default to Postgres PUBLIC—meaning unauthenticated anon requests match them too.

    CREATE POLICY "owner_only" ON public.invoices
      FOR SELECT TO authenticated
      USING (user_id = auth.uid());

    3. SECURITY DEFINER search_path hijacking

    Postgres functions declared SECURITY DEFINER run with owner privileges. Always pin SET search_path = public, pg_temp and verify auth.uid() inside the body.

    CREATE FUNCTION public.pay_inv(id uuid)
    RETURNS void LANGUAGE plpgsql
    SECURITY DEFINER
    SET search_path = public, pg_temp AS $$ ...