-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove md5 usage to prevent issues on FIPS enabled systems (closes #29603) #29608
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
I'm not at all an expert but would these have passed FIPS if usedforsecurity was set to False, regardless of the algorithm? https://docs.python.org/3/library/hashlib.html |
Great question. I primarily went this route following the precedent from #18193. If it worked there, I figure it should work here. It was a few years ago, but I did run across a static compliance scanner that wasn't smart enough to respect (or perhaps intentionally didn't respect?) the The other aspect is that I don't think that any of the instances I changed used In any event I am happy to discuss or look into this further if there's a desire. |
I'm sure it was indeed chosen for convenience. But the point of labelling as not for security is to prevent whack a mole with security checkers for something that is just being done to create a convenient label. |
…ations are not used for security-based purposes
That's reasonable. Regardless of the algorithm used it can be added, which is helpful in-code documentation. I have added a follow-up commit. |
I am not an expert in Github / Azure CI pipelining, but I do not think any of the failures are legitimate issues with my changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe @anntzer had a minute for a second review as I think he has some expertise on these parts of the code. But this seems fine to me.
Did you test if FIPS is happy with the flag even with md5 ?
I'm happy to merge this as is. A quick search suggests that getting a GHA running in FIPS mode is not trivial. The conventional wisdom is "md5 is insecure but fast" does not seem to hold up:
where
so I see no reason to not always prefer sha256 |
…IPS enabled systems (closes matplotlib#29603)
Something went wrong ... Please have a look at my logs. |
For the sake of posterity:
In a quick test in my FIPS environment, FIPS is happy with just Although I agree with the decision to change the algorithm anyway. Thanks all! |
Congratulations on your first merged Maptlotlib PR @martinky24 🎉 Thank you for reporting and fixing this issue and I hope we hear from you again! |
Thats great - so we have somewhat future proofed ourselves against future changes to what is considered "secure" |
PR summary
If you use a FIPS (Federal Information Processing Standards) compliant Python install, then you cannot use
pyplot.show
to display a plot withplt.rcParams['text.usetex'] = True
due to ahashlib.md5
call in texmanager.py.Instead of just fixing the one instance I ran into, I changed the other usages of
hashlib.md5
in the codebase to nip those in the bud.Per https://docs.python.org/3/library/hashlib.html#hash-algorithms, note that
sha256
is inhashlib.algorithms_guaranteed
(whilemd5
might not be), so it seems like a reasonable drop-in-place replacement.I think that these changes should be entirely transparent to end-users (unless they're on FIPS-enabled systems) and are merely implementation details, and thus do not require documentation changes. Correct me if this understanding is incorrect.
PR checklist
text.usetex=True
inpyplot.rcParams
Raises FIPS Compliance Errors #29603" is in the body of the PR description to link the related issue