fix(s3_v2): pass usedforsecurity=False to hashlib.md5 for FIPS envs

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Mubashir Osmani 2026-07-02 01:12:49 +00:00
parent 68a8fc2207
commit e542be17ad
2 changed files with 9 additions and 3 deletions

View file

@ -323,7 +323,9 @@ class S3Logger(CustomBatchLogger, BaseAWSLLM):
# Calculate SHA256 hash of the content
content_hash = hashlib.sha256(json_string.encode("utf-8")).hexdigest()
content_md5 = base64.b64encode(hashlib.md5(json_string.encode("utf-8")).digest()).decode()
content_md5 = base64.b64encode(
hashlib.md5(json_string.encode("utf-8"), usedforsecurity=False).digest()
).decode()
# Prepare the request
headers = {
@ -496,7 +498,9 @@ class S3Logger(CustomBatchLogger, BaseAWSLLM):
# Calculate SHA256 hash of the content
content_hash = hashlib.sha256(json_string.encode("utf-8")).hexdigest()
content_md5 = base64.b64encode(hashlib.md5(json_string.encode("utf-8")).digest()).decode()
content_md5 = base64.b64encode(
hashlib.md5(json_string.encode("utf-8"), usedforsecurity=False).digest()
).decode()
# Prepare the request
headers = {

View file

@ -1203,7 +1203,9 @@ def _expected_content_md5(payload: dict) -> str:
from litellm.litellm_core_utils.safe_json_dumps import safe_dumps
json_string = safe_dumps(payload)
return base64.b64encode(hashlib.md5(json_string.encode("utf-8")).digest()).decode()
return base64.b64encode(
hashlib.md5(json_string.encode("utf-8"), usedforsecurity=False).digest()
).decode()
@pytest.mark.asyncio