Commit 2d901f4
authored
fix(codepipeline): replace account root principal with pipeline role in trust policy for cross-account actions (under feature flag) (#34074)
### Issue # (if applicable)
[GHSA-5pq3-h73f-66hr](GHSA-5pq3-h73f-66hr)
### Reason for this change
See GHSA for details.
### Description of changes
Added new feature flag `@aws-cdk/pipelines:reduceCrossAccountActionRoleTrustScope`
When the feature flag `@aws-cdk/pipelines:reduceCrossAccountActionRoleTrustScope` is set to true:
- Scope down cross-account action role's trust policy to the pipeline role
- Set pipeline role's `roleName` to `PhysicalName.GENERATE_IF_NEEDED`
### Describe any new or updated permissions being added
Cross-account action role trust policy is scoped with condition key `ArnEquals` when feature flag is enabled:
```
"Statement": [
{
"Action": "sts:AssumeRole",
"Condition": {
"ArnEquals": {
"aws:PrincipalArn": "<pipelineRoleARN>"
}
},
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<pipelineStack.account>:root"
}
}
],
```
### Description of how you validated changes
Added integration tests for S3, StepFunction, and Cloudformation codepipeline actions and manually verified that the cross-account action was successfully completed (reading S3 bucket, invoking state machine, and deploying a cloudformation stack in the cross-account).
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*1 parent 3da0c4d commit 2d901f4
File tree
54 files changed
+11030
-204
lines changed- packages
- @aws-cdk-testing/framework-integ/test
- aws-codepipeline-actions/test
- integ.cross-account-pipeline-cfn-action.js.snapshot
- asset.44e9c4d7a5d3fd2d677e1a7e416b2b56f6b0104bd5eff9cac5557b4c65a9dc61
- asset.4fe0aba5e672b596d0f72505a9eec502f98d46906bb30fae2511fbdc1df4956f
- asset.5bcf205623ea5b34a1944fea4c9982e835555e710235ae6f60172097737302e2
- integ.cross-account-pipeline-sfn-action.js.snapshot
- asset.44e9c4d7a5d3fd2d677e1a7e416b2b56f6b0104bd5eff9cac5557b4c65a9dc61
- asset.4fe0aba5e672b596d0f72505a9eec502f98d46906bb30fae2511fbdc1df4956f
- pipelines/test
- integ.cross-account-pipeline-action.js.snapshot
- assembly-CdkPipelineInvestigationStack-Prod
- asset.44e9c4d7a5d3fd2d677e1a7e416b2b56f6b0104bd5eff9cac5557b4c65a9dc61
- asset.4fe0aba5e672b596d0f72505a9eec502f98d46906bb30fae2511fbdc1df4956f
- asset.fbee18a86723a24ee3c75971c14b5bbff255873d741f6bbdde2218433a37a74d
- aws-cdk-lib
- aws-codepipeline/lib
- cx-api
- lib
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
54 files changed
+11030
-204
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments