Skip to content
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

repositories/http: support algorithms in hashlib.algorithms_guaranteed #6632

Closed

Conversation

vfazio
Copy link
Contributor

@vfazio vfazio commented Sep 26, 2022

PEP 503 says:

Repositories SHOULD choose a hash function from one of the ones guaranteed to be available via the hashlib module in the Python standard library (currently md5, sha1, sha224, sha256, sha384, sha512). The current recommendation is to use sha256.

It should make sense, then, to just check that the value returned is in hashlib.algorithms_guaranteed instead of a short subset of hashes.

Otherwise, the subset of hashes should be extended to those directly mentioned in the PEP though that list was compiled 7 years ago and does not reflect algorithms guaranteed to be present.

Pull Request Check List

Resolves:

  • Added tests for changed code.
  • Updated documentation for changed code.

@neersighted
Copy link
Member

This does not resolve #6301 -- hash handling code is much more involved than this and there are no tests that actually make sure the intended fix really happens. I would suggest instead syncing with the authors of other attempts (e.g. #6490, #4740, #5326) to maybe combine efforts or see what is needed.

I have my own refactor spinning locally as well -- it's much more holistic and security-focused than a straight forward-port, but may take more time to cook.

@vfazio vfazio deleted the vfazio-include-additional-algos branch September 26, 2022 21:21
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants