Find the leaks in your Lovable, Bolt, v0, Cursor & Claude Code Supabase app before someone else dumps your database.
Supalock is a local-first, open-source security scanner + multi-agent skill bundle with 128 curated vulnerability patterns (76 automated static checks + 52 deep agent-guided reviews), 8 Open Agent Skills, and 4 slash commands — built to catch real Supabase RLS, Storage, Auth, Edge Function, and client-secret leaks in milliseconds. Zero subscriptions. Zero external dependencies. No telemetry.
AI coding tools ship working Supabase apps in 20 minutes — and routinely leave behind the exact same devastating leaks:
- Tables created in
publicwithRLS disabled (onecurlwith your browseranonkey dumps every customer row) - Policies that check
auth.role() = 'authenticated'instead of(SELECT auth.uid()) = user_id(any signed-up user reads everyone else's data) - Admin policies trusting
auth.jwt() -> 'user_metadata'(any user can callsupabase.auth.updateUser({ data: { role: 'admin' } })) - Postgres views missing
WITH (security_invoker = true)thatsilently bypass RLS NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEYbundled straight into the browser- Next.js
middleware.tstrusting cookie-sourcedgetSession()instead of verifiedgetUser() - Unauthenticated Deno Edge Functions proxying your OpenAI/Anthropic key or skipping Stripe webhook signature checks
- Client components calling
.from('profiles').update({ is_pro: true, credits: 99999 })
Paid scanners check your production URL after you've already leaked data. Supalock catches these locally in your repo, in your AI coding agent, and in GitHub Actions PR checks before code ever ships.
git clone https://github.com/Hermes-Lekkas/supalock.git
cd supalock
python3 -m supalock scan examples/vulnerable-vibe-saas
python3 -m supalock scan examples/hardened-vibe-saas
python3 -m supalock scan /path/to/your-app
Or install the supalock CLI globally via pip / pipx / uv:
pip install git+https://github.com/Hermes-Lekkas/supalock.git
supalock scan .
Supalock follows the Open Agent Skills standard and ships with a multi-agent installer supporting Claude Code, Cursor, Codex, Antigravity, Gemini CLI, GitHub Copilot, Cline, and Windsurf:
npx skills add Hermes-Lekkas/supalock
curl -fsSL https://raw.githubusercontent.com/Hermes-Lekkas/supalock/main/install.sh | bash
./install.sh --global --agent all
./install.sh --project /path/to/your-app --agent claude,cursor,copilot
/plugin marketplace add Hermes-Lekkas/supalock
/plugin install supalock@supalock
Then run /supalock-audit, /supalock-rls, /supalock-fix, or /supalock-prelaunch directly inside your coding agent.
| Agent | Format Installed | Project Path | Global Path |
|---|---|---|---|
| Claude Code | 8 Skills + 4 Slash Commands + Plugin Manifest | .claude/skills/ ,.claude/commands/ |
~/.claude/skills/ ,~/.claude/commands/ |
| Cursor | Scoped .mdc Guardrail Rule + Skills |
.cursor/rules/supalock.mdc |
~/.cursor/rules/supalock.mdc |
| Antigravity | 8 Open Agent Skills | .agents/skills/ |
~/.agents/skills/ |
| Codex CLI | 8 Open Agent Skills | .codex/skills/ |
~/.codex/skills/ |
| Gemini CLI | 8 Open Agent Skills | .gemini/skills/ |
~/.gemini/skills/ |
| GitHub Copilot | Fenced Guardrail Section (preserves existing rules) | .github/copilot-instructions.md |
— |
| Cline | Project Security Rules | .clinerules |
— |
| Windsurf | Project Security Rules | .windsurfrules |
— |
Every pattern in patterns/ documents a vulnerable snippet, a concrete exploit scenario, CWE + OWASP mapping, and a copy-pasteable production fix.
| # | Attack Surface | Patterns | Static CLI | Agent-Guided | Catalog File |
|---|---|---|---|---|---|
| 01 | Row Level Security (RLS) Policies | 20 | 13 | 7 | 01-rls-policies.json |
| 02 | Postgres Privileges, Views & Functions | 14 | 10 | 4 | 02-postgres-privileges.json |
| 03 | Storage Buckets & storage.objects |
12 | 7 | 5 | 03-storage-buckets.json |
| 04 | Auth, Sessions & Metadata | 14 | 5 | 9 | 04-auth-sessions.json |
| 05 | Deno Edge Functions & Webhooks | 14 | 9 | 5 | 05-edge-functions.json |
| 06 | Client Bundles, .env & Secrets |
12 | 10 | 2 | 06-client-secrets.json |
| 07 | Realtime, PostgREST & RPC | 10 | 5 | 5 | 07-realtime-rpc.json |
| 08 | Vibe-Coded Business Logic (Lovable/Bolt/v0) | 12 | 5 | 7 | 08-vibe-business-logic.json |
| 09 | Next.js SSR, Middleware & Server Actions | 10 | 4 | 6 | 09-nextjs-ssr-api.json |
| 10 | Supabase Config & Deployment | 10 | 8 | 2 | 10-config-deployment.json |
| Total | 128 | 76 | 52 | Browse Full Index → |
Zero inflation guarantee: Our CI suite (tests/test_catalog.py) enforces exact 1:1 parity between the 76 patterns tagged static+agent in the catalog and the static rules actually implemented in supalock/rules/.
| Skill | Purpose | Patterns Covered |
|---|---|---|
supalock-audit |
Master orchestrator — runs CLI scan + semantic review + prioritized fix plan | All 128 patterns |
supalock-rls |
Table-by-table RLS matrix, views ( security_invoker ),SECURITY DEFINER hardening |
SUPA-RLS-001..020 ,SUPA-PG-001..014 |
supalock-storage |
Public/private buckets, storage.foldername , SVG XSS, MIME/size limits, signed URLs |
SUPA-STG-001..012 |
supalock-auth |
getUser() vsgetSession() ,user_metadata , open redirects, SSR & Server Actions |
SUPA-AUTH-001..014 ,SUPA-SSR-001..010 |
supalock-edge-functions |
JWT verification, Stripe webhooks, CORS, SSRF, AI billing drain, rate limiting | SUPA-EDGE-001..014 |
supalock-secrets-client |
service_role leaks, JWT decoding, Realtime publications, PostgREST injection,config.toml |
SUPA-SEC-001..012 ,SUPA-RT-001..010 ,SUPA-CFG-001..010 |
supalock-vibe-patterns |
Lovable/Bolt/v0/Cursor flaws: billing mutation, race-condition credits, paywall bypass | SUPA-VIBE-001..012 |
supalock-fix |
Generates idempotent SQL migrations, minimal code diffs, and curl/pgTAP proofs | Remediation & verification |
Slash Commands: /supalock-audit · /supalock-rls · /supalock-fix · /supalock-prelaunch
supalock scan .
supalock scan . --format sarif --output supalock.sarif
supalock scan . --format markdown --output audit-report.md
supalock scan . --format json --fail-on high
supalock explain SUPA-RLS-009
supalock list --severity critical
supalock list --category rls-policies --detection static+agent
supalock stats
supalock init-ci > .github/workflows/supalock.yml
If a table is intentionally public (e.g., a marketing blog posts table), suppress a specific rule inline with a reason:
-- supalock-ignore: SUPA-RLS-003 (intentional public marketing catalog)
CREATE POLICY "Public read blog posts" ON public.blog_posts FOR SELECT TO anon, authenticated USING (true);
Supalock also avoids common scanner false positives out of the box:
- Cross-migration RLS tracking: creating a table in
001_init.sqland enabling RLS in002_rls.sqlwillnot triggerSUPA-RLS-001. - JWT payload decoding: base64-decodes hardcoded Supabase JWTs to distinguish harmless
anonkeys from catastrophicservice_rolekeys. TO service_roleawareness: does not flagUSING (true)on policies restricted exclusively toservice_role.- Template env awareness: ignores placeholder values and
.env.example/.env.templatefiles.
Run supalock init-ci or add .github/workflows/supalock.yml:
name: Supalock Security Audit
on: [push, pull_request]
jobs:
supalock:
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Supalock
run: pip install git+https://github.com/Hermes-Lekkas/supalock.git
- name: Run Supalock Static Scan
run: supalock scan . --format sarif --output supalock.sarif --fail-on high
- name: Upload SARIF to GitHub Security
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: supalock.sarif
supalock/
├── patterns/ # 128 curated vulnerability patterns (10 JSON files + index)
├── supalock/ # Zero-dependency Python 3.9+ CLI static analyzer
│ ├── rules/
│ │ ├── sql_rules.py # Cross-migration SQL/RLS/Postgres/Storage/Realtime analyzer
│ │ ├── code_rules.py # TS/JS/Next.js/Deno Edge Function/Vibe-pattern analyzer
│ │ └── config_rules.py # .env, supabase/config.toml, next.config, CI analyzer
│ ├── scanner.py # Directory walker, inline suppressions, scoring & grading
│ ├── formatters.py # Terminal, JSON, Markdown, and SARIF 2.1.0 formatters
│ └── cli.py # scan, list, explain, stats, init-ci commands
├── skills/ # 8 Open Agent Skills (SKILL.md standard)
├── commands/ # 4 slash commands for Claude Code & compatible agents
├── .claude-plugin/ # Claude Code plugin & marketplace manifests
├── .cursor/rules/ # Scoped Cursor .mdc guardrails
├── install.sh # Multi-agent installer (--global, --project, --uninstall)
├── examples/
│ ├── vulnerable-vibe-saas/ # Demo app with 46 detected leaks (Score: 0/100, Grade F)
│ └── hardened-vibe-saas/ # Hardened counterpart (Score: 100/100, Grade A, 0 findings)
└── tests/ # 32 unit, catalog parity, installer & E2E tests
Contributions of new real-world Supabase & vibe-coded vulnerability patterns are warmly welcome! See CONTRIBUTING.md.
Released under the MIT License.