You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(pipelines): pipeline asset role trust policy has account root principal (#30084)
### Reason for this change
CDK Pipeline will create a `AssetFileRole` which has trust policy including the root account principal. The root account principal is not needed in this use case and should be removed to scope down trust policy.
### Description of changes
Adding a new feature flag `PIPELINE_REDUCE_ASSET_ROLE_TRUST_SCOPE` with default value `true`.
When the feature flag is enabled, remove the root account principal from the trust policy.
When the feature flag is disabled, keep the old behavior.
Using the feature flag here in case of customers are using the root account principal and it will allow them to turn off this change.
### Description of how you validated changes
Unit test/Integration Test
Manually tested in cross-account pipeline
### 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*
Copy file name to clipboardExpand all lines: packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-file-system-locations.js
Copy file name to clipboardExpand all lines: packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-file-system-locations.js.snapshot/PipelinesFileSystemLocations.assets.json
Copy file name to clipboardExpand all lines: packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-file-system-locations.js.snapshot/PipelinesFileSystemLocations.template.json
Copy file name to clipboardExpand all lines: packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-file-system-locations.js.snapshot/manifest.json
Copy file name to clipboardExpand all lines: packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-file-system-locations.js.snapshot/tree.json
Copy file name to clipboardExpand all lines: packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-file-system-locations.ts
+2
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@ import * as codebuild from 'aws-cdk-lib/aws-codebuild';
Copy file name to clipboardExpand all lines: packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md
+20-1
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,7 @@ Flags come in three types:
69
69
|[@aws-cdk/aws-kms:reduceCrossAccountRegionPolicyScope](#aws-cdkaws-kmsreducecrossaccountregionpolicyscope)| When enabled, IAM Policy created from KMS key grant will reduce the resource scope to this key only. | 2.134.0 | (fix) |
70
70
|[@aws-cdk/aws-eks:nodegroupNameAttribute](#aws-cdkaws-eksnodegroupnameattribute)| When enabled, nodegroupName attribute of the provisioned EKS NodeGroup will not have the cluster name prefix. | 2.139.0 | (fix) |
71
71
|[@aws-cdk/aws-ec2:ebsDefaultGp3Volume](#aws-cdkaws-ec2ebsdefaultgp3volume)| When enabled, the default volume type of the EBS volume will be GP3 | 2.140.0 | (default) |
72
+
|[@aws-cdk/pipelines:reduceAssetRoleTrustScope](#aws-cdkpipelinesreduceassetroletrustscope)| Remove the root account principal from PipelineAssetsFileRole trust policy | V2NEXT | (default) |
72
73
73
74
<!-- END table -->
74
75
@@ -171,6 +172,7 @@ are migrating a v1 CDK project to v2, explicitly set any of these flags which do
|[@aws-cdk/aws-lambda:recognizeVersionProps](#aws-cdkaws-lambdarecognizeversionprops)| Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`. | (fix) | 1.106.0 |`false`|`true`|
173
174
|[@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2\_2021](#aws-cdkaws-cloudfrontdefaultsecuritypolicytlsv12_2021)| Enable this feature flag to have cloudfront distributions use the security policy TLSv1.2_2021 by default. | (fix) | 1.117.0 |`false`|`true`|
175
+
|[@aws-cdk/pipelines:reduceAssetRoleTrustScope](#aws-cdkpipelinesreduceassetroletrustscope)| Remove the root account principal from PipelineAssetsFileRole trust policy | (default) ||`false`|`true`|
174
176
175
177
<!-- END diff -->
176
178
@@ -185,7 +187,8 @@ Here is an example of a `cdk.json` file that restores v1 behavior for these flag
@@ -1298,4 +1301,20 @@ When this featuer flag is enabled, the default volume type of the EBS volume wil
1298
1301
**Compatibility with old behavior:** Pass `volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD` to `Volume` construct to restore the previous behavior.
1299
1302
1300
1303
1304
+
### @aws-cdk/pipelines:reduceAssetRoleTrustScope
1305
+
1306
+
*Remove the root account principal from PipelineAssetsFileRole trust policy* (default)
1307
+
1308
+
When this feature flag is enabled, the root account principal will not be added to the trust policy of asset role.
1309
+
When this feature flag is disabled, it will keep the root account principal in the trust policy.
1310
+
1311
+
1312
+
| Since | Default | Recommended |
1313
+
| ----- | ----- | ----- |
1314
+
| (not in v1) | | |
1315
+
| V2NEXT | `true` | `true` |
1316
+
1317
+
**Compatibility with old behavior:** Disable the feature flag to add the root account principal back
0 commit comments