Software Bill of Materials (SBOM) Generation (syft, docker sbom)
Generate SBOMs so you know exactly which packages ship in each image.
In plain words
Generate an inventory in the release job so vulnerability correlation, licensing and incident response refer to what was actually shipped.
Think of it like…
The SBOM is the bill of materials in the shipped machine’s serial folder: it names parts and supplier versions even when no recall has been announced.
Where you’ve seen it
In practice, syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.json is the concrete move for this job: generate SBOMs so you know exactly which packages ship in each image. The release is not accepted until jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow confirms the result.
Words you’ll hear
- SBOM
- The implementation control in
syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.jsonfor generate SBOMs so you know exactly which packages ship in each image. - syft
- The result to observe with
jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow, rather than infer from a successful command alone. - Inventory
- The production boundary exposed when making an SBOM for source files and attaching it to a different rebuilt image digest, or storing it with no retention and signer identity.
Visual diagram
Theory & deep dive
SBOM control path
The concrete mechanism is syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.json. The observable result is jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow; if those disagree, inspect the runtime evidence before changing unrelated settings.
Generate SBOMs so you know exactly which packages ship in each image. Keep SBOM, syft and Inventory in the same deployment record so the intent and the observed state cannot drift apart.
syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.json
jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow, not with command success alone.Inventory failure boundary
A scan result is not an SBOM, and an application manifest is not enough to account for base-image packages. Directory source inventories and final image inventories differ; generated SBOMs can also omit packages from unsupported or unpackaged binaries. The narrow failure to design for is making an SBOM for source files and attaching it to a different rebuilt image digest, or storing it with no retention and signer identity.
Accept this compromise explicitly: SPDX is broad for tooling/legal use; CycloneDX is rich for software security, and signed attestations prevent silent substitution. The controlled check-jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow-also identifies the point where a different design is safer.
Exercise this failure safely: making an SBOM for source files and attaching it to a different rebuilt image digest, or storing it with no retention and signer identity.
How it works, step by step
Step 1 of 41. State the boundary
Write down why the workload needs this: A scan result is not an SBOM, and an application manifest is not enough to account for base-image packages. Directory source inventories and final image inventories differ; generated SBOMs can also omit packages from unsupported or unpackaged binaries.
- Intent
- SBOM
When to use it & trade-offs
What it is
An SBOM records package and file/component relationships from an image. syft or Docker tooling can emit SPDX/CycloneDX JSON for operating-system packages, language dependencies and nested archives, and the artifact should be tied to the exact image digest.
Why it matters: A scan result is not an SBOM, and an application manifest is not enough to account for base-image packages. Directory source inventories and final image inventories differ; generated SBOMs can also omit packages from unsupported or unpackaged binaries.
When to reach for it
- The fit is strongest for this job: generate SBOMs so you know exactly which packages ship in each image. Pair it with
jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflowin the runbook. - Production SBOM changes should make syft observable through
syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.json, rather than trusting the runtime default. - Keep a rollback example for the case where making an SBOM for source files and attaching it to a different rebuilt image digest, or storing it with no retention and signer identity.
When to avoid or be careful
- Do not accept command success while the system can still fail by making an SBOM for source files and attaching it to a different rebuilt image digest, or storing it with no retention and signer identity.
- Avoid erasing Inventory protection merely to dodge this cost: “SPDX is broad for tooling/legal use; CycloneDX is rich for software security, and signed attestations prevent silent substitution”.
- Do not replace the evidence path-
jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow-with a screenshot or a mutable tag.
syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.json: practical choices
Strengths: An SBOM records package and file/component relationships from an image. syft or Docker tooling can emit SPDX/CycloneDX JSON for operating-system packages, language dependencies and nested archives, and the artifact should be tied to the exact image digest.
Watch out: SPDX is broad for tooling/legal use; CycloneDX is rich for software security, and signed attestations prevent silent substitution.
Strengths: It can begin with syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.json and fewer surrounding controls.
Watch out: It silently accepts making an SBOM for source files and attaching it to a different rebuilt image digest, or storing it with no retention and signer identity, which makes the result hard to reproduce after promotion.
Strengths: A scan result is not an SBOM, and an application manifest is not enough to account for base-image packages. Directory source inventories and final image inventories differ; generated SBOMs can also omit packages from unsupported or unpackaged binaries.
Watch out: The platform adds an ownership and debugging layer; retain jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow as the direct check.
Interview signals & numbers to know
When this topic comes up
- syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.json
- jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow
- Failure signature: making an SBOM for source files and attaching it to a different rebuilt image digest, or storing it with no retention and signer identity
- Trade-off: SPDX is broad for tooling/legal use; CycloneDX is rich for software security, and signed attestations prevent silent substitution.
Benchmarks & rules of thumb
- 2 common formats
- SPDX and CycloneDX
- 1 exact digest
- the SBOM inventory must reference
- 0 interpretation
- SBOM presence does not itself fix a vulnerability
Common mistakes & follow-ups
Common interview mistakes
- Treating a successful
syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.jsonas proof and skippingjq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow. - Making an SBOM for source files and attaching it to a different rebuilt image digest, or storing it with no retention and signer identity
- Optimizing SBOM without accepting that sPDX is broad for tooling/legal use; CycloneDX is rich for software security, and signed attestations prevent silent substitution.
Likely interviewer follow-ups
- Why does
syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.jsonaddress SBOM here rather than through application code? - How would you distinguish healthy syft from the failure “making an SBOM for source files and attaching it to a different rebuilt image digest, or storing it with no retention and signer identity” using
jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow? - When would this trade-off-“SPDX is broad for tooling/legal use; CycloneDX is rich for software security, and signed attestations prevent silent substitution”-justify a different Inventory design?
syft packages ghcr.io/acme/api@sha256:deadbeef -o spdx-json=api.spdx.json; cosign attest --type spdx api@sha256:deadbeef --predicate api.spdx.json-and one proof-jq SPDXID/api package count and attest/verify the digest binding in a fresh consumer workflow. Then name the boundary: making an SBOM for source files and attaching it to a different rebuilt image digest, or storing it with no retention and signer identity.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Software Bill of Materials (SBOM) Generation (syft, docker sbom) with generative AI interview Q&A and hands-on practice.