-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
StepFunctions: Ensure Service Integrations Assume State Machine Role Credentials #12089
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
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 33m 34s ⏱️ - 1h 19m 47s Results for commit c3e071a. ± Comparison against base commit 5399278. This pull request removes 2571 tests.
|
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.
LGTM, great job figuring this out so quickly.
if not self.credentials: | ||
task_credentials = dict() | ||
state_credentials = StateCredentials(role_arn=env.aws_execution_details.role_arn) |
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.
nice 🙌
if not self.credentials: | ||
task_credentials = dict() | ||
state_credentials = StateCredentials(role_arn=env.aws_execution_details.role_arn) | ||
else: | ||
self.credentials.eval(env=env) |
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.
Could this fail? if so, what would/should be the behavior here then? 🤔
Also curious if (not here) a failed assume role would also lead to falling back to the role ARN potentially? I'd assume not, since that might be a security issue.
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.
The computation of the user-defined credentials block can fail, we have some test cases to validate our handling of such failures aws.services.stepfunctions.v2.credentials.test_credentials_base.TestCredentialsBase.test_invalid_credentials_field
In the tandem PR, which adds tests for SFN IAM enforcement, I did not see this behaviour, instead the failure is simply passed upstream
Motivation
Currently, the SFN v2 interpreter creates boto clients for service integrations using user credentials if no explicit credentials are provided. This causes IAM policy checks to succeed incorrectly event when
ENFORCE_IAM=1
is set, as the checks were based on the user's permissions rather than those of the state machine's assumed role #11927. This fix ensures boto clients are created with the assumed role credentials of the state machine.Changes
Credentials
values are always computed and defaulted to the state machine role arn if not manual override is given