Skip to main content
Glama
README.md
# 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](https://github.com/mateuszingano/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](https://shipsealed.com) 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.

## Add it to your MCP client

```json
{
  "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:

```bash
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

```bash
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](https://shipsealed.com/?utm_source=readme&utm_medium=referral&utm_campaign=airlock-rls-mcp)

## License

MIT © Mateus Zingano

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