fix(bedrock-mantle): use correct SigV4 signing service name - #31988
fix(bedrock-mantle): use correct SigV4 signing service name#31988sanyamk23 wants to merge 3 commits into
Conversation
Greptile SummaryThis PR fixes SigV4 signing for the
Confidence Score: 4/5Safe to merge — the two-line service name fix is well-scoped and the regular Bedrock path is unchanged. Both changed files make targeted, correct fixes: the wrong "bedrock" service name is replaced with "bedrock-mantle" in exactly the two places that handle Mantle signing. The only leftover is a stale module docstring in common_utils.py that still documents the old service name, which could mislead future contributors but does not affect runtime behavior. The module-level docstring in litellm/llms/bedrock_mantle/common_utils.py still references service "bedrock" and should be updated to "bedrock-mantle" to match the fixed code.
|
| Filename | Overview |
|---|---|
| litellm/llms/bedrock_mantle/common_utils.py | Fixes service_name from "bedrock" to "bedrock-mantle" in BedrockMantleAuthMixin.sign_request; module-level docstring still references the old "bedrock" service name and needs updating. |
| litellm/llms/bedrock/chat/mantle/transformation.py | Adds a sign_request override on AmazonMantleConfig that correctly delegates to _sign_request with service_name="bedrock-mantle", preventing the inherited "bedrock" service name from being used. |
Comments Outside Diff (1)
-
litellm/llms/bedrock_mantle/common_utils.py, line 3-8 (link)The module-level docstring still describes the SigV4 fallback as using service
"bedrock", which was exactly the bug this PR fixes. A reader following the doc will be misled about what signing service is used.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Reviews (1): Last reviewed commit: "fix(bedrock-mantle): use correct SigV4 s..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
537fb80 to
8fac146
Compare
8fac146 to
685ed49
Compare
The bedrock-mantle endpoint requires SigV4 signing with service_name="bedrock-mantle", not "bedrock". Using the wrong service name causes IAM permission errors because AWS evaluates the request against the bedrock service namespace instead of bedrock-mantle. Fixed in two locations: - bedrock_mantle/common_utils.py: standalone Mantle provider - bedrock/chat/mantle/transformation.py: added sign_request override to AmazonMantleConfig The base_invoke_transformation.py sign_request is left unchanged as it serves regular Bedrock requests that correctly use service_name="bedrock". Fixes BerriAI#31475, BerriAI#31113, BerriAI#31196
8fac146 to
e8b430a
Compare
…request The sign_request override matches the parent class signature which uses bare dict annotations. Suppress type-discipline budget violations with mutable-ok comments to match the existing pattern.
e8b430a to
bc3688e
Compare
|
Thanks for the PR, but the premise here was already tested and refuted in #31476. @6matt ran the live matrix there with real IAM credentials and no bearer token, and @laiweihwa repeated it with a role holding only The actual root cause of #31113 and #31196 was an unsigned request (the no-op The remaining value here is the cosmetic alignment to the canonical |
Summary
The
bedrock-mantleendpoint requires SigV4 signing withservice_name="bedrock-mantle", not"bedrock". Using the wrong service name causes IAM permission errors because AWS evaluates the request against thebedrockservice namespace instead ofbedrock-mantle.Changes (2 files)
litellm/llms/bedrock_mantle/common_utils.py: Changedservice_name="bedrock"→service_name="bedrock-mantle"in the standalone Mantle provider'ssign_requestlitellm/llms/bedrock/chat/mantle/transformation.py: Addedsign_requestoverride toAmazonMantleConfigthat usesservice_name="bedrock-mantle", preventing the base class from signing with the wrong service namebase_invoke_transformation.pyis unchanged — it serves regular Bedrock requests that correctly useservice_name="bedrock".Evidence
AmazonBedrockMantleInferenceAccessusesbedrock-mantle:*actionsbedrock-mantle.amazonaws.comAmazonBedrockMantleFullAccessmanaged policy usesbedrock-mantle:*Testing
bedrock_mantle/common_utils.pysigns withservice_name="bedrock-mantle"AmazonMantleConfigoverridessign_requestwith correct service namebase_invoke_transformation.pyunchanged (regular Bedrock still uses"bedrock")Fixes #31475
Fixes #31113
Fixes #31196