sphinx-design
sphinx-design copied to clipboard
Added FIPS compliant flag to md5 call
Closes #161
Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.
Welcome to the EBP community! :tada:
Heya, usedforsecurity was only added in Python 3.9 https://docs.python.org/3/library/hashlib.html#hash-algorithms, so some handling for <3.9 needs to be implemented 😄
Heya,
usedforsecuritywas only added in Python 3.9 https://docs.python.org/3/library/hashlib.html#hash-algorithms, so some handling for <3.9 needs to be implemented 😄
Ah indeed, and I thought it was just a nice one-line PR :)
Ah indeed, and I thought it was just a nice one-line PR
They never are 😂
Ah indeed, and I thought it was just a nice one-line PR
They never are 😂
So I am not too proficient with python, maybe you can recommend the best solution for this. This seems to be straightforward:
has_usedforsecurity_support = float(sys.version[:3]) >= 3.9
Or something with the inspect module to check if md5 function supports the usedforsecurity kwargs, although that seems convoluted.
And then just use something like:
md5_kwargs = {"usedforsecurity": False} if has_usedforsecurity_support else {}
hash = hashlib.md5(content.encode("utf8"), **md5_kwargs ).hexdigest()
Codecov Report
Patch coverage is 100.00% of modified lines.
| Files Changed | Coverage |
|---|---|
| sphinx_design/extension.py | 100.00% |
:loudspeaker: Thoughts on this report? Let us know!.
@chrisjsewell do you think this is sufficient? I'll use my fork until the next release.
@chrisjsewell do you think this is sufficient? I'll use my fork until the next release.
Yep I think it's fine but bare with me to merge
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 90.01%. Comparing base (
074f21f) to head (4651d30).
:exclamation: Current head 4651d30 differs from pull request most recent head f66fd84
Please upload reports for the commit f66fd84 to get more accurate results.
Additional details and impacted files
@@ Coverage Diff @@
## main #162 +/- ##
==========================================
+ Coverage 89.18% 90.01% +0.82%
==========================================
Files 11 11
Lines 962 951 -11
==========================================
- Hits 858 856 -2
+ Misses 104 95 -9
| Flag | Coverage Δ | |
|---|---|---|
| pytests | 90.01% <100.00%> (+0.82%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Congrats on your first merged pull request in this project! :tada:
Thank you for contributing, we are very proud of you! :heart: