You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should validate the hash of each individual file in the wheel against the hash recorded in RECORD. (This is distinct from the hash-checking mode described in #131 and #474.)
install-wheel-rs can do during installation, but it's turned off by default for perf reason (sha256 is slow) and because pip also didn't validate last time i checked.
Related topic (let me know if I should create a separate issue):
Currently most python packaging tooling doesn't have any kind of guardrails against the clobbering of files in one whl from another whl. This is basically undefined behavior -- depending on the order the final venv will be different. There are packages in the wild that include things like empty __init__.py files that do clobber each other and it's not a problem in practice (most notably google cloud family of packages). There are also cases when people put README.md into the top-level folder so it ends up in site-packages/README.md and conflicts.
@hauntsaninja proposed that we could do a hash check against the RECORD file entry and maybe have a flag to fail loudly in case of violation -- that should simultaneously allow clobbering of empty __init__.py files and prevent undefined behaviors.
What do you think about this idea? Maybe there is a better way to achieve more strict semantic?
Activity
konstin commentedon Jan 11, 2024
During installation or for an existing venv?
install-wheel-rs can do during installation, but it's turned off by default for perf reason (sha256 is slow) and because pip also didn't validate last time i checked.
For an existing venv, https://github.com/konstin/poc-monotrail/blob/main/crates/monotrail/src/verify_installation.rs implements this.
charliermarsh commentedon Jan 11, 2024
For us, installation is linking, so it should really happen when unzipping into the cache.
charliermarsh commentedon Jan 11, 2024
Or we could do it after-the-fact as part of our venv validation...
vors commentedon Aug 13, 2024
Related topic (let me know if I should create a separate issue):
Currently most python packaging tooling doesn't have any kind of guardrails against the clobbering of files in one whl from another whl. This is basically undefined behavior -- depending on the order the final venv will be different. There are packages in the wild that include things like empty
__init__.pyfiles that do clobber each other and it's not a problem in practice (most notably google cloud family of packages). There are also cases when people putREADME.mdinto the top-level folder so it ends up insite-packages/README.mdand conflicts.@hauntsaninja proposed that we could do a hash check against the
RECORDfile entry and maybe have a flag to fail loudly in case of violation -- that should simultaneously allow clobbering of empty__init__.pyfiles and prevent undefined behaviors.What do you think about this idea? Maybe there is a better way to achieve more strict semantic?
konstin commentedon Dec 2, 2025
Given that hash checking against RECORD wasn't implemented in pip nor uv, the security features weren't use (https://discuss.python.org/t/discouraging-deprecating-pep-427-style-signatures/94968), it's slow and new security feature such as hashes in the simple API and attestations work on a whole-file basis, I suggest we close this as not planned and focus on whole-archive hash checking.
konstin commentedon Aug 5, 2026
Closing in favor of the actually verifiable attestations, I don't think we should implement
RECORDgiven PEP 815.