question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry publish fails on FIPS enabled systems because of hashlib.md5()

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Red Hat Enterprise Linux Server release 7.9 (Maipo)
  • Poetry version: 1.1.12
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

If FIPS mode is enabled for a system there is a potential for a ValueError in upload.py when trying to publish a package to a repository when there is an md5 checksum. See the documentation for hashlib for more information. The important part being:

md5() is normally available as well, though it may be missing or blocked if you are using a rare “FIPS compliant” build of Python.

The error returned when running the command poetry publish -r <my-repo>

No suitable keyring backends were found
Using a plaintext file to store and retrieve credentials
Publishing <my-package> (0.1.5) to <my-repo>

  ValueError

  error:060800A3:digital envelope routines:EVP_DigestInit_ex:disabled for fips

  at ~/.poetry/lib/poetry/publishing/uploader.py:131 in post_data
      127│
      128│         if _has_blake2:
      129│             blake2_256_hash = hashlib.blake2b(digest_size=256 // 8)
      130│
    → 131│         md5_hash = hashlib.md5()
      132│         sha256_hash = hashlib.sha256()
      133│         with file.open("rb") as fp:
      134│             for content in iter(lambda: fp.read(io.DEFAULT_BUFFER_SIZE), b""):
      135│                 md5_hash.update(content)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
burregocommented, Sep 26, 2022

This also prevents “poetry install” from executing on a FIPS Mode enabled system

1reaction
neersightedcommented, Oct 11, 2022

https://github.com/python-poetry/poetry-core/pull/503 is merged, the next release will include this change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

1744670 – hashlib.md5 broken in FIPS mode without ...
Description of problem: It is not possible to use MD5 from hashlib module when system is configured in FIPS mode. Version-Release number of ......
Read more >
Python poetry install failure - invalid hashes
There are several issue reports about invalid hashes. One common cause is running multiple Poetry instances simultaneously; ...
Read more >
[RTFACT-18495] SHA256 hashes in PyPi repository ...
This results in an error like "Unknown hash algorithm 'md5'" when using "pip" against Artifactory on any client in FIPS mode.
Read more >
Secure Programming HOWTO
Various BSD systems implement an rfork() system call (originally developed in Plan9); it ... I believe a key reason that this effort failed...
Read more >
Palo Alto Networks PAN-OS SDK for Python Documentation
If you have poetry installed, you can also add pan-os-python to your ... The apply() method is used instead of create() because it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found