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

Update evidently hashlib usage for FIPS-Compliant Systems and Security Best Practices #1410

Open
DueViktor opened this issue Jan 8, 2025 · 0 comments

Comments

@DueViktor
Copy link
Contributor

From python 3.9 hashlib introduced the usedforsecurity argument:

Changed in version 3.9: All hashlib constructors take a keyword-only argument usedforsecurity with default value True. A false value allows the use of insecure and blocked hashing algorithms in restricted environments. False indicates that the hashing algorithm is not used in a security context, e.g. as a non-cryptographic one-way compression function.

evidently use hashing where the purpose is indeed not for security purposes. This should be specifed in the code. My guess is that pretty much all federal systems in the world would have this issue.

Federal Information Processing Standards (FIPS) 140-2 is a mandatory standard for the protection of sensitive or valuable data within Federal systems. - https://www.wolfssl.com/license/fips/

Without this fix organisations following certain security standard (FIPS compliance could be an example) are not able to use this package.

The same fix has been applied to a range of key repositories:

Proposed solution

  • Explicitly set usedforsecurity=False when calling hashlib constructors where the hashing is not security-related.
  • Since usedforsecurity is only available from Python 3.9 onwards and evidently supports Python 3.8+, implement logic to handle this difference:
    • For Python 3.8: Call hashlib without usedforsecurity.
    • For Python 3.9+: Specify usedforsecurity=False.

I will submit a PR implementing this change. Let me know if there are other concerns or suggestions for handling this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant