Lesson 5 of 9 · 26m
SBOM Generation That Is Actually Useful
Generate accurate SPDX or CycloneDX inventories from builds and images, understand their blind spots, and make them operationally actionable.
Most SBOM programs fail quietly because the inventory is produced once, uploaded somewhere, and never reconciled with reality. An SBOM is not a compliance artifact. It is a queryable inventory of what you shipped. When the next openssl or xz emergency arrives, it answers: where are we exposed, in which released artifacts, and how fast can we patch?
Generate from the thing you ship
Source-only SBOMs miss dependencies introduced by build tooling, vendoring, base images, and package transformations. Generate at the artifact boundary:
syft ghcr.io/acme/payments-api@sha256:3b8f4e4d... -o cyclonedx-json=sbom.cdx.json
syft ghcr.io/acme/payments-api@sha256:3b8f4e4d... -o spdx-json=sbom.spdx.jsonFor compiled applications, scan the final image or archive. For interpreted applications, include lockfiles and installed package directories. The goal is not theoretical completeness; it is correspondence with shipped bytes.
CycloneDX and SPDX emphasize different consumers
CycloneDX is common in security workflows and vulnerability matching. SPDX is common in licensing and broader software composition exchange. A serious program can emit both from the same scan, but do not pretend format conversion fixes missing data.
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"metadata": {
"component": {
"type": "container",
"name": "ghcr.io/acme/payments-api",
"version": "sha256:3b8f4e4d"
}
},
"components": []
}The subject identity must be exact. An SBOM labeled latest becomes useless the moment latest moves.
Attach and sign the SBOM
The SBOM itself is artifact metadata and can be tampered with. Attach it as a signed attestation:
cosign attest --yes --predicate sbom.cdx.json --type cyclonedx ghcr.io/acme/payments-api@sha256:3b8f4e4d...Now a consumer can prove that the inventory was produced or approved by the release workflow and belongs to that digest.
Expect blind spots
Package scanners infer composition. They can miss statically linked libraries, patched binaries, embedded assets, generated code, and dependencies copied without package metadata. If a critical component is statically linked, teach the build to emit explicit SBOM entries rather than hoping the scanner guesses correctly.
Make it operational
An SBOM earns its keep when you can ask:
Which released artifacts contain log4j-core 2.14.1?
Which production namespaces are running those digests?
Which customers received artifacts containing openssl 3.0.7?
Which SBOM component came from a dependency no longer in the lockfile?That means storing SBOMs indexed by artifact digest, version, environment, and release channel. A folder of JSON files is not an inventory system.
Field notes
- Do not expose internal SBOMs publicly if they reveal sensitive internal package names or infrastructure detail without a business reason.
- Vulnerability matches are noisy because distribution patches often fix code without changing upstream version strings.
- Scan base images separately and track their ownership; otherwise every application inherits an invisible operating system.
- Keep the scanner version in metadata. SBOM differences can come from tool improvements rather than dependency changes.
- Treat SBOM generation failure as a release failure for artifacts that promise one.
Was this lesson helpful?