Skip to content

Commit

Permalink
fix(bootstrap): bootstrap doesn't work in non-aws partitions anymore …
Browse files Browse the repository at this point in the history
…(revert security hub finding fix) (#25540)

**NOTE**: This PR bumps the version of the bootstrap stack to 18, but there is no need to update your bootstrap stacks as this PR changes no functionality.

We are reverting #24588 because it includes hardcoded partitions in the bootstrap causing the `p0` in #25272. Including intrinsics `${AWS::Partition}` here is impossible. In addition, #24588 was reported to not actually fix the Security Hub finding: #19380 (comment).

Although this is a revert, I am rolling forward the bootstrap version to 18.

reverts #24588. fixes #25272. see #25273 & #25507.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
kaizencc authored and corymhall committed May 11, 2023
1 parent e4a2c01 commit 4c4014e
Showing 1 changed file with 15 additions and 30 deletions.
45 changes: 15 additions & 30 deletions packages/aws-cdk/lib/api/bootstrap/bootstrap-template.yaml
Expand Up @@ -473,35 +473,20 @@ Resources:
StringNotEquals:
s3:ResourceAccount:
Ref: 'AWS::AccountId'
- Fn::If:
- HasTrustedAccounts
- Sid: PipelineCrossAccountArtifactsKey
# Use keys only for the purposes of reading encrypted files from S3.
Effect: Allow
Action:
- kms:Decrypt
- kms:DescribeKey
- kms:Encrypt
- kms:ReEncrypt*
- kms:GenerateDataKey*

# SecurityHub's rule KMS.2 complains if we put a '*' here, so instead we'll
# turn the list of trusted accountIds ['111', '222', ...] into a list of
# wildcard ARNS: ['arn:aws:kms:*:1111:*', 'arn:aws:kms:*:2222:*', ...].
Resource:
Fn::Split:
- "|"
- Fn::Sub:
- "arn:aws:kms:*:${JoinedAccounts}:*"
- JoinedAccounts:
Fn::Join:
- ":*|arn:aws:kms:*:"
- { Ref: TrustedAccounts }
Condition:
StringEquals:
kms:ViaService:
Fn::Sub: s3.${AWS::Region}.amazonaws.com
- { Ref: AWS::NoValue }
- Sid: PipelineCrossAccountArtifactsKey
# Use keys only for the purposes of reading encrypted files from S3.
Effect: Allow
Action:
- kms:Decrypt
- kms:DescribeKey
- kms:Encrypt
- kms:ReEncrypt*
- kms:GenerateDataKey*
Resource: "*"
Condition:
StringEquals:
kms:ViaService:
Fn::Sub: s3.${AWS::Region}.amazonaws.com
- Action: iam:PassRole
Resource:
Fn::Sub: "${CloudFormationExecutionRole.Arn}"
Expand Down Expand Up @@ -633,7 +618,7 @@ Resources:
Type: String
Name:
Fn::Sub: '/cdk-bootstrap/${Qualifier}/version'
Value: '17'
Value: '18'
Outputs:
BucketName:
Description: The name of the S3 bucket owned by the CDK toolkit stack
Expand Down

0 comments on commit 4c4014e

Please sign in to comment.