From 7a2ec853599396eee121588c160d6c565492ca17 Mon Sep 17 00:00:00 2001 From: shivam Date: Sat, 21 Mar 2026 15:07:27 -0700 Subject: [PATCH] fix(bedrock): drop aws:UserAgent from OIDC web identity session policy Boto3/botocore and SigV4+httpx do not send User-Agent litellm/*, so the StringLike condition caused implicit deny on ApplyGuardrail and other Bedrock calls after AssumeRoleWithWebIdentity. Keep SecureTransport and Bedrock action allowlist. Made-with: Cursor --- litellm/llms/bedrock/base_aws_llm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/bedrock/base_aws_llm.py b/litellm/llms/bedrock/base_aws_llm.py index cc069022ecb..01654e41fc6 100644 --- a/litellm/llms/bedrock/base_aws_llm.py +++ b/litellm/llms/bedrock/base_aws_llm.py @@ -700,7 +700,7 @@ class BaseAWSLLM: "RoleSessionName": aws_session_name, "WebIdentityToken": oidc_token, "DurationSeconds": 3600, - "Policy": '{"Version":"2012-10-17","Statement":[{"Sid":"BedrockLiteLLM","Effect":"Allow","Action":["bedrock:InvokeModel","bedrock:InvokeModelWithResponseStream","bedrock:ApplyGuardrail"],"Resource":"*","Condition":{"Bool":{"aws:SecureTransport":"true"},"StringLike":{"aws:UserAgent":"litellm/*"}}}]}', + "Policy": '{"Version":"2012-10-17","Statement":[{"Sid":"BedrockLiteLLM","Effect":"Allow","Action":["bedrock:InvokeModel","bedrock:InvokeModelWithResponseStream","bedrock:ApplyGuardrail"],"Resource":"*","Condition":{"Bool":{"aws:SecureTransport":"true"}}}]}', } # Add ExternalId parameter if provided