sbom-diff
diff engine and cli for sbom comparison.
compares two software bills of materials and reports added, removed, and changed components. supports both cyclonedx and spdx formats.
cli usage
# compare two sboms (auto-detects format)
# read old sbom from stdin
|
# markdown output for pr comments
# json output for tooling
# filter to specific fields
# license gating
exit codes
| code | meaning |
|---|---|
| 0 | success (diff computed, no license violations) |
| 1 | error (parse failure, file not found, etc.) |
| 2 | license violation (when using --deny-license or --allow-license) |
see the project readme for full cli documentation.
library usage
use the Differ struct directly to integrate into your own tools:
use ;
use Sbom;
renderers
built-in renderers for common output formats:
use ;
use stdout;
how matching works
components are matched in two passes:
- by id: components with the same
ComponentId(usually purl) are paired - by identity: unmatched components are reconciled by name + ecosystem
this allows detecting version bumps even when the purl changes (e.g., pkg:npm/foo@1.0 vs pkg:npm/foo@2.0).
related crates
sbom-model- the core data modelsbom-model-cyclonedx- cyclonedx parsersbom-model-spdx- spdx parser