-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
[Bug]: Setting text.usetex=True
in pyplot.rcParams
Raises FIPS Compliance Errors
#29603
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
Milestone
Comments
I've not contributed to the project before, but I'll possibly try to set up a development environment and open a PR for this in the next day or two. |
martinky24
added a commit
to martinky24/matplotlib
that referenced
this issue
Feb 12, 2025
2 tasks
I opened a PR here: #29608 |
Note to self: In another repo, someone found an incantation that can be used to potentially test FIPS issues in a container simonw/datasette#2270 (comment) |
tacaswell
added a commit
that referenced
this issue
Feb 12, 2025
Remove md5 usage to prevent issues on FIPS enabled systems (closes #29603)
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this issue
Feb 12, 2025
…IPS enabled systems (closes matplotlib#29603)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug 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.This is similar to #18192 (and much of this report is modeled off of that)
There are 3 places in the code that seem to still use
hashlib.md5
:matplotlib/lib/matplotlib/texmanager.py
Line 171 in 24bb51c
matplotlib/lib/matplotlib/sphinxext/mathmpl.py
Line 149 in 24bb51c
matplotlib/lib/matplotlib/testing/compare.py
Line 49 in 24bb51c
There probably isn't a great reason not to replace md5 with sha256 (or something else) in these locations.
Code for reproduction
The big requirement here is a FIPS compliant system or at least a Python install compiled to be FIPS compliant. Then the following code will reproduce the error.
To reproduce,
sudo fips-mode-setup --enable && sudo reboot
(there may be other methods)fips-mode-setup --check
and it returned FIPS mode is enabled.python3 -m venv .venv
./.venv/bin/python -m pip install matplotlib==3.10.0
./.venv/bin/python fips_error.py
. The contents offips_error.py
is listed below.Actual outcome
Expected outcome
No exception related to FIPS and the plot is created.
Additional information
Operating system
RHEL 8.10 (with FIPS enabled)
Matplotlib Version
3.10.0
Matplotlib Backend
tkagg
Python version
Python 3.11.9
The text was updated successfully, but these errors were encountered: