threat-model
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesethreat-model
威胁建模
A threat model answers "what could go wrong with this system, who would do
it, and what should we do about it?" independently of whether any specific
bug has been found yet. It is the map; vulnerability discovery is the metal
detector. A good threat model tells the pipeline where to look and tells triage
which findings matter.
Litmus test: If patching one line of code makes an entry disappear, it was
a vulnerability, not a threat. A threat ("attacker achieves RCE via untrusted
media parsing") still stands after every known bug is fixed; a vulnerability
(" doesn't bounds-check ") does not. This skill
produces threats. Vulnerabilities appear only as evidence that raises a
threat's likelihood score.
dr_wav.h:412chunk_sizeInvocation:
/threat-model [bootstrap-then-interview|bootstrap|interview] <target-dir> [flags]威胁模型旨在回答**「这个系统可能出现什么问题?谁会发起攻击?我们该如何应对?」**,无论是否已发现具体漏洞,都能给出答案。它就像一张地图,而漏洞发现则是金属探测器。优质的威胁模型能指导流程排查方向,并帮助优先级划分判断哪些发现更为关键。
验证测试:如果修补一行代码就能消除某个条目,那它是漏洞而非威胁。威胁(如「攻击者通过不可信媒体解析实现RCE」)在所有已知漏洞修复后依然存在;而漏洞(如「未对进行边界检查」)则会随着修复消失。本工具生成的是威胁内容,漏洞仅作为提升威胁可能性评分的证据出现。
dr_wav.h:412chunk_size调用方式:
/threat-model [bootstrap-then-interview|bootstrap|interview] <target-dir> [flags]Step 0 — Safety preamble (always runs first)
步骤0 — 安全前置说明(始终优先执行)
This skill performs static analysis only. It reads source, git history,
and any vulnerability reports the user supplies, and writes a single output
file (). It does not build, execute, fuzz, or
modify the target, and does not make network requests against the target's
infrastructure.
<target-dir>/THREAT_MODEL.mdBefore proceeding, confirm and state in your first response:
- The target directory exists and is a local checkout you can read.
- You will not execute any code from the target directory.
- If points at a URL or you are asked to "fetch CVEs", you will query only public advisory databases (NVD, GitHub Security Advisories, the project's own issue tracker) and never the target's live deployment.
--vulns
If the user asks you to validate a threat by running an exploit, decline and
point them at the (README Step 2) instead.
vuln-pipeline本工具仅执行静态分析。它会读取源代码、git历史记录以及用户提供的任何漏洞报告,并生成单个输出文件()。它不会构建、执行、模糊测试或修改目标代码,也不会针对目标基础设施发起网络请求。
<target-dir>/THREAT_MODEL.md在开始前,请在首次回复中确认并声明:
- 目标目录存在且为可读取的本地检出版本。
- 不会执行目标目录中的任何代码。
- 如果指向URL或被要求「获取CVE」,仅会查询公开咨询数据库(NVD、GitHub安全咨询、项目自身的问题追踪器),绝不会访问目标的实时部署环境。
--vulns
如果用户要求通过运行漏洞利用程序验证威胁,请拒绝并引导他们使用(README步骤2)。
vuln-pipelineStep 1 — Route to a mode
步骤1 — 路由至对应模式
Parse :
$ARGUMENTS| First token | Route to |
|---|---|
| Read |
| Read |
| Bootstrap first, then interview seeded from the draft. See below. |
| anything else, or empty | Ask the user: "Is someone who owns or built this system available to answer questions in this session?" Yes and the codebase is checked out → recommend |
All modes write the same artifact (, schema in )
so downstream consumers (pipeline /, verifier agents) do not need
to know which mode produced it.
THREAT_MODEL.mdschema.mdreconjudge | | |
|---|---|---|
| Needs | An application owner present in the session | A local checkout; optionally past vulns |
| Method | Four-question framework: conversational walk through what are we working on → what can go wrong → what are we going to do about it → did we do a good job | Five stages: parallel research swarm → synthesize sections 1-3 + vuln table → generalize vulns into threat classes → STRIDE gap-fill → emit |
| Best for | New systems, design reviews, systems where the risk lives in business logic the code doesn't show | Inherited systems, third-party code, OSS dependencies, anything with a CVE history |
| Provenance tag | | |
Context durability. Interview mode is multi-turn; tool results from early
reads may be evicted before you need them. To stay resilient:
- Do not read or
interview.mdin full up front. Read the mode file (or the relevant section of it) at the point you need it, one question or stage at a time.bootstrap.md - If a re-read via the Read tool is refused as "file unchanged", the prior
result was evicted; reload with via Bash instead.
cat <path>
Interview backbone (so you can proceed even if is
unavailable mid-session):
interview.md| Q | Question | Fills schema sections |
|---|---|---|
| Q1 | What are we working on? | section 1 context, section 2 assets, section 3 entry points |
| Q2 | What can go wrong? | section 4 threat rows (id, threat, actor, surface, asset) |
| Q3 | What are we going to do about it? | section 4 impact/likelihood/status/controls; section 5 deprioritized; section 8 recommended mitigations |
| Q4 | Did we do a good job? | validate ranking, coverage check, section 6 open questions |
解析:
$ARGUMENTS| 第一个参数 | 路由至 |
|---|---|
| 读取本目录下的 |
| 读取本目录下的 |
| 先执行引导模式,再基于草稿启动访谈模式。详情见下文。 |
| 其他内容或为空 | 询问用户:「是否有该系统的所有者或构建者可在本次会话中回答问题?」 是且代码库已检出 → 推荐 |
所有模式都会生成相同的产物(,架构定义在中),因此下游消费者(流程中的/、验证Agent)无需关心产物由哪种模式生成。
THREAT_MODEL.mdschema.mdreconjudge | | |
|---|---|---|
| 所需条件 | 会话中有应用所有者在场 | 本地代码检出版本;可选提供过往漏洞信息 |
| 方法 | 四问题框架:通过对话梳理「我们正在开发什么 → 可能出现什么问题 → 我们将如何应对 → 我们做得好不好」 | 五个阶段:并行研究集群 → 整合第1-3部分及漏洞表格 → 将漏洞归纳为威胁类别 → STRIDE框架补全 → 生成输出 |
| 最佳适用场景 | 新系统、设计评审、风险存在于代码未体现的业务逻辑中的系统 | 继承系统、第三方代码、OSS依赖、有CVE历史记录的任何系统 |
| 来源标签 | | |
上下文持久性:访谈模式为多轮对话;早期读取的工具结果可能在需要前被清除。为保持稳定性:
- 不要预先完整读取或
interview.md。仅在需要时读取模式文件(或其中相关章节),一次一个问题或阶段。bootstrap.md - 如果通过Read工具重新读取时被提示「文件未更改」,说明之前的结果已被清除;请改用Bash的命令重新加载。
cat <path>
访谈核心框架(即使会话中途无法访问,也可依此推进):
interview.md| 问题编号 | 问题内容 | 填充架构章节 |
|---|---|---|
| Q1 | 我们正在开发什么? | 第1部分上下文、第2部分资产、第3部分入口点 |
| Q2 | 可能出现什么问题? | 第4部分威胁行(ID、威胁内容、攻击者、攻击面、资产) |
| Q3 | 我们将如何应对? | 第4部分影响/可能性/状态/控制措施;第5部分低优先级内容;第8部分推荐缓解措施 |
| Q4 | 我们做得好不好? | 验证优先级排序、覆盖范围检查、第6部分未解决问题 |
bootstrap-then-interview
mode
bootstrap-then-interviewbootstrap-then-interview
模式
bootstrap-then-interviewWhen the owner is available and the codebase is checked out, this is the
recommended path: the owner's time goes to refining a code-grounded draft
instead of describing the system from scratch.
- Tell the owner: "I'll read the code first and come back with a draft
(about 5-10 min), then we'll walk it together. Want that, or would you
rather start cold?" Only proceed if they opt in; otherwise fall back to
.
interview.md - Read and follow it end-to-end. Write
bootstrap.md.<target-dir>/THREAT_MODEL.md - Immediately continue into interview mode: read and follow it with
interview.mdin effect. The section 6 open questions from bootstrap become your Q1-Q4 prompts; the owner confirms, corrects, and adds rather than starting from nothing.--seed <target-dir>/THREAT_MODEL.md - Overwrite with the refined model. Set provenance
<target-dir>/THREAT_MODEL.md.mode: bootstrap-then-interview
The same flow is available manually: run first, then
in a later session.
bootstrapinterview --seed <THREAT_MODEL.md>当所有者可用且代码库已检出时,推荐使用此路径:所有者的时间将用于优化基于代码生成的草稿,而非从头描述系统。
- 告知所有者:「我将先读取代码,然后返回一份草稿(约5-10分钟),之后我们一起梳理。您是否同意?还是想直接开始访谈?」仅在对方同意后继续;否则 fallback 至流程。
interview.md - 读取并完成全流程。生成
bootstrap.md文件。<target-dir>/THREAT_MODEL.md - 立即进入访谈模式:读取并启用
interview.md参数。引导模式中第6部分的未解决问题将作为Q1-Q4的提示;所有者只需确认、修正和补充内容,无需从零开始。--seed <target-dir>/THREAT_MODEL.md - 用优化后的模型覆盖文件。设置来源标签
<target-dir>/THREAT_MODEL.md。mode: bootstrap-then-interview
也可手动执行相同流程:先运行模式,之后在后续会话中运行。
bootstrapinterview --seed <THREAT_MODEL.md>Step 2 — Shared output contract
步骤2 — 统一输出约定
All modes MUST emit conforming to
in this directory. Read immediately before you write the file,
not at routing time; in interview mode the gap between routing and emit can be
many turns, and an early read will be evicted before it's used.
<target-dir>/THREAT_MODEL.mdschema.mdschema.mdAfter writing the file, print to the user:
- The path to .
THREAT_MODEL.md - The top 5 threats by likelihood × impact (id, one-line description, L×I).
- For : any open questions the code could not answer (these seed a later
bootstrappass).interview - For : any owner statements that could not be verified in code (these seed follow-up code review).
interview
所有模式必须生成符合本目录下规范的文件。请在写入文件前立即读取,而非在路由阶段读取;访谈模式中路由到生成文件的间隔可能有多个对话轮次,提前读取的内容可能在需要时已被清除。
schema.md<target-dir>/THREAT_MODEL.mdschema.md写入文件后,向用户输出以下内容:
- 的路径。
THREAT_MODEL.md - 按可能性×影响排名前5的威胁(ID、单行描述、可能性×影响得分)。
- 若为模式:代码无法回答的所有未解决问题(这些将作为后续
bootstrap流程的种子)。interview - 若为模式:所有无法通过代码验证的所有者陈述(这些将作为后续代码审查的种子)。
interview
References
参考资料
- docs/security.md and docs/prompting.md for the engagement-context and authorization framing this skill inherits.
- docs/security.md 和 docs/prompting.md:本工具继承的参与上下文和授权框架。