agentleFS
PerryLinkPerryLink/dsh-skill-pack-security/skills/threat-model/SKILL.md

threat-model

Skill22 starsChanged 3 months agoApache-2.0View on GitHub

新功能/新系统的轻量威胁建模:固定对象→划定范围与信任边界→资产清单→STRIDE 逐资产威胁表→攻击树(可选)→缓解与优先级,产出可进设计评审的威胁模型文档。为新功能/新改动做设计阶段安全评审、梳理信任边界或画攻击树时用;与安全边界无关的纯 bug 修复、已有成熟建模流程的团队不展开本流程。

  • Reads credentials

57 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use vuln-scan, patch and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    vuln-scan

    Static source-code vulnerability scan. Reads a target directory (and THREAT_MODEL.md if present), spawns parallel review subagents per focus area, and writes VULN-FINDINGS.json + .md for /triage to consume. Read-only — no building, running, or network. For execution-verified crashes, use vuln-pipeline instead. Use when asked to "scan for vulns", "review this code for security issues", "find bugs in <dir>", or as the step between /threat-model and /triage.

    Also in 5 projects that use this

  • AnthropicSkill

    patch

    Generate candidate fixes for verified security findings. Consumes

    Also in 4 projects that use this

  • mbwsimsSkill

    orbit

    Run for repo-wide or diff-wide readiness sweeps: "/orbit", "/orbit pr", "/orbit deep", "/orbit quick", "audit this project", "project-wide review", "is this PR ready overall", or "combined security, tests, codebase, evolution, and instruction review". Use this for broad multi-system assessment, not for a single-file review or a one-domain question.

    Also in 3 projects that use this

  • mbwsimsSkill

    test-plan

    This skill should be used when the user asks to "plan tests", "what should I test", "what tests do I need", "test plan for", "testing strategy for", "test matrix for", "what cases should I cover", "help me plan tests", mentions "/test-plan", or wants to understand what tests are needed before writing any test code.

    Also in 3 projects that use this

  • patrickserranoSkill

    performance-audit

    Audit and improve SwiftUI runtime performance. Use for requests to diagnose slow rendering, janky scrolling, high CPU/memory usage, excessive view updates, or layout thrash in SwiftUI apps.

    Also in 3 projects that use this

  • asterkinSkill

    adr

    Create Architecture Decision Records (ADRs) following project standards. Guides template usage, process, and best practices for documenting architecturally significant decisions.

    Also in 6 projects that use this

The file

Files
SKILL.md

威胁建模(threat-model)

本技能做设计阶段的轻量威胁建模:对一次改动/一个新组件,产出信任边界、STRIDE 威胁表与缓解清单。它只覆盖建模方法论;已有审计发现要定级转 security-audit,具体漏洞查情报转 vuln-intel。产物不含密钥,可进设计文档。

1. 固定建模对象(不固定对象,模型不可复现)

git rev-parse --show-toplevel
git log -1 --format='%H %cd' --date=iso-strict

预期输出样例(以实际输出为准):

D:\repo\example
a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0 2026-08-14T10:30:00+08:00

判据:退出码 0 且第一行为绝对路径;威胁模型文档头部必须记录该提交哈希——评审者据此知道模型针对哪个版本。

2. 划定范围:改了什么、边界在哪

git diff --stat <base>...HEAD
git diff --name-only <base>...HEAD

预期输出样例:src/auth/session.ts | 40 ++++,随后是改动文件路径列表。 判据:范围 = 本次 diff 触及的文件与组件;不做全仓库建模(全仓库建模产出太大、评审没人看)。新建模块没有 diff 时用 git ls-files -- '<模块目录>' 代替。 信任边界四类,每个资产必须标出所在边界:进程内(同进程代码之间)、进程间(IPC/HTTP/RPC)、系统边界(本机/内核/文件系统)、外部(第三方服务/用户/上游数据)。

3. 资产清单(STRIDE 表的行)

git ls-files -- 'package.json' 'pnpm-lock.yaml' '.env*' '.github/workflows/**' 'Dockerfile*' '*.tf' 'cordis.yml' '**/cordis.yml' '*.pem' '**/*.key'

预期输出样例:每行一个相对路径;无匹配 = 该类资产不存在。 判据:资产至少覆盖四类——数据(密钥、用户数据、配置)、代码(本次改动模块)、通道(API、消息、日志)、宿主(CI、容器、外部依赖)。缺哪类补哪类,不能只列本次 diff 的文件。

4. STRIDE 逐资产威胁表

对第 3 节每个资产过六问(完整定义与提问提示见 references/stride-and-attack-tree.md):

资产S 仿冒T 篡改R 抵赖I 信息泄露D 拒绝服务E 提权进入路径缓解
例:会话 token伪造 token篡改声明无审计日志日志打印 token会话风暴越权换身份API 无签名校验签名 + 最小权限

判据:每一格要么有威胁、要么写明"不适用(原因)"——空着等于没建模;威胁必须写"谁、通过哪条路径、造成什么影响"三要素,缺一降为"观察"。 填完倒查:每个资产的"进入路径"是否都经过一个信任边界;没经过任何边界的资产 = 边界图遗漏,回第 2 节补。

5. 攻击树(可选:只给高风险面画)

dot -Tpng attack-tree.dot -o attack-tree.png
# 无 graphviz 时用缩进文本树代替(示例见 references)

预期输出样例:退出码 0 并生成 attack-tree.png。 判据:只对第 4 节中"高影响 × 多前提"的威胁画树,根 = 攻击目标,叶 = 前置条件;每片叶必须可验证(一条命令能证明该前提成立/不成立),验证不了的叶子标注"未验证假设"。.dot 源文件与渲染图都进评审材料。

6. 缓解与优先级

缓解从四个方向选(每个方向的落地模板见 references/stride-and-attack-tree.md):

  • 消除:改设计让路径不存在(最高优先,评审会上先问"能不能不做");
  • 转移:交给已有防护(认证交给 SSO、密钥交给 KMS/CI secrets);
  • 缓解:边界上加校验(签名、鉴权、限流、脱敏日志);
  • 接受:写明理由与残余风险,记录为"接受的风险"。

优先级判据 = 可利用性 × 影响(同 security-audit 三要素,去掉"是否已暴露"——设计阶段还没有暴露一说)。

7. 交付物与自检

交付物:信任边界描述(文字或图)+ 资产清单 + STRIDE 表 +(可选)攻击树 + 缓解清单。 自检命令(预期输出:无匹配;有匹配 = 表里有没填完的行):

grep -nE '\| *TBD *\||待定' threat-model.md

与其他技能的分工

  • security-audit:对已有仓库做全面审计与定级——建模发现的高风险路径交给它逐项验证。
  • vuln-intel:设计里引用的第三方组件有 CVE 时,查详情与影响。
  • supply-chain-review:建模范围含新增依赖时,对依赖做快速供应链评审。
  • secret-scan:资产清单里的密钥类资产直接交给它扫描与脱敏。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.