Stop collecting SBOMs. Start diffing them.
An SBOM nobody reads is just a compliance artifact. The diff between two releases is where the signal is.
Most teams I talk to generate an SBOM on every build and store it somewhere. Then nobody looks at it again until an auditor asks.
The single SBOM isn’t very useful. A list of eight hundred components tells a reviewer almost nothing. The difference between this release and the last one is useful, because it answers the questions that matter during review:
- What new components came in?
- Did any license change?
- Did a transitive dependency jump a major version without anyone asking?
- Is anything new on a known-vulnerable list?
- Did a component change publisher or source repository?
That last question catches the quiet supply chain attacks: a package taken over by a new maintainer, or a name that resolves to a different registry than it used to.
Diff on identity, not on names
A naive text diff of two SBOMs is noise. Field order changes, timestamps change, and the same component can appear under two spellings. Compare on the package URL (purl) with the version split out, so that pkg:npm/left-pad@1.3.0 becomes “left-pad, 1.2.0 to 1.3.0” and not one removal plus one addition. Keep the hashes. If the version stayed the same and the hash changed, someone republished a release, and you want to know why.
Make the diff a gate
I run the diff as a CI job that posts a short report to the merge request and fails on policy hits. A new dependency then needs a human to approve it, the same way new code does.
sbom-diff:
stage: verify
script:
- sbom-diff --base sbom/main.cdx.json --head sbom/current.cdx.json --policy policy.yml --report diff.md
artifacts:
paths: [diff.md]
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
The policy file stays short. Mine fails the job on four things: a new license outside the allow list, a new component with a known exploited vulnerability, a hash change on an unchanged version, and a direct dependency added without an owner listed in the code owners file. Everything else is reported but doesn’t block.
Keep the noise down
A gate that fires on every merge request gets switched off within a month. Two habits keep this one alive:
- Diff against the SBOM of the target branch, not the last tagged release, so each merge request only shows its own changes.
- Collapse purely transitive patch updates into one summary line. Reviewers read the top of the report and skip the rest.
Where this lands in the standards
NIST SP 800-218 asks you to collect and protect provenance data for every release, an SBOM included (PS.3.2), and to vet the components you reuse (PW.4). The DoD DevSecOps Reference Design puts software composition analysis in the pipeline for the same reason. Diffing is the cheapest way I know to do that every day instead of once a year.