Skip to content

Commit

Permalink
Enforce SSL on library controlled buckets.
Browse files Browse the repository at this point in the history
  • Loading branch information
nateglims committed Oct 9, 2023
1 parent 75bb651 commit db3eeac
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/build-image-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class BuildImageDataStack extends cdk.Stack {
versioned: true,
removalPolicy: cdk.RemovalPolicy.DESTROY,
autoDeleteObjects: true,
enforceSSL: true,
});

const dataBucketDeploymentRole = new iam.Role(
Expand Down
34 changes: 34 additions & 0 deletions test/__snapshots__/build-image-data.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,40 @@ exports[`Build Image Data Snapshot 1`] = `
},
"PolicyDocument": {
"Statement": [
{
"Action": "s3:*",
"Condition": {
"Bool": {
"aws:SecureTransport": "false",
},
},
"Effect": "Deny",
"Principal": {
"AWS": "*",
},
"Resource": [
{
"Fn::GetAtt": [
"BuildImageDataBucketE6A8BC04",
"Arn",
],
},
{
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"BuildImageDataBucketE6A8BC04",
"Arn",
],
},
"/*",
],
],
},
],
},
{
"Action": [
"s3:GetBucket*",
Expand Down
4 changes: 0 additions & 4 deletions test/build-image-data-nag.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ describe('BuildImageDataStack cdk-nag AwsSolutions Pack', () => {
id: 'AwsSolutions-IAM5',
reason: 'TODO: Re-evaluate "*" per resources.',
},
{
id: 'AwsSolutions-S10',
reason: 'TODO: Require SSL for bucket access.',
},
]);

NagSuppressions.addResourceSuppressionsByPath(
Expand Down

0 comments on commit db3eeac

Please sign in to comment.