Skip to content

feat: Add a daily check of the SBOM quality of the 0.0.0-dev images - #1756

Merged
dervoeti merged 15 commits into
mainfrom
feat/sbom-quality-check
Nov 24, 2026
Merged

dervoeti merged 15 commits into
mainfrom
feat/sbom-quality-check

Conversation

@dervoeti

Copy link
Copy Markdown
Member

Description

Part of stackabletech/issues#822

Adds sbom-quality (rust/sbom-quality), a tool that checks the SBOMs attested to our published images, and a workflow that runs it daily against the 0.0.0-dev images. The goal is to notice within a day when a change makes our SBOMs worse instead of at the next manual audit.

For every product version and operator, both architectures, it fetches the CycloneDX and SPDX SBOMs and checks:

  • Invariants for every SBOM: it describes exactly this image digest, the metadata is complete, every component is identifiable, every component is reachable in the dependency graph, the CycloneDX document is valid according to cyclonedx-bom, licenses are valid SPDX expressions, both documents list the same packages and both architectures list the same components.
  • Expectations per product from rust/sbom-quality/expectations.toml: the product itself is listed in the version of the image, components come from each build-time SBOM the image should contain, and there are at least so many components in total, per ecosystem and per ecosystem from build-time SBOMs. The floors are 20% below the current counts and can be regenerated with cargo sbom-quality --suggest-floors.

A new product without expectations fails the check, so it cannot be forgotten.

The workflow runs at 07:30 UTC, after the scheduled image builds, and fails if there is an error finding.
It does not notify anyone, the status of the latest run is meant to be watched from outside. The summary page shows the findings grouped per check, the log has every finding with every affected image.

Note

The check expects the SBOMs that publish-image writes once stackabletech/actions#153 and stackabletech/actions#154 are in use (CycloneDX 1.7, finalized by mergebom). Until they are merged and released and the images are rebuilt, every image fails the format checks and the workflow stays red.

Run it locally from the repository root (needs crane and cosign):

cargo sbom-quality --cache-dir /tmp/sboms
cargo sbom-quality kafka=4.3.1 --arch amd64 --verbose

rust/sbom-quality/README.md explains what is checked and why, and how to update the expectations.

Definition of Done Checklist

Note

Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant.

Please make sure all these things are done and tick the boxes

  • Changes are OpenShift compatible
  • All added packages (via microdnf or otherwise) have a comment on why they are added
  • Things not downloaded from Red Hat repositories should be mirrored in the Stackable repository and downloaded from there
  • All packages should have (if available) signatures/hashes verified
  • Add an entry to the CHANGELOG.md file
  • Integration tests ran successfully
TIP: Running integration tests with a new product image

The image can be built and uploaded to the kind cluster with the following commands:

boil build <IMAGE> --image-version <RELEASE_VERSION> --strip-architecture --load
kind load docker-image <MANIFEST_URI> --name=<name-of-your-test-cluster>

See the output of boil to retrieve the image manifest URI for <MANIFEST_URI>.

@dervoeti
dervoeti force-pushed the feat/sbom-quality-check branch from 4787630 to cd62f92 Compare November 24, 2026 07:25
@dervoeti dervoeti moved this to Development: Waiting for Review in Stackable Engineering Nov 24, 2026
@dervoeti dervoeti self-assigned this Nov 24, 2026
dervoeti and others added 2 commits November 24, 2026 08:17
Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com>
Comment thread rust/sbom-quality/src/check/mod.rs Resolved
@NickLarsenNZ NickLarsenNZ moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Nov 24, 2026
Comment thread rust/sbom-quality/src/check/spdx.rs Resolved
dervoeti and others added 2 commits November 24, 2026 11:09
Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com>

@NickLarsenNZ NickLarsenNZ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in general, I think we should convert external input (strings) into valid types (with no pub fields to bypass construction rules) as soon as possible, then work with those valid types.

Not a huge deal for a small utility app, but a good habit nonetheless.

Comment thread rust/sbom-quality/src/check/spdx.rs Resolved
Comment thread rust/sbom-quality/src/check/spdx.rs Resolved
Comment thread rust/sbom-quality/src/main.rs Resolved
Comment thread rust/sbom-quality/src/purl.rs Resolved
Comment thread rust/sbom-quality/src/purl.rs Resolved
Comment thread rust/sbom-quality/src/registry.rs Resolved
Comment thread rust/sbom-quality/src/report.rs Resolved
Comment thread rust/sbom-quality/src/report.rs Resolved
Comment thread rust/sbom-quality/src/report.rs Resolved
Comment thread rust/sbom-quality/src/sbom.rs Resolved
@dervoeti

Copy link
Copy Markdown
Member Author

Just in general, I think we should convert external input (strings) into valid types (with no pub fields to bypass construction rules) as soon as possible, then work with those valid types.

Not a huge deal for a small utility app, but a good habit nonetheless.

Agree in general, it can sometimes make the code slightly harder to read IMO (see 75ce2f8 for example). For libraries I'd do it, for binaries... no strong opinion, fine with both.

@NickLarsenNZ

Copy link
Copy Markdown
Member

Agree in general, it can sometimes make the code slightly harder to read IMO (see 75ce2f8 for example). For libraries I'd do it, for binaries... no strong opinion, fine with both.

Yeah I understand, and it is less important. But I do think as code changes over time, this loseness can bite. It's where bugs come from. We should use the advantages of Rust.

@dervoeti
dervoeti added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit d9ba026 Nov 24, 2026
13 checks passed
@dervoeti
dervoeti deleted the feat/sbom-quality-check branch November 24, 2026 17:23
@dervoeti dervoeti moved this from Development: In Review to Development: Done in Stackable Engineering Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: Done

Development

Successfully merging this pull request may close these issues.

2 participants