rust-review
它能做什么
该技能让智能体检查 Rust 程序中的安全弱点,尤其关注代码超出 Rust 安全规则的部分。适用于开发和审查 Rust crate 与服务的开发者和安全审查人员。
适用场景
- ✓你正在审计使用了 unsafe 代码的 Rust 库或服务的时候。
- ✓你想检查与 C 代码或其他外部接口交互的 Rust 项目的时候。
- ✓你需要找出崩溃风险,例如用户可能在服务器上触发的 panic 的时候。
技能链接
https://github.com/trailofbits/skills/blob/main/plugins/rust-review/skills/rust-review/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我需要对我的 Rust 项目做一次安全审查,尤其是 unsafe 代码块和 C 绑定。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体把代码分组,并把每组交给一个读取代码并写出发现的工作单元。随后由评审者去除重复项并检查误报,最终形成一份清单。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Rust Security Review
Runs in the main conversation (invoke via /rust-review:rust-review). Orchestrator owns the Task* ledger as bookkeeping for retries; workers and judges have no Task tools. Workers and judges are named plugin subagents (rust-review:rust-review-worker, rust-review:rust-review-dedup-judge, rust-review:rust-review-fp-judge); tool sets are declared in plugins/rust-review/agents/*.md. Findings are exchanged via markdown-with-YAML files in a shared output directory.
When to Use
Rust application/library security review: safe/unsafe boundary auditing, memory safety in unsafe blocks, concurrency hazards, panic-induced DoS on servers, FFI safety, async-runtime mistakes.
When NOT to Use
- Pure-C / pure-C++ codebases — use
c-reviewinstead. - Smart contracts (Solana programs / NEAR contracts / Ink!) — use
solana-vulnerability-scanneror the contract-specific skill. - Kernel-mode Rust drivers without userspace allocator — coverage is incomplete; flag as advisory only.
- Secrets/key memory hygiene (zeroization,
Zeroize/ZeroizeOnDrop/secrecyusage, lingering stack/heap copies) — use thezeroize-auditskill; rust-review does not cover memory zeroization.
Subagents
| Subagent type | Purpose | Tool set |
|---|---|---|
rust-review:rust-review-worker |
Run assigned cluster, write findings | Read, Write, Edit, Bash |
rust-review:rust-review-dedup-judge |
Merge duplicates (runs first) | Read, Write, Edit, Glob |
rust-review:rust-review-fp-judge |
FP + severity + final reports (runs second) | Read, Write, Edit, Bash |
Tools come from each agent's frontmatter at spawn time. The orchestrator's Task*/Agent/Bash/etc. come from this skill's allowed-tools. Search-tool / Bash interaction: in current Claude Code, an agent granted Bash is not also granted the dedicated Glob or Grep tools (the calls return No such tool available; the harness expects find/grep/rg via Bash instead). So only the dedup-judge — the one agent that holds no Bash — uses Glob; the worker, fp-judge, and the orchestrator resolve and search paths with Read / Bash find / rg / grep / test -f instead. Because the cluster/finder prompt seeds are written in ripgrep regex syntax (\s, \d, \b), Bash-holding agents must run them with rg. If rg is not installed its call fails loudly (command not found) — fall back to grep -E with POSIX classes (\s→[[:space:]], \d→[[:digit:]], drop \b), never a raw-\s grep whose silent empty becomes a bad cleared. Do not reintroduce Glob/Grep into a Bash-holding agent's protocol.
Architecture
coordinator: write context.md → build_run_plan.py → TaskCreate × M
→ spawn primer (foreground) → spawn M workers (parallel)
→ classify Phase-7 outcomes + write findings-index.txt
→ dedup-judge → fp-judge → report safety net (SARIF + REPORT.md) → return REPORT.md
Output directory contains: context.md, plan.json, worker-prompts/, findings/, findings-index.d/ (per-worker shards), findings-index.txt, coverage/ (per-worker coverage-gate files), run-summary.md, dedup-summary.md, fp-summary.md, REPORT.md, REPORT.sarif.
Path convention: every later phase shells out to ${RUST_REVIEW_PLUGIN_ROOT}/scripts/*.py, so resolve that variable first to the plugin directory that contains prompts/clusters/unsafe-boundary.md (and scripts/build_run_plan.py). Try in order, first hit wins:
- Native Claude Code —
${CLAUDE_PLUGIN_ROOT}, accepted ifBash: ls "${CLAUDE_PLUGIN_ROOT}/prompts/clusters/unsafe-boundary.md"resolves. - Codex —
${CODEX_PLUGIN_ROOT}(set it the same way if that var is present and resolves the marker). - Fallback search — covers Codex installs under
~/.codex, Claude installs under~/.claude, and a local checkout / repo run:Bash: find ~/.claude ~/.codex . -path '*/plugins/rust-review/prompts/clusters/unsafe-boundary.md' -print -quit 2>/dev/null. Take the match and strip the trailing/prompts/clusters/unsafe-boundary.mdto get the root (the home dirs are searched before.so an installed copy wins over any vendored copy in the audited repo).
Set RUST_REVIEW_PLUGIN_ROOT to the resolved root. If all three fail, abort with a message naming the roots searched — do not enter Phase 4 with an empty variable (every `uv run --no-project "${RUST_REVIEW_PLUGIN_ROOT}/scripts
常见问题
它也涵盖 C 或 C++ 代码吗?
不涵盖。对于纯 C 或 C++ 项目,该技能建议使用其他审查工具。
它会涵盖如何从内存中清除机密吗?
不会。清除内存中的机密由另一个技能负责。
它能审查内核驱动程序吗?
只能提供建议。对内核模式 Rust 的覆盖不完整,因此结果会被标记为仅供参考。
详情
作者的原始描述
Performs comprehensive Rust security review for safe/unsafe boundary issues, memory safety in unsafe blocks, concurrency hazards, panic-induced DoS, FFI safety, and async runtime mistakes. Use when auditing Rust crates, services, or libraries — particularly those with `unsafe`, FFI, or concurrent code.
repo: trailofbits/skills
热度
- GitHub 星标
- 8.0k
- 排名
- #12703
- 许可证
- CC-BY-SA-4.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
audit-context-building
8.0k帮你的智能体在安全审查之前熟悉一个陌生的代码库,梳理每个函数的假设、保证和依赖关系。
algorand-vulnerability-scanner
8.0k帮你的智能体扫描 TEAL 或 PyTeal 编写的 Algorand 智能合约,检查 11 类常见安全问题,如重新密钥攻击和未校验费用。
audit-prep-assistant
8.0k帮你的智能体为外部安全审查做好代码准备,包括静态分析、测试覆盖、死代码清理和清晰的文档。
cairo-vulnerability-scanner
8.0k帮你的智能体扫描 StarkNet 上的 Cairo 智能合约,检查 6 类严重问题,包括算术溢出、有风险的跨层消息和签名重放。