The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(s3_v2): pass usedforsecurity=False to hashlib.md5 for FIPS envs
Mubashir Osmanie542be17adde
diff --git a/litellm/integrations/s3_v2.py b/litellm/integrations/s3_v2.pyindex db12d1d2c26..5b953035cfd 100644--- a/litellm/integrations/s3_v2.py+++ b/litellm/integrations/s3_v2.py@@ -323,7 +323,9 @@ class S3Logger(CustomBatchLogger, BaseAWSLLM):# Calculate SHA256 hash of the contentcontent_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 requestheaders = {@@ -496,7 +498,9 @@ class S3Logger(CustomBatchLogger, BaseAWSLLM):# Calculate SHA256 hash of the contentcontent_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 requestheaders = {diff --git a/tests/test_litellm/integrations/test_s3_v2.py b/tests/test_litellm/integrations/test_s3_v2.pyindex 3331f9f4f5e..070e278cdc0 100644--- a/tests/test_litellm/integrations/test_s3_v2.py+++ b/tests/test_litellm/integrations/test_s3_v2.py@@ -1203,7 +1203,9 @@ def _expected_content_md5(payload: dict) -> str:from litellm.litellm_core_utils.safe_json_dumps import safe_dumpsjson_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