Agent Skills › pydantic/monty › review-security

review-security

GitHub

用于对代码分支进行安全审查,检测沙箱逃逸、内存错误、资源限制绕过及未信任输入风险。适用于涉及堆模块、路径安全或协议处理的变更评审。

.agents/skills/review-security/SKILL.md pydantic/monty

触发场景

代码合并前审查 涉及敏感模块(如heap, path_security)的变更

安装

npx skills add pydantic/monty --skill review-security -g -y
更多选项

非标准路径

npx skills add https://github.com/pydantic/monty/tree/main/.agents/skills/review-security -g -y

不安装直接使用

npx skills use pydantic/monty@review-security

指定 Agent (Claude Code)

npx skills add pydantic/monty --skill review-security -a claude-code -g -y

安装 repo 全部 skill

npx skills add pydantic/monty --all -g -y

预览 repo 内 skill

npx skills add pydantic/monty --list

SKILL.md

Frontmatter
{
    "name": "review-security",
    "description": "Security review of the current branch against its merge base — sandbox escapes, memory errors, panics and resource-limit bypasses. Use when reviewing changes for security risk, or before merging anything touching the heap\/ module, path_security.rs, the wire protocol or the pool."
}

Security review

Monty runs untrusted, potentially malicious Python. Review this branch on that basis.

git diff origin/main...HEAD

Use a subagent to run .agents/skills/fix-pr-comments/pr-threads.sh (from the fix-pr-comments skill) for security findings already raised on the PR, and confirm each is properly addressed.

Cover the changes and any code they touch — a caller made unsafe by a changed callee is in scope even if it isn't in the diff. Ask:

  • Sandbox escape? Filesystem access outside a mount, path traversal, symlinks resolving out of bounds, network, subprocesses, import-system abuse, callback misuse, leaks through error messages or timing.
  • Memory errors? Worse than panics: nothing stops, state is silently corrupt, and it can become arbitrary execution. unsafe, refcount errors causing use-after-free or double-free, unchecked indexing, aliasing violations, integer overflow feeding a length or index.
  • Resource limits bypassed? Allocations dodging the ResourceTracker (String without StringBuilder), loops with no fuel check, small input → huge allocation.
  • Untrusted input still untrusted? Wire frames from a child are hostile: decoding and proto→Rust conversion must validate everything and never panic. Snapshot provenance and integrity are the host's responsibility. Invalid snapshots may panic, abort, hang or produce wrong results, but must not cause UB; do not require semantic validation solely for tampered snapshots. Keep checks needed for memory safety or transport compatibility.
  • Panics or aborts? unwrap/expect reachable from sandboxed input, unbounded recursion hitting a stack-overflow abort.
  • Mount escapes? Any behaviour that allows sandbox code to escape a filesystem mount and read or alter files outside the mount point. This is particularly severe since mounts are run on the host/client connecting to a sandbox - accessing that environment is a very serious breach of the sandbox and security issue.

Weight both classes by where they land. In a pool worker the process dies, the parent replaces the child and raises an exception — contained. Nothing else is: in host/parent code (monty-pool, monty-proto decoding, monty-fs, the bindings), or in a Rust embedder calling the monty crate in-process, the same bug takes down the application. Scrutinise those hardest, especially anything handling a frame from a child.

The crates/monty/src/heap/ module and crates/monty-fs/src/path_security.rs are security-critical; any change to either needs careful justification. Also check the public API: could a pydantic_monty or @pydantic/monty user misuse this to expose their host?

Report

Per finding: the attack, file:line, the sandboxed Python or hostile frame that triggers it, and the impact. Demonstrate with python-playground rather than asserting where you can. Say which areas you checked and found clean — coverage matters as much as findings.

Report only, unless the user asks for fixes.

版本历史

  • 64662cc 当前 2026-09-22 23:14

    明确允许篡改的快照遵循垃圾进垃圾出原则,不再强制进行语义验证。

  • 026b383 2026-08-20 09:39

同 Skill 集合

.agents/skills/fastmod/SKILL.md
.agents/skills/fix-pr-comments/SKILL.md
.agents/skills/python-playground/SKILL.md
.agents/skills/review-general/SKILL.md
.agents/skills/review-usability/SKILL.md
.agents/skills/review-verbosity/SKILL.md
.agents/skills/writing-style/SKILL.md

元信息

文件数
0
版本
e8db9ae
Hash
f21e0377
收录时间
2026-08-20 09:39

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-11-04 13:26
浙ICP备14020137号-1