Repository navigation
✨ feat(release): publish SBOMs as release assets - #3299
Merged
Merged
Conversation
gaborbernat
force-pushed
the
feat/release-sbom-assets
branch
from
September 22, 2026 23:40
4fe1d1d to
a64f2a4
Compare
This was referenced Sep 22, 2026
gaborbernat
force-pushed
the
feat/release-sbom-assets
branch
from
September 22, 2026 23:58
a64f2a4 to
09b7b46
Compare
The CycloneDX SBOM only reached users inside the wheel or as a workflow artifact that expires. Scanners that read SPDX had nothing. Render the embedded CycloneDX document as SPDX 2.3 with the standard library, validate the result with spdx-tools in the tooling envs, attest it against the sdist and wheel, and attach both files in the single gh release create call that immutable releases require. The verify job downloads both assets and checks them against the wheel and the attestations. spdx-tools imports beartype, which fails on Python 3.15, so it stays out of the test dependencies and the readme and spdx envs pin 3.14.
gaborbernat
force-pushed
the
feat/release-sbom-assets
branch
from
September 23, 2026 00:08
09b7b46 to
f56cc88
Compare
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CycloneDX SBOM reaches users only inside the wheel, and the release workflow keeps a copy as a workflow artifact that expires. Someone auditing the zipapp, or running a scanner that reads SPDX only, has no file to download. I attach
virtualenv.cdx.jsonand an SPDX 2.3 rendering,virtualenv.spdx.json, to every GitHub release. Both go into the onegh release createcall, because immutable releases reject assets uploaded later.tasks/cyclonedx_to_spdx.pyrenders the SPDX document from the CycloneDX document the wheel build embedded, using the standard library alone. Generating it inhatch_build.pywould put a second SBOM in the wheel. I validate the output with spdx-tools, the SPDX project's own Python library, in the tooling envs only:tox r -e spdxrenders and runspyspdxtools, andtasks/validate_sbom.pyparses and validates the rendering in thereadmeenv. The library importsbeartype, whose latest release fails to import on Python 3.15, so I kept it out of the test dependencies and pinned both envs to Python 3.14. The output depends on its input alone:createdcomes from the CycloneDX timestamp, which followsSOURCE_DATE_EPOCH, and the document namespace ends in the CycloneDX serial, which hatch_build derives from the content. The SPDX side keeps packages, SHA-256 hashes, declared licenses, purls, containment, dependencies and build tools. Per-file hashes stay in CycloneDX only: SPDX 2.3 requires a SHA-1 on every file and wheelRECORDfiles carry SHA-256. The same goes for the build formulation, which SPDX 2.3 has no field for.A second
actions/atteststep attests the SPDX file against the sdist and wheel underhttps://spdx.dev/Document/v2.3. After publication the verify job downloads both assets, compares the CycloneDX one with the SBOM inside the published wheel and the SPDX one with the build artifact, and validates the SPDX file withpyspdxtools. For both predicate types it then runsgh attestation verifyon the sdist and wheel and checks that the attested predicate matches the asset. I ran that attestation check against the 21.10.0 wheel and sdist with the CycloneDX predicate. The SPDX predicate has no attestation to check until the next release. #3305 describes these assets for users; heredocs/development.rstonly covers how the SBOM gets generated and which tox env renders and validates it. 📦