Skip to content

Commit 0b80db5

Browse files
authoredDec 9, 2021
fix(codepipeline): default cross-region S3 buckets allow public access (#17722)
The cross region S3 buckets that are created should have block public access by default. Fixes #16411 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent cc3bb1f commit 0b80db5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

‎packages/@aws-cdk/aws-codepipeline/lib/private/cross-region-support-stack.ts

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export class CrossRegionSupportConstruct extends Construct {
7777
bucketName: cdk.PhysicalName.GENERATE_IF_NEEDED,
7878
encryption: encryptionAlias ? s3.BucketEncryption.KMS : s3.BucketEncryption.KMS_MANAGED,
7979
encryptionKey: encryptionAlias,
80+
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
8081
});
8182
}
8283
}

‎packages/@aws-cdk/aws-codepipeline/test/cross-env.test.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,14 @@ describe.each([
129129

130130
// THEN
131131
expect(supportStack).not.toHaveResource('AWS::KMS::Key');
132-
expect(supportStack).toHaveResource('AWS::S3::Bucket');
132+
expect(supportStack).toHaveResourceLike('AWS::S3::Bucket', {
133+
PublicAccessBlockConfiguration: {
134+
BlockPublicAcls: true,
135+
BlockPublicPolicy: true,
136+
IgnorePublicAcls: true,
137+
RestrictPublicBuckets: true,
138+
},
139+
});
133140
});
134141

135142
test('when twiddling another stack', () => {

0 commit comments

Comments
 (0)
Please sign in to comment.