Logo Database Sentinel

Database Sentinel

Cộng đồng
Farenhytee

Open-source security audits for Supabase: a read-only MCP server, a CLI agent and a Claude Skill. Finds RLS misconfigurations, exposed keys and risky functions, and returns a scored report with fix SQL. Hosted version: Locksoup.

Nhà phát hànhFarenhytee
Kho mãdatabase-sentinel
Ngôn ngữPython
Bản fork
8
Sao
50
Công cụ có sẵn
0
Phương thức truyền tảistdio
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Database Sentinel cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    50 sao và 8 bản fork từ kho mã được liên kết.

🛡️ Database Sentinel

ci

Security audits for your database backend. Ask "audit my database" and get a scored report with exact fix code.

Works as a Claude Skill (Supabase, MongoDB), a read-only MCP server for any AI client, or a CLI agent that uses your own model (both Supabase).

→ MCP server setup and usage guide

→ Don't want to run it yourself? Locksoup is the hosted version: a Supabase security audit with scheduled re-checks and alerts.


Changelog

2026-10-01 (v1.0.1)

  • Fixed: an UPDATE policy without WITH CHECK is no longer reported as letting users reassign row ownership (Postgres reuses USING as the check). Q8's label and the agent prompt said otherwise, which produced false mass-assignment findings on real projects.
  • Benchmark: new dev case 027 from that project. Test F1 unchanged (0.836 vs 0.838, same day). Runs.

2026-09-30 (docs)

  • MCP flow benchmarked: a model driving the real server over stdio scored test F1 0.865, precision 0.905, critical recall 1.0 (results). Harness: evals/mcp_client.py, eval system m.

v1.0.0 (2026-09-30): MCP server release

  • MCP server v1.0: four read-only Supabase tools, an audit prompt and the catalog resources. Benchmarked end to end: a model driving the server over stdio scored test F1 0.865, with critical recall 1.0.
  • Verified on hosted Supabase: session pooler, read-only role with BYPASSRLS, all 20 queries.
  • Fewer false alarms:
    • Q1 now checks API grants: RLS off with anon/authenticated revoked isn't reported as exposed.
    • The audit prompt knows SECURITY INVOKER functions only have the caller's rights.
    • Found on a real project; new dev case 026.
  • Pin a version: git+https://github.com/Farenhytee/database-sentinel@v1.0.0 in any uvx/pipx command. The Claude Code plugin is pinned automatically.
  • Standard audit is now the CLI default: one prompt plus anon-probe verification, ~$0.0007 and ~15s per audit. --deep runs the tool-using agent, which scored the same on our bench at ~5× the cost.

v0.2.1 (2026-09-30)

  • Test F1: agent 0.782 → 0.831, single-prompt 0.766 → 0.849. No crashes or timeouts (results).
  • Fixed:
    • A bad tool argument no longer ends the audit; the error goes back to the model.
    • OpenRouter calls route to the fastest provider (slow ones caused timeouts).
    • The agent's final findings step no longer lists candidates it had dismissed.

v0.2.0 (2026-09-29)

  • Published test results: agent F1 0.782, single-prompt 0.766, rules 0.559 on a blind, locked 10-case test split, 3 runs each (results).
  • Bench: 25 labeled cases (15 dev, 10 blind test).
  • Agent:
    • Verify step: probes as anon to confirm exploitable findings.
    • --fix: prints fix SQL for findings you pick. It's never executed.
    • Cost reporting: tokens, $ and tool calls for each audit.
  • CI: free rules-only regression gate.

2026-09-29

  • One-command install: Claude Code plugin (skill + MCP server, prompts for your connection string) and an Add to Cursor button.
  • Install from GitHub: one command for the MCP server (uvx --from git+… sentinel-mcp) and the agent (pipx install "database-sentinel[agent] @ git+…").
  • sentinel-mcp --role-sql prints the read-only role setup SQL.
  • Clearer errors: the MCP client now sees why a call failed, and the CLI prints a single-line error.

2026-09-28

  • New: MCP server for Supabase. Four read-only tools, an audit prompt and the pattern catalog as resources. Your own LLM does the analysis, so it's free.
  • New: lite agent (sentinel-audit). A LangGraph pipeline that works with any OpenAI-compatible model: OpenRouter, OpenAI, or local Ollama.
  • New: benchmark + evals. 10 labeled Supabase cases, with precision/recall/F1 compared across a rules baseline, a single-prompt baseline and the agent.
  • Fixed: six Supabase audit queries. Q8 (UPDATE without WITH CHECK) never matched anything, Q16 and Q19 missed rows for least-privilege roles, and Q6, Q13 and Q14 had wrong conditions.

Quick start

Claude Code installs the audit skill and the MCP server in one go (needs uv):

bash
claude plugin marketplace add Farenhytee/database-sentinel
claude plugin install database-sentinel@database-sentinel

Supabase users: create the read-only login (step 1), then run /plugin configure database-sentinel@database-sentinel in Claude Code. Then ask: Audit my database.

Cursor   Add to Cursor

Other MCP clients, and full setup: MCP guide

Skill only (Claude Code picks it up automatically):

bash
git clone https://github.com/Farenhytee/database-sentinel.git ~/.claude/skills/database-sentinel

CLI agent (Supabase, bring your own model):

bash
pipx install "database-sentinel[agent] @ git+https://github.com/Farenhytee/database-sentinel"
export SENTINEL_BASE_URL=http://localhost:11434/v1 SENTINEL_MODEL=<model>   # Ollama, or any OpenAI-compatible API + SENTINEL_API_KEY
sentinel-audit --dsn "postgresql://sentinel_auditor:<password>@<host>:5432/postgres" \
  --rest-url https://<ref>.supabase.co --anon-key <anon key> --repo ./my-app

The default audit is one prompt plus anon-probe verification. --deep runs a tool-using agent instead: same accuracy on our bench, ~5× the cost. --fix prints fix SQL for the findings you pick; it's never executed.


What it catches

BackendPatternsExamples
Supabase27 (catalog)RLS disabled, service-role key in frontend, USING (true), views bypassing RLS, exposed SECURITY DEFINER functions, user_metadata in policies, mass assignment, public buckets
MongoDB20 (catalog)MongoBleed (CVE-2025-14847), auth disabled, 0.0.0.0/0 Atlas allowlist, server-side JS, privileged app user

Full tables are in Appendix A.

Safety

  • Read-only by default. Only system catalogs are read. The MCP server and agent can't write, drop or delete anything.
  • Your rows are never read. The audit role has no access to table data. Repo scans report file and line, never secret values.
  • Write and network probes are opt-in (Skill only). Details are in Appendix D.

Status

BackendSkillMCP server / agent
Supabase✅✅
MongoDB✅planned
Firebase, Postgres, MySQL, cross-backendplannedplanned

License

MIT. Exception: database_sentinel/agent/, database_sentinel/mcp_server/ and database_sentinel/kb/ are AGPL-3.0 (see the LICENSE in each).


Appendix

A. Pattern highlights

Supabase

SeverityPatternWhat
🔴 CRITICALRLS_DISABLEDTables without Row-Level Security are fully exposed
🔴 CRITICALSERVICE_ROLE_EXPOSEDservice_role key in frontend code bypasses all security
🔴 CRITICALPOLICIES_BUT_NO_RLSPolicies written but RLS never enabled
🟠 HIGHUSING_TRUEUSING (true) on writes or private data
🟠 HIGHVIEW_NO_SECURITY_INVOKERViews bypass RLS and run as their owner
🟠 HIGHSECURITY_DEFINER_EXPOSEDRLS-bypassing functions callable via the API
🟠 HIGHUSER_METADATA_IN_POLICYPolicies trust user-editable metadata
🟠 HIGHMASS_ASSIGNMENTUsers can update privilege/billing columns on their own rows
🟠 HIGHGHOST_AUTHUnconfirmed sign-ups get authenticated sessions
🟠 HIGHJWT_SECRET_EXPOSEDLeaked signing secret lets attackers forge any token
🟡 MEDIUM+ 17 moreanti-patterns.md

MongoDB

SeverityPatternWhat
🔴 CRITICALMG-SH-001 MongoBleed (CVE-2025-14847, CISA KEV)Pre-auth heap memory disclosure; ~87K instances exposed at disclosure
🔴 CRITICALMG-SH-002 Auth disabledNo authentication (Meow ransomware surface)
🔴 CRITICALMG-SH-003 Internet-bound mongod--bind_ip_all + reachable 27017
🔴 CRITICALMG-AT-001 Atlas allowlist 0.0.0.0/0Cluster reachable from anywhere
🟠 HIGHMG-SH-005 Server-side JS enabled$where / $function / mapReduce reachable
🟠 HIGHMG-SH-007 Privileged app userApp connects as root / dbAdminAnyDatabase
🟠 HIGHMG-AT-002 Atlas Function pass-throughNoSQL injection over HTTPS
🟡 MEDIUM+ 13 moreanti-patterns.md

The MongoBleed probe (mongobleed-probe.md) is a single-packet, read-only detector. It was verified against mongo:7.0.20 (vulnerable) and 7.0.28 (patched), and runs only after two opt-in confirmations.

B. How the Skill audits

  1. Detect backends. 2. Scan code for exposed credentials. 3. Introspect schema, policies and config. 4. Match against the anti-pattern catalogs. 5. Probe safely (opt-in). 6. Score and report. 7. Generate fix code.

Only SKILL.md (~2K tokens) and core/* load up front; each backend's files load only when that backend is detected.

C. Example output

╔════════════════════════════════════════════════════════╗
║                  SENTINEL SECURITY AUDIT               ║
║  Backends: supabase        Score: 35/100 🔴            ║
╚════════════════════════════════════════════════════════╝

🔴 CRITICAL — public.users: RLS Disabled                  [RLS_DISABLED]
  Risk:   Anyone on the internet can read your entire users table.
  Attack: Copy the anon key from DevTools → curl the API → dump all rows.
  Source: CVE-2025-48757 / Splinter 0013_rls_disabled_in_public
  Fix:    ALTER TABLE public.users ENABLE ROW LEVEL SECURITY;
          CREATE POLICY "users_select_own" ON public.users FOR SELECT
            TO authenticated USING ((SELECT auth.uid()) = id);

D. Safety details

  • Supabase write probes: Prefer: tx=rollback, so no data is modified.
  • MongoDB write probes: session + abortTransaction() on replica sets; canary insert + delete on standalone (opt-in).
  • MongoBleed network probe: double opt-in; some monitoring tools alert on the 42-byte probe packet.
  • Auth probes use .invalid email domains (RFC 6761).
  • Credentials are held in memory for the audit only, and redacted in reports.
  • MCP server: five independent read-only layers (details).

E. Benchmark and evals

bench/cases/ holds labeled Supabase schemas applied to a local Supabase. evals/ scores three systems on precision, recall and F1: R0 (rules, no LLM), B0 (single prompt) and A (agent). The test split is frozen and never tuned on.

Test split (10 blind, locked cases), deepseek-v4-flash, 3 runs each:

VersionSystemPrecisionRecallF1CRITICAL recall$/audit
v1.0.0MCP server (model as MCP client, details)0.9050.8330.8651.000$0.0037
v0.2.1A (agent)0.8510.8180.8311.000$0.0044
v0.2.1B0 (single prompt)0.8100.8940.8491.000$0.0008
v0.2.0 (frozen, details)A (agent)0.7740.8030.7821.000$0.0024
v0.2.0 (frozen)B0 (single prompt)0.7950.7430.7660.889$0.0016
bothR0 (rules)0.4130.8640.5591.000$0

v0.2.1 fixes the crashes and timeouts seen in the v0.2.0 test run. The fixes were diagnosed on dev only, but they came from test failures, so v0.2.0 is the blind number (v0.2.1 details). A and B0 are within noise of each other. The agent is more precise, gives fewer false alarms on clean projects and verifies findings as anon, at ~5× the cost.

bash
pip install -e ".[dev]" && supabase start && python -m evals.run --split dev

F. Continuous monitoring (GitHub Actions)

Templates: github-action-supabase.yml and github-action-mongodb.yml. They run on migration, rule or IaC changes, weekly, or manually, then comment on the PR and fail the build on critical findings. Ask Claude: "Set up continuous security monitoring for this project."

G. Repo layout

SKILL.md, core/, backends/{supabase,mongodb}/, references/   Claude Skill (MIT)
database_sentinel/mcp_server/                                MCP server (AGPL)
database_sentinel/agent/                                     lite agent (AGPL)
bench/, evals/, tests/, supabase/                            benchmark, eval harness, local Supabase
docs/mcp.md                                                  MCP setup guide
compat/supabase-sentinel/                                    old skill name shim

H. Research sources

CVE-2025-48757 (170+ Lovable apps), Escape.tech (2,000+ vulns in 5,600 vibe-coded apps), Veracode (45% of AI code has OWASP Top 10 issues), CMU SusVibes, ModernPentest (20.1M rows, 107 YC startups), Supabase Splinter lints, CVE-2025-14847 MongoBleed, Mongoose CVE-2024-53900 / CVE-2025-23061, CIS MongoDB 7 Benchmark. Full list: vibe-coding-context.md, cve-feed.md.

I. Contributing

Most valuable: new anti-patterns with evidence (CVE, breach report, or lint), better fix templates, false-positive/negative reports from live use, and new backends following backends/supabase/. Fork, branch, and open a PR with the pattern and its source. Contributions to the AGPL directories need a CLA.

J. Naming history

Supabase Sentinel (v1) → Database Sentinel (v3, multi-backend). The supabase-sentinel name still works through compat/supabase-sentinel/.

Dùng MCP Database Sentinel với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Database Sentinel, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Database Sentinel làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Database Sentinel.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "database-sentinel": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Database Sentinel, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Database Sentinel.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Database Sentinel giúp tôi làm việc này không?
Database Sentinel
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Database Sentinel.

Câu hỏi thường gặp

Máy chủ MCP Database Sentinel dùng để làm gì?

Database Sentinel là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Database Sentinel với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Database Sentinel với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Database Sentinel với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Database Sentinel, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Database Sentinel với TypingMind?

Database Sentinel hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP Database Sentinel cung cấp những công cụ nào trong TypingMind?

Database Sentinel cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Database Sentinel không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Database Sentinel yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇