Skip to content

"coverage html" fails on systems with FIPS enabled #1189

Closed
@cjbland

Description

@cjbland

Is your feature request related to a problem? Please describe.
My development system recently got an "upgrade" which enabled FIPS and has thus blocked all access to creating MD5 hashes. Because of this, coverage html does not working anymore. Instead I get a stacktrace that looks like this (I can't copy and paste the exact error because it's on a lab machine that is not connected to the internet):

  File: "....../venv/lib64/python3.6/site-packages/coverage/html.py" line 461, in check_global_data
    m = Hasher()
  File: "....../venv/lib64/python3.6/site-packages/coverage/misc.py" line 203, in __init__
    self.md5 = hashlib.md5()
ValueError: unknown reasons

Describe the solution you'd like
It would be nice if this class used sha256 instead of md5 for the hashing algorithm.

Describe alternatives you've considered
We have not explored any other alternatives other than manually modifying the code to work.

Additional context
The workstation I'm using is configured as follows:

CentOS 7.9
Python 3.6
coverage==5.5.0
pytest==6.2.4
pytest-cov==2.12.1

I will create a PR for this as the changes seemed pretty straightforward and non-impacting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions