Repository navigation
🐛 fix(zipapp): bundle wheels pinned by a PEP 751 lock - #3306
Merged
Merged
Conversation
gaborbernat
force-pushed
the
fix/zipapp-hashed-deps
branch
from
September 22, 2026 23:51
50d7194 to
2d13f58
Compare
gaborbernat
force-pushed
the
fix/zipapp-hashed-deps
branch
from
September 23, 2026 00:21
2d13f58 to
7abe24c
Compare
gaborbernat
force-pushed
the
fix/zipapp-hashed-deps
branch
2 times, most recently
from
September 23, 2026 01:15
aad41f1 to
b34a127
Compare
The zipapp build ran pip download against the version ranges in pyproject.toml, so each published zipapp bundled whatever PyPI served at build time, with nothing to check those bytes against. Lock the runtime dependencies in pylock.zipapp.toml, the PEP 751 format uv writes from pyproject.toml, next to the pyproject.toml it locks as the PEP recommends. The build reads the lock, downloads each wheel from its recorded URL and refuses any file whose sha256 differs. Compiling from pyproject.toml drops the requirements copy that had to track the declared ranges by hand. Dependabot cannot update pylock.toml files yet (dependabot/dependabot-core#12094), so the daily upgrade workflow recompiles the lock with the same seven day cooldown it applies to embedded wheels, and the patch validator accepts that one file.
gaborbernat
force-pushed
the
fix/zipapp-hashed-deps
branch
from
September 23, 2026 01:19
b34a127 to
7397b50
Compare
This was referenced Sep 23, 2026
This was referenced Sep 23, 2026
gaborbernat
added a commit
to gaborbernat/virtualenv
that referenced
this pull request
Sep 26, 2026
The verify-release how-to said the zipapp build does not pin what it bundles, which stopped being true when pypa#3306 added pylock.zipapp.toml, and the threat model still said wheels differ between build machines after pypa#3311. Neither page covered the release attestation GitHub signs for the immutable releases published since 21.11.0. Move the examples to 21.12.1, add gh release verify and verify-asset, and give a zipapp rebuild recipe that constrains the build tools from the SBOMs. Fix the same claims in the release artifacts reference, the explanation and the threat model, whose upgrade job note also named a deploy key that the workflow does not use.
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 zipapp build ran
pip downloadagainst the version ranges frompyproject.toml, so each publishedvirtualenv.pyzbundled whatever PyPI served fordistlib,filelock,platformdirs,python-discoveryandtyping-extensionsat build time. 📦 The threat model in #3294 lists this as an open item.pylock.zipapp.tomlnow locks those dependencies in the PEP 751 format, with a URL and sha256 for every wheel.uv pip compile pyproject.toml --universal --python-version 3.9 -o pylock.zipapp.tomlwrites it from the[project]dependencies, so no second copy of the ranges exists to drift. The file sits at the repository root because PEP 751 places a lock that covers onepyproject.tomlin the same directory.make_zipapp.pyreads the lock withtomllib, downloads each wheel from its recorded URL, refuses any file whose sha256 differs, and assigns wheels to Python versions by evaluating the lock markers. I dropped the pip-based dependency walk; the lock holds the resolution for every Python version the zipapp targets. 🔒Dependabot has no
pylock.tomlsupport yet (dependabot/dependabot-core#12094 is open, and the supported ecosystems reference lists no such manifest). The daily upgrade workflow recompiles the lock with--upgradeandUV_EXCLUDE_NEWER="7 days", the same cooldowncheck_wheel_age.pyapplies to embedded wheels, andapply_upgrade_patch.pyacceptspylock.zipapp.tomlas one more allowed path. ⏳ Before this change a release build bundled whatever PyPI served at build time. A new dependency release now reaches the zipapp once the upgrade workflow recompiles the lock after the seven day cooldown. The committed lock follows that rule, so the zipapp bundlesfilelock3.32.6 untilfilelock4.0.1, uploaded on 2026-09-19, clears the cooldown on 2026-09-26;platformdirs4.11.8 andpython-discovery1.6.0 lag their newest releases the same way. The zipapp SBOM from #3310 reads the built archive, so it lists these locked versions. Runningmake_zipapp.pyon Python 3.9 or 3.10 needstomli; thezipapptox environment builds on 3.14.