Generate a CycloneDX and SPDX SBOM from a container image using Syft, then diff two SBOMs from successive builds to detect component drift

domain: security/compliance · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Run syft <image-reference> -o cyclonedx-json=sbom-v1.cdx.json to generate a CycloneDX SBOM; repeat with -o spdx-json=sbom-v1.spdx.json for an SPDX output from the same image.
  2. Build or pull the successor image, run syft again to produce sbom-v2.cdx.json, ensuring both SBOMs use the same format for comparison.
  3. Use a diff tool such as cyclonedx-cli diff (verify the exact subcommand in current docs) or a JSON diff utility to compare component arrays across the two CycloneDX SBOMs and surface added, removed, or version-changed packages.
  4. Correlate the diffed component changes with a vulnerability database by running grype on the diff output or on the newer SBOM to identify if newly added packages introduce vulnerabilities.
  5. Fail the CI pipeline if unexpected components are added or if components cross a vulnerability severity threshold.

Known gotchas

Related routes

Generate a CycloneDX or SPDX SBOM from a container image using Syft
github.com/anchore/syft · 6 steps · unrated
Diff two SBOMs across releases to detect component drift using cdxgen or sbom-tool
cyclonedx.org · 5 steps · unrated
Generate a CycloneDX SBOM for a filesystem or source tree using Syft
anchore.com/syft · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans