cognis-digital/threatmodeler

GitHub: cognis-digital/threatmodeler

从 YAML 系统规范自动生成 STRIDE 威胁模型和攻击树,支持 CI/CD 集成与 AI 代理驱动的安全分析工具。

Stars: 0 | Forks: 0

THREATMODELER # THREATMODELER ### 从 YAML 系统规范生成 STRIDE 威胁模型和攻击树。 [![PyPI](https://img.shields.io/pypi/v/cognis-threatmodeler.svg?color=6b46c1)](https://pypi.org/project/cognis-threatmodeler/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/2fbb837a4a055521.svg)](https://github.com/cognis-digital/threatmodeler/actions) [![License: COCL 1.0](https://img.shields.io/badge/License-COCL%201.0-2b6cb0.svg)](LICENSE) [![Suite](https://img.shields.io/badge/Cognis-Neural%20Suite-6b46c1.svg)](https://github.com/cognis-digital) *Cognis Neural Suite 的一部分。*
``` pip install cognis-threatmodeler threatmodeler scan . # → prioritized findings in seconds ``` ## 用法 — 分步指南 1. **安装** CLI(控制台脚本 `threatmodeler`): pip install cognis-threatmodeler 2. **分析系统规范** — `analyze` 解析规范(使用 `-` 代表 stdin)并输出完整的 STRIDE 威胁模型: threatmodeler analyze system.yml 3. **首先验证规范** — `validate` 报告该规范格式是否正确(如果不正确则退出码为 `1`): threatmodeler validate system.yml 4. **查看输出 / 输出 JSON** — 模型按 ID、严重程度、STRIDE 类别和缓解措施标志列出威胁;导出 JSON 以用于仪表板: threatmodeler analyze system.yml --format json | jq '.summary' 5. **作为检查门实现自动化** — 使用 `--fail-on` 在出现指定严重程度或以上的未缓解威胁时使构建失败: - run: pip install cognis-threatmodeler - run: threatmodeler analyze system.yml --fail-on high ## 目录 - [为什么选择 threatmodeler?](#why) · [功能](#features) · [快速开始](#quick-start) · [示例](#example) · [架构](#architecture) · [AI stack](#ai-stack) · [对比](#how-it-compares) · [集成](#integrations) · [随处安装](#install-anywhere) · [相关工具](#related) · [贡献](#contributing) ## 为什么选择 threatmodeler? 从 YAML 系统规范生成 STRIDE 威胁模型和攻击树。 — 无需搭建繁重的基础设施。 `threatmodeler` 是单一用途、可脚本化且可自托管的:将其指向目标,以您的工作流已采用的格式(表格 · JSON · SARIF)获取优先级排序的结果,根据它设置 CI 拦截,并允许代理通过 MCP 驱动它。
↑ 回到顶部
## 功能 - ✅ 解析规范 - ✅ 构建威胁模型 - ✅ 构建攻击树 - ✅ 可在 Linux/macOS/Windows · Docker · devcontainer 上运行 - ✅ 提供 Python、JavaScript、Go 和 Rust 移植版本 (`ports/`)
↑ 回到顶部
## 快速开始 ``` pip install cognis-threatmodeler threatmodeler --version threatmodeler scan . # scan current project threatmodeler scan . --format json # machine-readable threatmodeler scan . --fail-on high # CI gate (non-zero exit) ```
↑ 回到顶部
## 示例 ``` $ threatmodeler scan . [HIGH ] THR-001 example finding (./src/app.py) [MEDIUM ] THR-002 another signal (./config.yaml) 2 findings · risk score 5 · 38ms ```
↑ 回到顶部
## 架构 ``` flowchart LR IN[input] --> P[threatmodeler
analyze + score] P --> OUT[report] ```
↑ 回到顶部
## 从任何 AI stack 中使用 `threatmodeler` 可以与每种流行的 AI 使用方式实现互操作: - **MCP 服务器** — `threatmodeler mcp` (Claude Desktop, Cursor, Cognis.Studio, [uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet)) - **兼容 OpenAI / JSON** — 将 `threatmodeler scan . --format json` 通过管道传递给任何代理或 LLM - **LangChain · CrewAI · AutoGen · LlamaIndex** — 用一行代码将 CLI/JSON 封装为工具 - **CI / 脚本** — 为非 AI pipeline 提供退出码 + SARIF
↑ 回到顶部
## 对比 | | **Cognis threatmodeler** | 典型工具 | |---|:---:|:---:| | 可自托管,无需账户 | ✅ | 视情况而定 | | 单一命令,零配置 | ✅ | ⚠️ | | 用于 CI 的 JSON + SARIF | ✅ | 视情况而定 | | MCP 原生 (AI 代理) | ✅ | ❌ | | 多语言移植 (JS/Go/Rust) | ✅ | ❌ | | 开放许可 | ✅ COCL | 视情况而定 |
↑ 回到顶部
## 集成 接入您的技术栈:用于代码扫描的 **SARIF**,用于任何场景的 **JSON**,用于 AI 代理的 **MCP 服务器** (`threatmodeler mcp`),以及用于 SIEM/Slack/Jira 的 webhook 转发器。请参见 [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md)。
↑ 回到顶部
## 安装 — 各种方式,各个平台 ``` pip install "git+https://github.com/cognis-digital/threatmodeler.git" # pip (works today) pipx install "git+https://github.com/cognis-digital/threatmodeler.git" # isolated CLI uv tool install "git+https://github.com/cognis-digital/threatmodeler.git" # uv pip install cognis-threatmodeler # PyPI (when published) docker run --rm ghcr.io/cognis-digital/threatmodeler:latest --help # Docker brew install cognis-digital/tap/threatmodeler # Homebrew tap curl -fsSL https://raw.githubusercontent.com/cognis-digital/threatmodeler/main/install.sh | sh ``` | Linux | macOS | Windows | Docker | 云平台 | |---|---|---|---|---| | `scripts/setup-linux.sh` | `scripts/setup-macos.sh` | `scripts/setup-windows.ps1` | `docker run ghcr.io/cognis-digital/threatmodeler` | [DEPLOY.md](docs/DEPLOY.md) (AWS/Azure/GCP/k8s) |
↑ 回到顶部
## 相关 Cognis 工具 **探索套件 →** [🗂️ 所有 170+ 工具](https://github.com/cognis-digital/cognis-neural-suite) · [⭐ awesome-cognis](https://github.com/cognis-digital/awesome-cognis) · [🔗 cognis-sources](https://github.com/cognis-digital/cognis-sources) · [🤖 uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet) · [🧠 engram](https://github.com/cognis-digital/engram)
↑ 回到顶部
## 互操作性 `{}` 与 300+ 工具的 Cognis 套件组合使用 — JSON 输入/输出以及共享的 兼容 OpenAI 的 `/v1` 主干。请参见 **[INTEROP.md](INTEROP.md)** 了解 套件图谱、组合模式和参考技术栈。 ## 许可证 在 **Cognis Open Collaboration License (COCL) v1.0** 下提供源代码 — 可免费用于个人、内部评估、研究和教育用途;**商业 / 生产用途需要许可证** (licensing@cognis.digital)。请参见 [LICENSE](LICENSE)。
Cognis Digital · Cognis Neural Suite 中 170+ 工具之一 · 让明天在今天更美好
标签:DevSecOps, STRIDE, 上游代理, 可视化界面, 威胁建模, 攻击树, 数据可视化, 日志审计, 自动化分析, 请求拦截, 跨站脚本, 逆向工具