设计与多媒体

security-threat-model

针对具体代码库产出有据可查的 AppSec 威胁建模 Markdown 文档。

它能做什么

按八步流程推进:抽取系统模型、梳理信任边界与资产入口、评估攻击者能力、枚举滥用路径威胁、进行定性的可能性×影响排序,并通过 1–3 个用户问答确认服务上下文后再出具最终报告。所有架构论断必须能在代码库中找到证据,未确认的假设会显式列出。最终产物是一份以仓库或目标子目录命名的 Markdown 文件,已有的控制措施与建议措施分开列,且每条缓解建议都尽量绑定到具体的组件、边界或入口点。

什么时候用它

  • 对某个服务或子目录进行威胁建模
  • 枚举数据外泄、权限提升、完整性破坏、拒绝服务等滥用路径
  • 识别预认证 RCE、认证绕过、跨租户访问、密钥/令牌窃取、沙箱逃逸等高危路径
  • 产出论断可回溯到代码库具体文件的 AppSec 交付物

技能文档

Threat Model Source Code Repo

Deliver an actionable AppSec-grade threat model that is specific to the repository or a project path, not a generic checklist. Anchor every architectural claim to evidence in the repo and keep assumptions explicit. Prioritizing realistic attacker goals and concrete impacts over generic checklists.

Quick start

  1. Collect (or infer) inputs:
  • Repo root path and any in-scope paths.
  • Intended usage, deployment model, internet exposure, and auth expectations (if known).
  • Any existing repository summary or architecture spec.
  • Use prompts in references/prompt-template.md to generate a repository summary.
  • Follow the required output contract in references/prompt-template.md. Use it verbatim when possible.

Workflow

1) Scope and extract the system model

  • Identify primary components, data stores, and external integrations from the repo summary.
  • Identify how the system runs (server, CLI, library, worker) and its entrypoints.
  • Separate runtime behavior from CI/build/dev tooling and from tests/examples.
  • Map the in-scope locations to those components and exclude out-of-scope items explicitly.
  • Do not claim components, flows, or controls without evidence.

2) Derive boundaries, assets, and entry points

  • Enumerate trust boundaries as concrete edges between components, noting protocol, auth, encryption, validation, and rate limiting.
  • List assets that drive risk (data, credentials, models, config, compute resources, audit logs).
  • Identify entry points (endpoints, upload surfaces, parsers/decoders, job triggers, admin tooling, logging/error sinks).

3) Calibrate assets and attacker capabilities

  • List the assets that drive risk (credentials, PII, integrity-critical state, availability-critical components, build artifacts).
  • Describe realistic attacker capabilities based on exposure and intended usage.
  • Explicitly note non-capabilities to avoid inflated severity.

4) Enumerate threats as abuse paths

  • Prefer attacker goals that map to assets and boundaries (exfiltration, privilege escalation, integrity compromise, denial of service).
  • Classify each threat and tie it to impacted assets.
  • Keep the number of threats small but high quality.

5) Prioritize with explicit likelihood and impact reasoning

  • Use qualitative likelihood and impact (low/medium/high) with short justifications.
  • Set overall priority (critical/high/medium/low) using likelihood x impact, adjusted for existing controls.
  • State which assumptions most influence the ranking.

6) Validate service context and assumptions with the user

  • Summarize key assumptions that materially affect threat ranking or scope, then ask the user to confirm or correct them.
  • Ask 1–3 targeted questions to resolve missing context (service owner and environment, scale/users, deployment model, authn/authz, internet exposure, data sensitivity, multi-tenancy).
  • Pause and wait for user feedback before producing the final report.
  • If the user declines or can’t answer, state which assumptions remain and how they influence priority.

7) Recommend mitigations and focus paths

  • Distinguish existing mitigations (with evidence) from recommended mitigations.
  • Tie mitigations to concrete locations (component, boundary, or entry point) and control types (authZ checks, input validation, schema enforcement, sandboxing, rate limits, secrets isolation, audit logging).
  • Prefer specific implementation hints over generic advice (e.g., "enforce schema at gateway for upload payloads" vs "validate inputs").
  • Base recommendations on validated user context; if assumptions remain unresolved, mark recommendations as conditional.

8) Run a quality check before finalizing

  • Confirm all discovered entrypoints are covered.
  • Confirm each trust boundary is represented in threats.
  • Confirm runtime vs CI/dev separation.
  • Confirm user clarifications (or explicit non-responses) are reflected.
  • Confirm assumptions and open questions are explicit.
  • Confirm that the format of the report matches closely the required output format defined in prompt template: references/prompt-template.md
  • Write the final Markdown to a file named -threat-model.md (use the basename of the repo root, or the in-scope directory if you were asked to model a subpath).

Risk prioritization guidance (illustrative, not exhaustive)

  • High: pre-auth RCE, auth bypass, cross-tenant access, sensitive data exfiltration, key or token theft, model or config integrity compromise, sandbox escape.
  • Medium: targeted DoS of critical components, partial data exposure, rate-limit bypass with measurable impact, log/metrics poisoning that affects detection.
  • Low: low-sensitivity info leaks, noisy DoS with easy mitigation, issues requiring unlikely preconditions.

References

  • Output contract and full prompt template: references/prompt-template.md
  • Optional controls/asset list: references/security-controls-and-assets.md

Only load the reference files you need. Keep the final result concise, grounded, and reviewable.

常见问题

什么时候应该触发?
仅在用户明确要求对代码库或某条路径做威胁建模、枚举威胁或滥用路径、或进行 AppSec 威胁建模时触发。通用架构总结、代码评审、非安全类设计工作都不触发。
最终输出是什么样的?
一份以仓库根目录或目标子目录命名的 Markdown 威胁建模文件,内容包括组件、信任边界、资产、入口点、带优先级的滥用路径威胁,以及与具体位置绑定的缓解措施,覆盖 authZ 检查、Schema 强制、沙箱化、速率限制、密钥隔离、审计日志等控制类型。
威胁优先级怎么定?哪些默认算高?
采用定性的可能性与影响(低/中/高)并附简短理由,叠加后得出总体优先级,再根据已有控制措施调整。预认证 RCE、认证绕过、跨租户访问、敏感数据外泄、密钥/令牌窃取、模型或配置完整性破坏、沙箱逃逸默认归为高优先级。

相关技能

通过 OAuth 认证网关管理 Stripe 客户、订阅、发票、产品、价格和支付。

720 次安装29 星标

为自然搜索排名提供站点审计、内容撰写与竞品分析。

用可量化的层级、间距、字号、配色与版式规则,绘制并诊断视觉作品。

作者 Iván137 次安装5 星标

通过托管 OAuth 代理访问 YouTube Data API v3,搜索与管理视频、播放列表、频道、订阅和评论。

873 次安装144 星标

通过 API 生成 AI 人像肖像,支持 140+ 国籍、8 种风格与 24 种情绪。

263 次安装12 星标

一条提示词生成最长 4 分钟的视频 —— 自动完成脚本、配音、配乐与剪辑。

299 次安装24 星标

OpenAI 的更多技能

浏览全部技能

hatch-pet

官方

从概念、品牌或参考图生成 Codex 兼容的宠物精灵动画图谱。

作者 OpenAI24.8k 星标

imagegen

官方

通过内置图像工具生成或编辑项目所需的位图素材,仅在用户明确要求时切换到 CLI 回退路径。

作者 OpenAI24.8k 星标

winui-app

官方

用官方 Windows App SDK 模板和内置安装流程引导、搭建并验证 WinUI 3 桌面应用。

作者 OpenAI24.8k 星标

通过 Code Connect 把 Figma 组件与代码组件对应起来,并扫描代码库寻找匹配的实现。

作者 OpenAI24.8k 星标

按既定流程把 Figma 设计稿转成项目代码,视觉与 Figma 1:1 对齐,并落到已有设计系统里。

作者 OpenAI24.8k 星标

从 API 文档、OpenAPI 规范、curl 示例、SDK 或 Web 应用生成可安装的持久 CLI。

作者 OpenAI24.8k 星标