fabiocicerchia/sbom-diff

GitHub: fabiocicerchia/sbom-diff

一个零依赖的 SBOM 差异比对工具,对比两份 CycloneDX/SPDX 格式的软件物料清单并生成适合 PR 审查的变更报告,支持作为 CI 门控阻断高风险依赖变更。

Stars: 0 | Forks: 0

# sbom-diff [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/fabiocicerchia/sbom-diff/actions/workflows/ci.yml) [![代码质量](https://static.pigsec.cn/wp-content/uploads/repos/cas/db/db1e53aa5ff561e1aca9c5269a3faa78557bcdb42c71b6065caf0a6bae75dc89.svg)](https://github.com/fabiocicerchia/sbom-diff/actions/workflows/code-quality.yml) [![安全性](https://static.pigsec.cn/wp-content/uploads/repos/cas/da/da1da17e1e766053da20ad0665cde2f045916d4fdf22a111832c2acc6c24a34e.svg)](https://github.com/fabiocicerchia/sbom-diff/actions/workflows/security.yml) [![许可证: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE) [![OpenSSF 记分卡](https://api.securityscorecards.dev/projects/github.com/fabiocicerchia/sbom-diff/badge)](https://securityscorecards.dev/viewer/?uri=github.com/fabiocicerchia/sbom-diff) [![FOSSA 状态](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ffabiocicerchia%2Fsbom-diff.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ffabiocicerchia%2Fsbom-diff?ref=badge_shield) [![发布](https://img.shields.io/github/v/release/fabiocicerchia/sbom-diff)](https://github.com/fabiocicerchia/sbom-diff/releases) 对比两个 SBOM(**CycloneDX 或 SPDX JSON**)并使用**自然语言** 解释依赖项的变化:优先展示主版本跳跃,标出许可证变更, 对新增/移除的依赖进行分组 —— 生成可直接粘贴到 PR 描述中的 markdown。 ``` $ sbom-diff old.json new.json # SBOM diff 5 dependency change(s): 1 added, 1 removed, 3 updated (1 major) ## ⚠ 主要版本跳跃(查看 breaking changes) - **openssl**: 3.0.1 → 4.0.0 ## ⚠ License 更改 - **openssl**: Apache-2.0 → GPL-3.0 ... ``` ## 功能 - 读取 CycloneDX **和** SPDX JSON,无需配置。 - 按严重程度对变更进行分组:优先显示主版本跳跃,其次是许可证变更, 然后是次版本/补丁版本以及新增/移除的依赖。 - 生成适用于 PR 的 markdown(使用 `--json` 供机器读取)。 - CI 门控:`--fail-on {any,major,license}` 可设置退出代码。 - 零运行时依赖(仅使用标准库)。 ## 安装 ``` curl -fsSL https://raw.githubusercontent.com/fabiocicerchia/sbom-diff/main/install.sh | bash ``` 或者直接使用 pipx: ``` pipx install . # from a checkout # 或者:pip install sbom-diff ``` ## 用法 ``` syft -o cyclonedx-json myapp:1.0 > old.json syft -o cyclonedx-json myapp:1.1 > new.json sbom-diff old.json new.json # human/markdown sbom-diff old.json new.json --json # machine-readable sbom-diff old.json new.json --fail-on license # CI gate: any | major | license ``` 与 `fabiocicerchia/security-scanner-toolbox`(包含 syft)搭配使用,可作为一个 扫描与对比的发布步骤。请参阅 [`examples/basic/`](examples/basic/) 获取 可运行的 SBOM 示例对。 ## 文档 完整文档位于 [`docs/`](docs/)。可运行的示例位于 [`examples/`](examples/)。 ## 安全 发现漏洞?请参阅 [SECURITY.md](SECURITY.md) —— 请勿创建公开的 issue。 ## 支持 在实施过程中需要帮助?[联系我们](https://fabiocicerchia.it/contact)。 ## 许可证 [Apache-2.0](LICENSE) © 2026 Fabio Cicerchia.
标签:CycloneDX, SBOM, SPDX, 依赖管理, 硬件无关, 软件供应链, 逆向工具