patcher-overview
它能做什么
该技能指导智能体用最小的代码改动修复已确认的安全问题,然后重新运行检查。适合 Decepticon 安全流程中的开发者。
适用场景
- ✓当安全扫描器已确认一个漏洞,并需要一个小而专注的修复时。
- ✓当你希望在标记为完成之前,重新测试一项拟议的修复时。
- ✓当某项修复引起了回归,需要撤销并重新尝试时。
技能链接
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/plugins/patcher/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们在搜索页面中确认了一个 SQL 注入。你能编写最小的修复并检查它是否有效吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会阅读每个漏洞附近的代码,提出一项使用安全方法的最小改动,应用它,并在接受之前重新运行概念验证和测试。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Patcher Skill
You fix validated findings and prove the fix holds. Minimal diffs, one
concern at a time, mandatory patch_verify before claiming done.
Iteration loop
while not patched and attempts < 3:
1. kg_query(kind="vulnerability", min_severity="medium")
→ pick validated=True, patched!=True
2. Read the function around (file, line)
3. Design minimal fix (validate / escape / parameterize / safe API)
4. patch_propose(vuln_id, diff, commit_message) → patch_id
5. Apply diff via Edit or bash patch
6. (optional) bash: run repo tests, abort on failure
7. patch_verify(patch_id, poc_command, success_patterns,
test_cmd=optional)
8. if status == "verified": done
elif status == "tests_failed": revert, retry
elif status == "regressed": revert, analyze, retry
attempts += 1
Diff style
- Unified diff. Use
git diff --no-coloroutput or write one by hand. - Minimal hunk. One concern. No formatting. No renames. No "while I'm here" cleanups. No new files (unless adding one regression test).
- Safe-API preference.
| Bug class | Preferred fix |
|---|---|
| SQL injection | Parameterized query / ORM.filter(), NOT escaping |
| Command injection | Arg-list subprocess, shell=False |
| Path traversal | os.path.realpath + prefix check |
| SSRF | Allowlist + resolve → check not private/loopback |
| Deserialization | Switch to safe loader (yaml.safe_load, JSON, etc.) |
| Broken auth | Move check to pre-hook, not inside handler |
| Reflected XSS | Framework auto-escape, remove Markup/safe |
- Add a regression test in the same diff when the repo has a test directory for the affected module. One test that exercises the fixed path is sufficient.
Commit message format
Conventional commits. Example:
fix(auth): use constant-time comparison in verify_hmac
Prevents timing side-channel recovery of the HMAC. CWE-208.
Decisive-completion rule
Only report "patched" after patch_verify.status == "verified". A
green test suite is NOT sufficient — the PoC must actually fail.
If all 3 attempts fail, STOP on the finding, record a note via
kg_add_node on the vuln (patch_attempts=3, last_failure=...) and
return to the orchestrator. Do not spiral.
常见问题
它会重写整个文件吗?
不会。它每次只处理一个问题,做最小的改动,不做无关的清理。
SQL 注入的首选修复是什么?
使用参数化查询或 ORM 过滤器,而不是手动转义输入。
如果测试失败会怎样?
智能体会撤销改动、分析结果,并最多重试三次。
详情
作者的原始描述
Stage 4 patch generation playbook. Minimal diffs for validated findings with mandatory patch_verify. Load at patcher-agent startup.
热度
- GitHub 星标
- 6.5k
- 排名
- #13900
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …