fix(gateway): Bedrock BYOK must not inherit AWS_SESSION_TOKEN (IRSA)#352
fix(gateway): Bedrock BYOK must not inherit AWS_SESSION_TOKEN (IRSA)#352turisanapo merged 3 commits intomainfrom
Conversation
Use credentialProvider for access-key Bedrock so createAmazonBedrock does not merge AWS_SESSION_TOKEN from the pod with BYOK IAM user keys (invalid SigV4 in EKS/IRSA). Fixes #351 Made-with: Cursor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe Bedrock provider's "access-key" auth branch now supplies credentials via a Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Gateway
participant AmazonBedrockSDK
participant BedrockAPI
Client->>Gateway: request using Bedrock BYOK provider
Gateway->>AmazonBedrockSDK: createAmazonBedrock(..., credentialProvider)
AmazonBedrockSDK->>Gateway: invoke credentialProvider() -> { accessKeyId, secretAccessKey }
AmazonBedrockSDK->>BedrockAPI: SigV4-signed request using returned keys
BedrockAPI-->>AmazonBedrockSDK: response
AmazonBedrockSDK-->>Gateway: response
Gateway-->>Client: forward response
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…eProvider function
|
According to AI SDK documentation the most minimal fix would be to explicitly set |
Good catch. I tried the docs approach ( |
Made-with: Cursor
Summary
Fixes #351.
@ai-sdk/amazon-bedrockbuilds SigV4 credentials fromaccessKeyId/secretAccessKeybut still loadsAWS_SESSION_TOKENfrom the environment when nosessionTokenoption is set. On EKS/IRSA that merges the pod session token with BYOK IAM user keys and AWS rejects the request.Change
Use
credentialProvider: () => Promise.resolve({ accessKeyId, secretAccessKey })for Bedrockaccess-keymode so only those fields are supplied (no env session token).Summary by CodeRabbit