kbcasurf/owasp-samm-toolkit

GitHub: kbcasurf/owasp-samm-toolkit

该工具包基于 OWASP SAMM v2 模型,帮助安全团队评估、评分并生成包含差距分析与改进路线图的软件安全成熟度报告。

Stars: 0 | Forks: 0

# owasp-samm-toolkit [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/kbcasurf/owasp-samm-toolkit/actions/workflows/ci.yml) ## 演示内容 以**SAMM 评估**的实际运作方式来运行 AppSec 项目 —— 不仅仅是 操作扫描器,而是**衡量成熟度、设定目标,并生成可执行的** **路线图**。它对完整的 SAMM v2 结构进行了建模: - **5 项业务功能** → **15 项安全实践** → **每项 2 条流** → **3 个成熟度级别** - 答案是针对每个实践/流/级别的分数比例 (`0 / 0.25 / 0.5 / 0.75 / 1.0`) - 分数逐级汇总:流 → 实践 → 业务功能 → 总体得分(全部基于 0–3 的等级标准) - **目标配置文件** 用于驱动差距分析和排名优先的路线图 无繁重依赖 —— 纯 Python + PyYAML。雷达图是手动构建的 **SVG**(无需 matplotlib),因此输出可以在 GitHub 上完美嵌入。 ## 安装 要求 **Python 3.9+**。 ``` pip install -e . # exposes the `samm-tool` command # 或者无需安装直接运行: python -m samm_tool --help ``` ## 用法 ``` # 1. 创建一个空白的 assessment(+ 一个 target profile) samm-tool init -o assessment.yaml --target target.yaml --target-level 2.0 # 2. 填写 assessment.yaml,然后查看 scores samm-tool score assessment.yaml # 3. 获取已确定优先级的 improvement roadmap samm-tool roadmap assessment.yaml --target target.yaml # 4. 生成 Markdown 报告 + SVG radar samm-tool report assessment.yaml --target target.yaml --outdir reports ``` ## 示例 完整的虚构评估示例位于 [`examples/`](examples/) 中;生成的 输出已提交至 [`reports/`](reports/): - 📊 [`reports/report.md`](reports/report.md) — 完整报告 - 🕸️ [`reports/radar.svg`](reports/radar.svg) — 成熟度雷达图(当前 vs 目标) 使用以下命令重新生成: ``` samm-tool report examples/example-assessment.yaml \ --target examples/target-profile.yaml --outdir reports ``` ## 评估格式 ``` meta: organization: Acme FinTech assessor: Jane Doe date: 2026-07-20 answers: SM: {A: {1: 1.0, 2: 0.25, 3: 0.0}, B: {1: 0.5, 2: 0.25, 3: 0.0}} # ... all 15 practice codes (SM PC EG TA SR SA SB SD DM AA RT ST IM EM OM) ``` ## 目标配置文件格式 `roadmap` 和 `report` 命令接受一个可选的 `--target` 配置文件:即 基于 0–3 等级标准的各项实践成熟度目标。使用 `init --target` 生成一个,或者手动编写 —— 任何省略的实践都会默认回退到 `--target-level`(默认值为 `2.0`)。 ``` targets: SM: 2.0 SB: 3.0 # aim higher where the team is strong EG: 1.5 # pragmatic floor for lower-priority practices # ... any of the 15 practice codes; omitted ones use --target-level ``` ## 评分模型 | 级别 | 公式 | 范围 | |---|---|---| | 流 | 其 3 个级别分数之和 | 0.0–3.0 | | 实践 | 流 A 和 B 的平均值 | 0.0–3.0 | | 业务功能 | 其 3 项实践的平均值 | 0.0–3.0 | | 总体 | 所有 15 项实践的平均值 | 0.0–3.0 | ## 开发 ``` pip install -e ".[dev]" pytest -q ruff check . ``` ## 鸣谢 SAMM 模型文本总结自 **OWASP SAMM v2** 项目 (CC BY-SA 4.0)。参见 [`NOTICE`](NOTICE)。本工具包的代码基于 MIT 许可证授权 (参见 [`LICENSE`](LICENSE)),并且是一个独立的、非官方的辅助工具 —— 而非 官方 OWASP 发布版本。
标签:DevSecOps, OWASP SAMM, Python, 上游代理, 反取证, 安全成熟度模型, 安全评估, 恶意代码分类, 无后门, 软件供应链安全, 远程方法调用, 逆向工具, 防御加固