readonly-sql-guard
Make an agent's database access provably read-only. Use when an agent runs caller-supplied SQL against a production/ERP/analytics database (a "query" MCP tool, text-to-SQL, an admin console), or when reviewing DB-access code for write/DDL/side-effect/transaction-escape risks. Checks what a statement CALLS, not just its shape.
原文 · 译文未通过检查适用对象:数据库。自动收录 · 待核查。
原作者说明节选
从固定版本的 SKILL.md 提取,保留原文语言。以下内容属于作者说明,本站尚未验证安装、兼容或运行结果。
查看英文原文
原文涵盖的主题
- Use this skill when
- The core mistake: shape-only guards
- What to enforce instead (check what it CALLS)
- Recommended implementation
- Review checklist
You are a database-safety specialist. Your job is to ensure that when an AI agent is given the ability to run SQL, "read-only" is a property the code enforces — not an adjective in a prompt. Building or reviewing an MCP server / tool that lets an agent run SQL (a query tool, a text-to-SQL endpoint, a BI or admin console that "only allows SELECT"). Deciding whether a statement supplied by an agent or a user is safe to execute. Auditing existing DB-access code for weak "read-only" enforcement. Most "read-only" checks inspect a statement's shape — "does it start with SELECT?", "does it contain the word DELETE?". That is not enough. A perfectly well-formed SELECT can still read a file, open a socket, run a shell, escape a read-only transaction, or flip the session: These are exactly the failures behind the archived reference Postgres MCP server (a COMMIT; DROP … escaping BEGIN TRANSACTION READ ONLY) and the Supabase "lethal trifecta." A starts-with-SELECT check refuses about 6 of 28 such attacks; a keyword blocklist about 9 (and it also blocks a legitimate read whose string literal contains the word "delete"). Enforce read-only in layers, and check the statement, not just its first key
这里只展示节选,请以完整原文和当前要求为准。
- 来源仓库
- davila7/claude-code-templates
- 源文件
- cli-tool/components/skills/database/readonly-sql-guard/SKILL.md
- 固定版本
- 21be197f100a12b8d0dd9a211cc244c8179f84d3
来源与内容状态
本条为自动发现的元数据,尚未完成人工文档核查;适用性与运行结果待核查。
原作者:davila7/claude-code-templates · 原作者仓库元数据。文档核查:未核查。最近来源检查:2026-11-09T14:01:43.983Z。
分类由名称、说明与路径规则生成,分类不代表已核实适配。
许可与权利归属
MIT。第三方内容及版权归原作者,使用条件以原文为准。
许可原文 ↗本站没有因同步、复制或用户自报成功而将资源标为运行验证通过。
限制与注意事项
- 元数据收录不代表本站已经安装、适配、实测或进行安全审查。