# Show HN: Supalock – Open-source security scanner and agent skills for Supabase

> Source: <https://github.com/hermes-lekkas/supalock>
> Published: 2026-11-29 21:35:26+00:00

**Key takeaway:** Supalock installs as 8 Open Agent Skills plus 4 slash commands (/supalock-audit, /supalock-rls, /supalock-fix, /supalock-prelaunch) into Claude Code, Cursor, Codex, Antigravity, Gemini CLI, Copilot, Cline and Windsurf, and runs 76 static checks plus 52 agent-guided reviews against 128 Supabase vulne

**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 `public` with**RLS disabled** (one`curl` with your browser`anon` key 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 call`supabase.auth.updateUser({ data: { role: 'admin' } })` )
- Postgres views missing `WITH (security_invoker = true)` that**silently bypass RLS**
- `NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY` bundled straight into the browser
- Next.js `middleware.ts` trusting cookie-sourced`getSession()` instead of verified`getUser()`
- 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

# Scan the included vulnerable Lovable/Cursor-style demo SaaS app:
python3 -m supalock scan examples/vulnerable-vibe-saas

# Scan the hardened reference app (100/100 Grade A, 0 findings):
python3 -m supalock scan examples/hardened-vibe-saas

# Scan your own Supabase project:
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**:

```
# Open Agent Skills CLI (works across Antigravity, Claude Code, Cursor, Codex, Gemini CLI)
npx skills add Hermes-Lekkas/supalock

# Or run the multi-agent installer directly into your current repo:
curl -fsSL https://raw.githubusercontent.com/Hermes-Lekkas/supalock/main/install.sh | bash

# Install globally for specific agents (or auto-detect all installed agents):
./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/`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/README.md) 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`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/01-rls-policies.json) | 
| 02 | **Postgres Privileges, Views & Functions** | 14 | 10 | 4 | [`02-postgres-privileges.json`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/02-postgres-privileges.json) | 
| 03 | **Storage Buckets & `storage.objects`** | 12 | 7 | 5 | [` 03-storage-buckets.json`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/03-storage-buckets.json) | 
| 04 | **Auth, Sessions & Metadata** | 14 | 5 | 9 | [`04-auth-sessions.json`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/04-auth-sessions.json) | 
| 05 | **Deno Edge Functions & Webhooks** | 14 | 9 | 5 | [`05-edge-functions.json`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/05-edge-functions.json) | 
| 06 | **Client Bundles, `.env` & Secrets** | 12 | 10 | 2 | [`06-client-secrets.json`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/06-client-secrets.json) | 
| 07 | **Realtime, PostgREST & RPC** | 10 | 5 | 5 | [`07-realtime-rpc.json`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/07-realtime-rpc.json) | 
| 08 | **Vibe-Coded Business Logic (Lovable/Bolt/v0)** | 12 | 5 | 7 | [`08-vibe-business-logic.json`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/08-vibe-business-logic.json) | 
| 09 | **Next.js SSR, Middleware & Server Actions** | 10 | 4 | 6 | [`09-nextjs-ssr-api.json`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/09-nextjs-ssr-api.json) | 
| 10 | **Supabase Config & Deployment** | 10 | 8 | 2 | [`10-config-deployment.json`](https://github.com/hermes-lekkas/supalock/blob/main/patterns/10-config-deployment.json) | 
|  | **Total** | **128** | **76** | **52** | [**Browse Full Index →**](https://github.com/hermes-lekkas/supalock/blob/main/patterns/README.md) | 

**Zero inflation guarantee:** Our CI suite ([`tests/test_catalog.py`](https://github.com/hermes-lekkas/supalock/blob/main/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/`](https://github.com/hermes-lekkas/supalock/blob/main/supalock/rules).

| Skill | Purpose | Patterns Covered | 
|---|---|---|
| [`supalock-audit`](https://github.com/hermes-lekkas/supalock/blob/main/skills/supalock-audit/SKILL.md) | Master orchestrator — runs CLI scan + semantic review + prioritized fix plan | All 128 patterns | 
| [`supalock-rls`](https://github.com/hermes-lekkas/supalock/blob/main/skills/supalock-rls/SKILL.md) | Table-by-table RLS matrix, views ( `security_invoker` ),`SECURITY DEFINER` hardening | `SUPA-RLS-001..020` ,`SUPA-PG-001..014` | 
| [`supalock-storage`](https://github.com/hermes-lekkas/supalock/blob/main/skills/supalock-storage/SKILL.md) | Public/private buckets, `storage.foldername` , SVG XSS, MIME/size limits, signed URLs | `SUPA-STG-001..012` | 
| [`supalock-auth`](https://github.com/hermes-lekkas/supalock/blob/main/skills/supalock-auth/SKILL.md) | `getUser()` vs`getSession()` ,`user_metadata` , open redirects, SSR & Server Actions | `SUPA-AUTH-001..014` ,`SUPA-SSR-001..010` | 
| [`supalock-edge-functions`](https://github.com/hermes-lekkas/supalock/blob/main/skills/supalock-edge-functions/SKILL.md) | JWT verification, Stripe webhooks, CORS, SSRF, AI billing drain, rate limiting | `SUPA-EDGE-001..014` | 
| [`supalock-secrets-client`](https://github.com/hermes-lekkas/supalock/blob/main/skills/supalock-secrets-client/SKILL.md) | `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`](https://github.com/hermes-lekkas/supalock/blob/main/skills/supalock-vibe-patterns/SKILL.md) | Lovable/Bolt/v0/Cursor flaws: billing mutation, race-condition credits, paywall bypass | `SUPA-VIBE-001..012` | 
| [`supalock-fix`](https://github.com/hermes-lekkas/supalock/blob/main/skills/supalock-fix/SKILL.md) | Generates idempotent SQL migrations, minimal code diffs, and curl/pgTAP proofs | Remediation & verification | 

**Slash Commands:** [`/supalock-audit`](https://github.com/hermes-lekkas/supalock/blob/main/commands/supalock-audit.md) · [`/supalock-rls`](https://github.com/hermes-lekkas/supalock/blob/main/commands/supalock-rls.md) · [`/supalock-fix`](https://github.com/hermes-lekkas/supalock/blob/main/commands/supalock-fix.md) · `/supalock-prelaunch`

```
# Scan a directory with terminal output
supalock scan .

# Output GitHub Code Scanning SARIF 2.1.0, JSON, or Markdown PR report
supalock scan . --format sarif --output supalock.sarif
supalock scan . --format markdown --output audit-report.md
supalock scan . --format json --fail-on high

# Deep-dive any pattern with vulnerable example, exploit scenario, and copy-pasteable fix
supalock explain SUPA-RLS-009

# Filter the 128-pattern catalog
supalock list --severity critical
supalock list --category rls-policies --detection static+agent

# Print catalog statistics
supalock stats

# Generate a ready-to-commit GitHub Actions workflow with SARIF upload
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.sql` and enabling RLS in`002_rls.sql` will**not** trigger`SUPA-RLS-001` .
- **JWT payload decoding:** base64-decodes hardcoded Supabase JWTs to distinguish harmless`anon` keys from catastrophic`service_role` keys.
- **`TO service_role` awareness:** does not flag`USING (true)` on policies restricted exclusively to`service_role` .
- **Template env awareness:** ignores placeholder values and`.env.example` /`.env.template` files.

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](https://github.com/hermes-lekkas/supalock/blob/main/CONTRIBUTING.md).

Released under the [MIT License](https://github.com/hermes-lekkas/supalock/blob/main/LICENSE).
