Repository navigation
✨ feat(zipapp): publish an SBOM for the zipapp - #3310
Merged
Merged
Conversation
gaborbernat
force-pushed
the
feat/zipapp-sbom
branch
2 times, most recently
from
September 23, 2026 00:29
27d0fbe to
3725b16
Compare
gaborbernat
force-pushed
the
feat/zipapp-sbom
branch
from
September 23, 2026 00:33
3725b16 to
2cae001
Compare
The zipapp bundles more than the wheel: distlib, filelock, platformdirs, python-discovery and the per-Python backports next to the embedded pip and setuptools wheels. Only its build provenance was published, so scanners had no inventory for it. Describe the built archive from its own content, reusing hatch_build's SBOM helpers so both documents share the namespace, supplier and build tool records. The SBOM goes into the archive root and next to it, tox validates that it lists every member with its hash, and the release attests it against virtualenv.pyz and attaches it in the single gh release create call.
gaborbernat
force-pushed
the
feat/zipapp-sbom
branch
from
September 23, 2026 00:35
2cae001 to
0ee7fd0
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.
virtualenv.pyzships on GitHub Releases and athttps://bootstrap.pypa.io/virtualenv.pyzwith build provenance but no SBOM, and it bundles more than the wheel does: distlib, filelock, platformdirs, python-discovery and typing-extensions, in different versions per Python, next to the embedded pip and setuptools wheels. The wheel's SBOM declares those dependencies without versions because pip resolves them at install time, so it cannot describe the zipapp. 📦tasks/zipapp_sbom.pyreads the built archive and writes a CycloneDX 1.6 document from what it finds there. virtualenv and each bundled distribution come from theirMETADATA, each bundled distribution records the Python versions that load it (from the zipapp'sdistributions.json), each embedded wheel carries the SHA-256 of its bytes, and every other member gets its own file entry and hash. I reuse the helpers inhatch_build.py(made public for that) so both SBOMs share the serial number namespace, the supplier, theSOURCE_DATE_EPOCHtimestamp and the build tool records. I identify the zipapp aspkg:generic/virtualenv.pyz, the product id #3308's VEX uses for it, and its embedded wheels carry the same purls and hashes that VEX names. The script writesvirtualenv.pyz.cdx.jsonnext to the zipapp and adds the same file to the archive root, next to__main__.py, so a copy fetched from bootstrap.pypa.io carries its own inventory.tox r -e zipappnow builds the zipapp, writes the SBOM and runstasks/validate_sbom.pyon it: the CycloneDX 1.6 schema, the serial numberactions/attestneeds, the reference checks the wheel SBOM gets, and a comparison of every archive member and its SHA-256 with the document. The env pins Python 3.14 because the validator imports spdx-tools. The release workflow attests the SBOM againstvirtualenv.pyz, attaches it in the singlegh release createcall that immutable releases require, and the verify job checks that the asset matches both the copy inside the published zipapp and the attested predicate.The zipapp's dependencies are unpinned today, so two builds of one commit can bundle different versions; #3306 pins them by hash, which makes the SBOM content reproducible too. This PR leaves
tasks/make_zipapp.pyuntouched, so the two merge in either order. This PR and #3308 both edit thegh release createline andtasks/validate_sbom.py, so the second to merge needs a rebase.