-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix(stepfunctions-tasks): map bedrockagent service to bedrock IAM prefix #35147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add bedrockagent: 'bedrock' mapping to iamServiceMap in CallAwsService to ensure correct IAM permissions are generated. Without this mapping, Step Functions tasks using service='bedrockagent' would generate incorrect 'bedrockagent:action' IAM permissions instead of the correct 'bedrock:action' format required by AWS IAM. Fixes issue where Bedrock Agent actions like startIngestionJob and getIngestionJob would fail with access denied errors due to incorrect IAM policy generation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
Exemption Request Unit tests are sufficient - They verify the IAM policy generation works correctly |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pahud! I will request a security review for this, I'll come back to this when I have an update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
Add
bedrockagent: 'bedrock'
mapping to iamServiceMap in CallAwsService to ensure correct IAM permissions are generated. Without this mapping, Step Functions tasks using service='bedrockagent' would generate incorrect 'bedrockagent:action' IAM permissions instead of the correct 'bedrock:action' format required by AWS IAM.Fixes issue where Bedrock Agent actions like startIngestionJob and getIngestionJob would fail with access denied errors due to incorrect IAM policy generation.
Issue # (if applicable)
Closes #35146
Reason for this change
The CDK's Step Functions SDK integration (
CallAwsService
) generates incorrect IAM permissions for Amazon Bedrock Agent actions. When usingservice="bedrockagent"
with actions likestartIngestionJob
andgetIngestionJob
, the auto-generated IAM policy incorrectly uses thebedrockagent:
service prefix instead of the correctbedrock:
prefix.This causes Step Functions executions to fail with access denied errors because AWS IAM uses
bedrock:
as the service prefix for all Bedrock-related actions, including Bedrock Agent operations.Description of changes
Core Change:
bedrockagent: 'bedrock'
mapping to the existingiamServiceMap
object inCallAwsService
classmwaa: 'airflow'
,sfn: 'states'
)Test Coverage:
'IAM policy for bedrockagent'
following existing test patternsservice: 'bedrockagent'
generates correctbedrock:startIngestionJob
IAM actionFiles Modified:
packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts
- Added mappingpackages/aws-cdk-lib/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts
- Added testDesign Decision:
This approach was chosen because it follows the existing architecture pattern and requires minimal code changes while maintaining backward compatibility. Alternative approaches like modifying the IAM action generation logic would be more invasive and risky.
Describe any new or updated permissions being added
No new permissions are being added. This change corrects the IAM service prefix from
bedrockagent:
tobedrock:
for existing Bedrock Agent actions. The actions themselves (startIngestionJob
,getIngestionJob
, etc.) remain the same.Description of how you validated changes
Unit Tests:
'IAM policy for bedrockagent'
that verifies correct IAM policy generationManual Testing:
CallAwsService
withservice: 'bedrockagent'
now generatesbedrock:startIngestionJob
instead ofbedrockagent:startIngestionJob
Test Results:
IAM policy for bedrockagent
- PASSEDChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license