⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All CI/CD & GitOps Interview Questions Scenario 55 of 187 in CI/CD & GitOps
Senior DevOps / SRE [L2] CI/CD Additional CI/CD Scenarios Production Scenario [L2]
🎯 Target Role / Context: CI/CD Scenario #46 (L2) · Additional CI/CD Scenarios

Q: What is SBOM and why does your CI pipeline need to generate one?

An SBOM in your CI pipeline is a machine-readable inventory (a software bill of materials) of every package and library inside a build artifact.

#CI/CD #Additional CI/CD Scenarios #L2 #DevOps #Automation #Pipelines
🎙️ Candidate Opening & Architectural Context
"An <strong>SBOM in your CI pipeline</strong> is a machine-readable inventory (a software bill of materials) of every package and library inside a build artifact. Generating it on each build gives you provenance and lets you answer "are we affected?" within minutes when a new vulnerability is published, instead of re-scanning old images. Interviewers ask this to test supply chain security awareness: format choice (CycloneDX or SPDX), where the SBOM is generated, how it is stored with the image, and how it is used to gate releases."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's Enterprise GitOps with ArgoCD & Kubernetes Rollouts covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: An <strong>SBOM in your CI pipeline</strong> is a machine-readable inventory (a software bill of materials) of every package and library inside a build artifact. Generating it on each build gives you provenance and lets you answer "are we affected?" within minutes when a new vulnerability is published, instead of re-scanning old images. Interviewers ask this to test supply chain security awareness: format choice (CycloneDX or SPDX), where the SBOM is generated, how it is stored with the image, and how it is used to gate releases.

1️⃣

What an SBOM is and why CI should produce it

The SBOM is evidence tied to a specific build.

  • Content: package names, versions, licenses, hashes and dependency relationships, for OS packages and language dependencies.
  • Formats: CycloneDX and SPDX are the two common standards; most scanners read both.
  • Incident response: when a new CVE appears, search stored SBOMs instead of pulling and scanning every old image.
  • Compliance: customers and auditors increasingly request SBOMs and license data per release.
2️⃣

Generating the SBOM from the built image

Scan the final artifact, not just the source tree, so base image packages are included.

# Generate from the pushed image
syft registry.example.com/my-app:1.4.2 -o cyclonedx-json=sbom.cdx.json

# Or let BuildKit attach it during build
docker buildx build --sbom=true --push -t registry.example.com/my-app:1.4.2 .

# Quick sanity check: component count
jq '.components | length' sbom.cdx.json
  • Syft: catalogues an image, directory or archive and emits CycloneDX or SPDX JSON.
  • BuildKit attestation: docker buildx build --sbom=true attaches an SBOM attestation to the pushed image.
  • Pin by digest: record the image digest in the SBOM metadata so the file maps to one exact artifact.
  • Artifact upload: keep the SBOM as a build artifact even if it is also attached to the registry.
Advertisement
3️⃣

Scanning the SBOM and gating the pipeline

Use the SBOM as input to vulnerability and license checks.

grype sbom:sbom.cdx.json --fail-on high
trivy sbom sbom.cdx.json --severity HIGH,CRITICAL --exit-code 1
  • Grype: scans an SBOM directly and can fail the build above a severity threshold.
  • Trivy: trivy sbom scans an existing SBOM file.
  • Policy: fail on fixable high or critical findings, allow documented exceptions with expiry.
  • Rescan later: run the same scan on a schedule, because new CVEs affect old SBOMs.
Pro Tip: A clean scan today is not permanent: re-scan stored SBOMs on a schedule so newly disclosed vulnerabilities in already shipped releases are found.
4️⃣

Attaching and signing the SBOM

An unsigned file next to an image proves little.

cosign attest --yes --key cosign.key --type cyclonedx \
  --predicate sbom.cdx.json registry.example.com/my-app@sha256:<digest>

cosign verify-attestation --key cosign.pub --type cyclonedx \
  registry.example.com/my-app@sha256:<digest>

# GitHub Actions
- uses: anchore/sbom-action@v0
  with:
    image: registry.example.com/my-app:1.4.2
    format: cyclonedx-json
    output-file: sbom.cdx.json
  • cosign attest: binds the SBOM to the image digest as a signed in-toto attestation stored in the registry.
  • Verification: consumers or admission controllers verify the attestation before deployment.
  • Retention: keep SBOMs for as long as the release is supported.
  • Workflow example: a GitHub Actions step produces and uploads the file for every build.
5️⃣

Limits and production practice

An SBOM is inventory, not proof of safety.

  • Accuracy limits: statically linked binaries or vendored code can be missed; compare tools when completeness matters.
  • Vulnerability context: combine with VEX statements to mark findings as not exploitable.
  • Admission control: enforce signed attestations with Kyverno or Sigstore policy-controller.
  • Reproducibility: generate in the same pipeline run that builds, never later from a mutable tag.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Generate the SBOM from the pushed image digest, sign it with cosign attest, and re-scan stored SBOMs nightly so new CVEs in old releases are caught without rebuilding."
⚡ 60-Second Elevator Pitch Talking Points
  • An SBOM is a machine-readable list of all components in a build, in CycloneDX or SPDX format, generated per build in CI.
  • I generate it from the final image digest with Syft or BuildKit, then validate it by scanning with Grype or Trivy.
  • I sign and attach it with cosign, fail the pipeline on fixable high findings, and re-scan stored SBOMs on a schedule.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Generating the SBOM from source manifests only It misses OS packages from the base image, so scans under-report real exposure.
  2. Referencing the image by a mutable tag The SBOM may describe a different artifact than what is deployed; use the digest.
  3. Generating an SBOM but never storing or scanning it again The value is in looking up affected releases later when new CVEs are published.
  4. Shipping the SBOM unsigned Without an attestation bound to the digest nobody can trust it was produced by your pipeline.
Advertisement
Want more CI/CD & GitOps scenarios?
Explore our complete collection of scenario-based CI/CD & GitOps interview runbooks.
Browse All CI/CD & GitOps Questions →