Skip to content

SBOMs

A software bill of materials (SBOM) is the ingredient list of an image: every OS package, Go module and npm package in it, with its version and package URL (purl). With an SBOM you can answer “are we affected?” for a new CVE without rebuilding or even pulling the image.

Every hardened release produces SBOMs in the SPDX JSON format, in two places:

SBOMGenerated byWhere it is keptUse it for
Registry SBOMBuildKit, while publishing (sbom: true)In GHCR, attached to the image as an attestation for each platform, next to SLSA provenanceDownloading the SBOM of any released image by tag or digest
Release evidence SBOMTrivy (format: spdx-json) on the final imageimage.spdx.json in the release workflow’s artifactsThe SBOM the release gate checked, with the scan reports beside it
Browser dependency SBOMTrivy on the JavaScript inventory extracted from the imagebrowser.spdx.json, frontend releases onlyPackages bundled into the web app, which an image scan cannot see

The SBOM must be complete

An SBOM that misses a package also hides that package’s CVEs. So the release does not just generate an SBOM, it checks it.

For images with an Alpine or Wolfi package database, the workflow reads the packages that are actually installed (/lib/apk/db/installed) and compares three lists, by name and version:

installed packages in the image
  == packages the Trivy vulnerability scan saw
  == packages in the SPDX SBOM

If any list differs, the release fails. A package the scanner missed can’t slip through as “no vulnerabilities”. The comparison files are kept with the release evidence under runtime-evidence/.

The hardening attestation records this check as sbom-package-inventory-match; see The hardening attestation.

Provenance

Next to the SBOM, BuildKit attaches SLSA provenance (provenance: mode=max, predicate https://slsa.dev/provenance/v1). It records how the image was built: the source repository and revision, the Dockerfile, build arguments and the base images used.

Both are attestation manifests in the image’s manifest list. The keyless signature is made over that manifest list, and the list references each attestation by digest, so changing an SBOM would break the signature.

Download an SBOM

From the registry, by tag or digest:

IMAGE=ghcr.io/uug-ai/hub-frontend:v1.19.56

# SPDX SBOM, one per platform
docker buildx imagetools inspect "$IMAGE" --format '{{ json .SBOM }}' > sbom.json

# SLSA provenance
docker buildx imagetools inspect "$IMAGE" --format '{{ json .Provenance }}' > provenance.json

From the release workflow: open the Bump release run for the tag under Actions and download the *-image-amd64 or *-image-arm64 artifact. It contains image.spdx.json, the Trivy reports (image-security.json, published-image-security.json), the image digest and the base images.

Rescan an SBOM

An SBOM can be scanned against today’s vulnerability database at any time, without pulling the image:

trivy sbom image.spdx.json --severity MEDIUM,HIGH,CRITICAL

This answers “does a CVE published after release affect this version?” for versions that no longer run anywhere, for example a customer installation that has not been upgraded yet. For images that do run in our clusters, Trivy Operator does this every day.

Limits

  • Only hardened releases get SBOMs. A standard build is not scanned at release and has no SBOM or provenance.
  • The completeness check applies to images with an APK package database. Distroless and scratch images without a package database rely on Trivy’s analysis of the Go binaries and files in the image.
  • Workflow artifacts follow the repository’s artifact retention. The registry SBOM stays as long as the image does.