Interview Prep/CI/CD/Supply Chain and Pipeline Security

What is an SBOM and why do you generate one in CI?

BeginnerProductionSupply Chain and Pipeline Security
Answer

A Software Bill of Materials lists the components (libraries, versions, licences) in an artifact, in a standard format: CycloneDX or SPDX. With it you can answer "are we affected by CVE-X?" in minutes. Generate it at build time from the actual artifact and publish it with the image.

syft ghcr.io/acme/shop-api:1.7.0 -o cyclonedx-json > sbom.cdx.json
trivy image --format cyclonedx --output sbom.cdx.json ghcr.io/acme/shop-api:1.7.0
grype sbom:./sbom.cdx.json --fail-on high
All CI/CD questions

More on Supply Chain and Pipeline Security