-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hash-checking mode breaks after new distributions are added #5874
Comments
I think it's a good idea to do the solution described here, to limit our installation to only things we have hashes for. Ideally I think we'd print a warning of some kind if we're not installing the preferred file due to it not having a hash listed though. |
I believe this is the same as #3634. |
I opened a similar issue (which I've now closed in favour of this) #6395 describing this problem but for distributions on additional indexes. We had some reports of issues from people trying to install certbot on Raspberry Pi and picking up wheels from piwheels.org but having a hash-mismatch. Also see related but different #6394 - proposal to add a flag to remove additional indexes. |
Changes the behavior of `pip install` in hash-checking mode to filter out any candidates whose hashes (obtained via URL) do not match the hashes provided. This prevents a HashMismatch error when a more preferred binary distribution is upload for a release after a user pins the hashes for that release. Note that a second hash comparison is performed when the candidate is downloaded. This is important because the first check is not secure: it trusts that the hash in the URL is the same as the hash in the content, and it also does not error when the user is in hash-checking mode but has not provided a hash.
On quick glance, the behavior in #6464 - ignoring artifacts for which we don't have a pinned hash - seems like a reasonable solution to this issue! Thank you for coding it up! |
Address #5874: Prefer candidates with allowed hashes
This has now been addressed by PR #6699. In a subsequent PR, I'll do what @dstufft suggested above (I'll file a separate issue about that in a bit):
There is also a pending PR #6714 that adds some additional debug logging. |
Thank you @cjerdonek! |
What's the problem this feature will solve?
Currently, it's possible to add new distributions to an existing release on PyPI at any point after the release was initially made.
Occasionally when this happens, the new distribution is preferred by
pip
over previous distributions. For example, initially there is only a source distribution, then 1 week later the maintainer adds a built distribution.For users who have included hashes in their requirements files, this occasionally leads to breakage (
THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE.
) becausepip
is preferring a distribution that didn't exist when the user added the hashes, and (correctly) refusing to install it.The current behavior is roughly:
Describe the solution you'd like
The behavior of
pip
could be this:This would maintain the same security that hash-checking mode provides, while avoiding the potential for breakage when new distributions are added to a release.
Alternative Solutions
Some alternate things we could do:
--only-binary
and--no-binary
flagsAdditional context
Some additional discussion at pypa/packaging.python.org#564.
The text was updated successfully, but these errors were encountered: