batuhan-satilmis/threat-modeling-framework

GitHub: batuhan-satilmis/threat-modeling-framework

一个轻量级威胁建模框架,通过 YAML 威胁模型、STRIDE 工作表和 MITRE ATT&CK 映射,将 SaaS 功能的安全评审简化为 30 分钟的常规实践。

Stars: 0 | Forks: 0

# threat-modeling-framework [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/batuhan-satilmis/threat-modeling-framework/actions/workflows/ci.yml) [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE) ``` $ tmf render examples/saas-payment-flow.yaml --out PAYMENT-THREAT-MODEL.md Loaded threat model: SaaS Payment Flow (12 threats) Rendered to PAYMENT-THREAT-MODEL.md ``` ## 为什么使用 当产出物过于沉重而难以更新时,威胁建模就会失败。本仓库反对 Microsoft TMT 风格的巨型图表;相反,它以以下内容为标准化基础: - **STRIDE 工作表**(采用 Markdown 格式)。 - **YAML 威胁模型**,用于生成风险登记表。 - **MITRE ATT&CK** 技术 ID(在适用情况下标记于每个威胁)。 - **每个常见模式均提供示例**(认证、多租户、支付、数据导出、文件上传),从而确保新功能是基于相关模板启动,而非从空白页面开始。 ## 如何使用 1. 从 [`templates/`](./templates/) 中复制与你的功能模式相匹配的模板。 2. 与你的团队在一次 30 分钟的会议中共同填写。 3. 作为该功能 PR 的一部分,将其放入 [`examples/`](./examples/) 中。 4. 运行 `tmf render` 生成 Markdown 格式的风险登记表。 ## 本仓库包含的内容 ``` templates/ stride-worksheet.md Generic STRIDE worksheet pattern-auth-and-session.md Filled stub for auth/session features pattern-multi-tenant-saas.md Tenant isolation focus pattern-payment-flow.md Payment / billing focus pattern-data-export.md Data egress / DLP focus pattern-file-upload.md File / media handling focus pattern-ci-cd-pipeline.md CI/CD + supply-chain (T1195 / T1199) focus examples/ saas-payment-flow.yaml Example YAML threat model saas-payment-flow.md Rendered output (so reviewers can preview) mitre-mapping.md STRIDE → MITRE ATT&CK technique map src/tmf/ cli.py argparse entry: render, lint, ids model.py Pydantic-style schema for YAML threat models render.py Markdown risk-register renderer ids.py Validate MITRE technique IDs tests/ ``` ## YAML schema(节选) ``` title: SaaS Payment Flow scope: Subscribe / cancel / refund flows backed by Stripe trust_boundaries: - name: TB1 crosses: Anonymous internet → Vercel edge trust: none - name: TB4 crosses: Stripe → API webhooks trust: signed events only threats: - id: T-001 stride: spoofing title: Forged webhook events description: An attacker without signing-secret access POSTs a fake event. severity: high mitre: [T1190] mitigation: Verify Stripe-Signature header on every event. status: implemented - id: T-002 stride: tampering title: Race two concurrent /subscribe requests severity: medium mitre: [T1078] mitigation: Idempotency keys + DB unique constraint. status: implemented ``` ## 关联仓库 - 🛡️ [forsman-crm-showcase](https://github.com/batuhan-satilmis/forsman-crm-showcase) — 包含一份完整的威胁模型作为其文档之一。 - 📚 [owasp-saas-hardening-guide](https://github.com/batuhan-satilmis/owasp-saas-hardening-guide) — 缓解措施中引用的控制项。 ## License MIT
标签:Python, SaaS, STRIDE, 威胁建模, 安全架构, 文档工具, 无后门, 逆向工具, 防御加固