Interview Prep/DevSecOps/Supply chain: signing, SBOM and dependencies

SBOM generated in CI does not match what scanners find in the running image

IntermediateTroubleshootingSupply chain: signing, SBOM and dependencies
Answer

Likely causes → The SBOM came from source (syft dir:.) or the lockfile, not the built image; the image includes OS packages and build-time additions the source SBOM lacks, or the image was rebuilt after SBOM generation.

Diagnose →

syft ghcr.io/acme/api@sha256:... -o cyclonedx-json > image.cdx.json
jq -r '.components[] | "\(.name)@\(.version)"' sbom-ci.cdx.json | sort > a.txt
jq -r '.components[] | "\(.name)@\(.version)"' image.cdx.json | sort > b.txt
diff a.txt b.txt | head

Fix → Generate the SBOM from the final image digest and attach it as an attestation to that digest.

Prevent → One pipeline step: build → push → SBOM by digest → attest → sign, all keyed on the same digest.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Supply chain: signing, SBOM and dependencies