Skip to main content
Glama

Airlock RLS MCP — Supabase leak checks inside your AI coding agent

Let Cursor, Claude Code, or any MCP client check a Supabase app for leaks while it builds it. It catches the most common vibe-coding footgun: a service_role key shipped to the browser, and Row Level Security that's off or wide open.

The engine is Airlock RLS (npm i airlock-rls), the CI gate for Supabase RLS. This package is a thin MCP wrapper around it.

Ten tools

Local (no account needed)

scan_site_for_exposed_key — give it a deployed URL. It reads the page, its JS bundles and source maps for an exposed Supabase service_role key (a service_role JWT or an sb_secret_... key), and checks whether /.env is downloadable, /.git/ is served or source maps are public. No database, no credentials, just the public URL. A key hit means anyone who reads it bypasses every RLS policy. It never prints a key or an .env value.

audit_supabase_rls — give it a Postgres connection string. It reads only catalog metadata, never your row data, so a read-only role is enough. Returns a human-readable summary. What it checks:

  • tables with RLS off, and policies that are always true (USING (true), auth.uid() = x OR 1=1);

  • policies that don't tie rows to the caller, for reads, inserts, updates and deletes (tenant leaks);

  • policies that trust user_metadata, which every user can edit for themselves;

  • Storage: public buckets and the policies on storage.objects;

  • SECURITY DEFINER functions anon can call, or with no pinned search_path;

  • views that run as their owner and skip RLS, and exposed materialized views;

  • Realtime publications that stream anon-readable rows;

  • default privileges that hand every future table to the API roles (the post-Oct-30 "lazy fix");

  • roles with BYPASSRLS, and tables owned by a client role without FORCE ROW LEVEL SECURITY.

Auth settings and Edge Functions code aren't in the database catalog, so they're out of scope.

get_findings — same audit as audit_supabase_rls, but returns machine-readable structured JSON: findings grouped by severity, severity counts, table count, allowed (waived) findings, and stats. Built for agents that need to iterate over findings, generate fixes, or build reports programmatically.

explain_finding — pure lookup, no database needed. Give it a finding kind string (e.g. rls_disabled, permissive_true, cross_tenant_read_leak) and it returns: what it means, why it's dangerous, how to fix it with example SQL, and related finding kinds. Use after get_findings or audit_supabase_rls to understand a finding before fixing it.

generate_fix — pure function, no database needed. Give it a finding kind, a table_name, and optionally a policy_name, and it returns the exact SQL to fix that specific finding, ready to paste into a migration file.

Hosted Monitor (needs an API key)

These tools talk to the Airlock Monitor REST API. Get an API key from the Monitor dashboard.

list_monitor_projects — list the Supabase projects connected to your Monitor account.

start_monitor_run — start an RLS audit + DAST run on a connected project. Returns a run id to poll.

get_monitor_run — check the status of a run (queued → running → completed/failed).

get_monitor_findings — get the findings (leaks, warnings, suggested SQL fixes) from a completed run.

get_monitor_attestation — download the signed attestation (Ed25519 + SHA-256) for a completed run. Anyone can verify it at shipsealed.com/verify without an account.

Related MCP server: schema-guard-mcp

Add it to your MCP client

{
  "mcpServers": {
    "airlock": {
      "command": "npx",
      "args": ["-y", "airlock-rls-mcp"]
    }
  }
}

That's the same block for Cursor (~/.cursor/mcp.json), Claude Desktop (claude_desktop_config.json) and other MCP clients. With Claude Code:

claude mcp add airlock -- npx -y airlock-rls-mcp

Then ask the agent things like "scan https://myapp.com for an exposed Supabase key", "audit the RLS on this database", "explain the rls_disabled finding", "generate the fix for permissive_true on my profiles table", or "run a Monitor check on my project and show the findings" and it calls the tools.

Requirements

Node.js 18 or newer.

Develop

npm install
npm run smoke   # starts the server and checks all tools are advertised

More

Guides on Supabase RLS, a live cross-tenant demo, and the hosted Airlock Monitor (continuous checks of your live database): shipsealed.com

License

MIT © Mateus Zingano

Available Tools

10 tools
audit_supabase_rlsA

Audit a Supabase/Postgres database's access control and return a human-readable report (use get_findings for JSON). Covers: tables with RLS off; permissive policies (USING (true) or anything that reduces to always-true); anon/authenticated policies that do not scope rows to the caller (tenant leaks) for SELECT, INSERT, UPDATE and DELETE; policies that trust user-editable user_metadata; Storage (public buckets and storage.objects policies, reported as storage_); SECURITY DEFINER functions (callable by anon, search_path not pinned, reading user_metadata); views that run as their owner and skip RLS; exposed materialized views; Realtime publications streaming anon-readable rows; default privileges that grant future tables to the API roles; roles with BYPASSRLS; and tables owned by a client role without FORCE RLS. Reads ONLY catalog metadata, never row data, so a read-only role is enough; a check the role cannot read is reported as check_skipped. Not covered: Auth settings and Edge Functions code, which are not in the database catalog.

Inputs: db_url (required), allow, schema.

explain_findingA

Explain what an Airlock finding kind means, why it is dangerous, how to fix it (with example SQL), and which other findings are related. Pure lookup — no database connection needed. Use this after get_findings or audit_supabase_rls to understand a specific finding before fixing it. Supported kinds: rls_disabled, permissive_true, anon_unscoped, authenticated_unscoped, write_unchecked, write_unscoped, update_using_unscoped, delete_unscoped, or_branch_unscoped, helper_scoped, policy_trusts_user_metadata, security_definer, anon_executes_definer, definer_search_path_mutable, view_bypasses_rls, matview_exposed, public_bucket, realtime_exposure, default_privileges_to_api_roles, bypassrls_role, owner_bypasses_rls, cross_tenant_read_leak, cross_tenant_write_leak, cross_tenant_delete_leak, service_role_exposed, env_file_exposed, git_exposed, source_map_exposed, scan_truncated, plus any storage_ variant.

Inputs: finding_kind (required).

generate_fixA

Generate the exact SQL to fix a specific Airlock finding. Pure function — no database connection needed. Returns a ready-to-run SQL statement tailored to the table and policy names you provide. Use after get_findings or audit_supabase_rls to get a fix you can paste into a migration file.

Inputs: table_name (required), finding_kind (required), schema, policy_name.

get_findingsA

Audit a Supabase/Postgres database's Row Level Security and return machine-readable structured JSON. Unlike audit_supabase_rls (which returns a human-readable summary), this tool returns findings grouped by severity with counts, suitable for programmatic consumption by an agent that needs to iterate over findings, generate fixes, or build a report. Same engine, same checks (tables, policies, Storage, SECURITY DEFINER functions, views, Realtime, default privileges, roles), different output shape. Each finding has kind, severity (fail/warn), object and detail; pass kind to explain_finding or generate_fix.

Inputs: db_url (required), allow, schema.

get_monitor_attestationA

Download the signed attestation (Ed25519) for a completed run. Returns the canonical JSON report, its SHA-256 hash, and the signature. Anyone can verify it at shipsealed.com/verify without an account.

Inputs: run_id (required), api_key (required), base_url.

get_monitor_findingsA

Get the findings (leaks, warnings) from a completed Airlock Monitor run. Each finding has kind, severity, object, detail and a suggested SQL fix.

Inputs: run_id (required), api_key (required), base_url.

get_monitor_runB

Get the status and summary of an Airlock Monitor run. Status is one of: queued, running, completed, failed.

Inputs: run_id (required), api_key (required), base_url.

list_monitor_projectsB

List the Supabase projects connected to your Airlock Monitor account. Returns project id, label, and last-run timestamp for each.

Inputs: api_key (required), base_url.

scan_site_for_exposed_keyA

Scan a DEPLOYED website's HTML, JavaScript bundles and source maps for an exposed Supabase service_role key (a service_role JWT or an sb_secret_... key), and check whether /.env is downloadable (fail), /.git/ is served (fail) or source maps are public (warn). Needs only the public URL: no database, no credentials. A found service key bypasses ALL Row Level Security, giving anyone full read/write to the database. Also reports whether the public anon/publishable key is present, which means RLS is the only lock (follow up with audit_supabase_rls). Use right after deploying a Supabase app. Never prints a key or an .env value. Does not touch the database; for that, use audit_supabase_rls.

Inputs: site_url (required), max_scripts.

start_monitor_runA

Start an Airlock Monitor run (RLS audit + DAST) on a connected project. Returns the run id and initial status. Poll with get_monitor_run.

Inputs: api_key (required), project_id (required), base_url.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes, and the descriptions actively cross-reference each other (audit_supabase_rls vs get_findings vs get_monitor_findings), which helps an agent pick correctly. The remaining risk is real though: get_findings (direct DB audit) and get_monitor_findings (results of an async Monitor run) are near-homonyms, and audit_supabase_rls vs get_findings are the same engine with only an output-shape difference.

    Naming Consistency4/5

    Consistent snake_case verb_noun pattern throughout (get_/list_/start_/scan_/audit_/explain_/generate_), with a clear 'monitor' namespace for the async-run lifecycle tools. Minor deviation: get_findings is unnamespaced and does not signal that it is the JSON form of audit_supabase_rls, which breaks the otherwise clean pattern.

    Tool Count5/5

    Ten tools is well within the sweet spot and every one earns its place: an audit/findings/explain/fix pipeline, a monitor-run lifecycle, and a standalone deployed-site scan. Nothing looks redundant or bolted on.

    Completeness4/5

    Coverage is strong across the domain: static audit, structured findings, explanation, SQL fix generation, an async monitoring lifecycle with signed attestation, and a no-credential site scan. Minor gaps: no cancel/abort for a running monitor run, no run-history or comparison tool beyond a last-run timestamp, and no tooling for the explicitly-excluded Auth settings and Edge Functions.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      F
      maintenance
      Predeploy security scanner for AI-generated code. 80+ vulnerability patterns across secrets, auth, injection, config, Supabase, and logging. Runs locally, code never leaves your machine. Optional x402 witnessed attestation.
      96 npm
      Apache 2.0
    • A
      license
      A
      quality
      D
      maintenance
      Audits PostgreSQL/Supabase schemas for security issues like missing RLS, permissive policies, and sensitive data exposure during AI conversations.
      3
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI coding assistants to scan projects for security issues such as leaked API keys, missing Supabase RLS, open Firebase rules, unauthenticated routes, and hallucinated packages, then fix and verify the results.
      8
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI coding assistants to check whether an API key is safe to expose, audit Supabase Row Level Security, generate owner-based RLS policy templates, and run a builder-specific pre-launch security checklist. Runs locally over stdio with no network calls, telemetry, or file access.
      5
      MIT