chore: drop unreachable pre Python 3.9 md5 fallback in hash - #9153
chore: drop unreachable pre Python 3.9 md5 fallback in hash#9153Andrej730 wants to merge 2 commits into
hash#9153Conversation
|
Thanks for this, and apologies for the slow first response. I checked out the branch and specifically went looking for a FIPS-mode reason to keep the fallback, since that is the usual reason Minimum supported Python
The fallback cannot execute
On FIPS specifically — the direction here is the opposite of risky This is the part I want to be explicit about, because it is easy to get backwards. Under a FIPS-enforcing OpenSSL, it is the bare
Deleting it therefore removes no FIPS capability. In fact the old condition had a latent bug in the FIPS-unfriendly direction: One honesty caveat: I could not execute the FIPS path — The original history supports the reading too: the fallback came in via #4812 ("use sha256 where it is possible & update md5 call to include usedforsecurity=False"), i.e. Blast radius
Test results
One optional nit, non-blocking
def test_md5_instantiation(self, patched_hashlib):
str_checksum("dummy-data")
if sys.version_info.major >= 3 and sys.version_info.minor >= 9:
patched_hashlib.md5.assert_called_with(usedforsecurity=False)
else:
patched_hashlib.md5.assert_called_with()It passes as written, so this is not a blocker. But the On the merge state GitHub reports |
|
Good finding about version check still present in |
Hello. Removing fallback for Python <3.9 missing
usedforsecurityoption inhashlib.md5.Since project is targeting Python >= 3.10, this code is dead and can be safely removed.
aws-sam-cli/pyproject.toml
Line 10 in 9101836
Mandatory Checklist
PRs will only be reviewed after checklist is complete
make prpassesmake update-reproducible-reqsif dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.