@aws-solutions-constructs/aws-cloudfront-s3 2.44.0 → 2.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.jsii +106 -17
  2. package/lib/index.d.ts +1 -1
  3. package/lib/index.js +4 -3
  4. package/package.json +5 -5
  5. package/test/{integ.custom-security-headers.expected.json → integ.cfts3-custom-headers.expected.json} +15 -116
  6. package/test/integ.cfts3-custom-headers.js +60 -0
  7. package/test/{integ.custom-originPath.expected.json → integ.cfts3-custom-originPath.expected.json} +11 -112
  8. package/test/integ.cfts3-custom-originPath.js +37 -0
  9. package/test/{integ.customCloudFrontLoggingBucket.expected.json → integ.cfts3-customCloudFrontLoggingBucket.expected.json} +11 -112
  10. package/test/integ.cfts3-customCloudFrontLoggingBucket.js +39 -0
  11. package/test/{integ.customLoggingBucket.expected.json → integ.cfts3-customLoggingBucket.expected.json} +12 -112
  12. package/test/integ.cfts3-customLoggingBucket.js +42 -0
  13. package/test/{integ.existing-bucket.expected.json → integ.cfts3-existing-bucket.expected.json} +14 -115
  14. package/test/integ.cfts3-existing-bucket.js +53 -0
  15. package/test/{integ.no-arguments.expected.json → integ.cfts3-no-arguments.expected.json} +11 -112
  16. package/test/integ.cfts3-no-arguments.js +43 -0
  17. package/test/{integ.no-security-headers.expected.json → integ.cfts3-no-security-headers.expected.json} +8 -109
  18. package/test/integ.cfts3-no-security-headers.js +39 -0
  19. package/test/test.cloudfront-s3.test.js +24 -24
  20. package/test/integ.custom-originPath.js +0 -37
  21. package/test/integ.custom-security-headers.js +0 -60
  22. package/test/integ.customCloudFrontLoggingBucket.js +0 -39
  23. package/test/integ.customLoggingBucket.js +0 -42
  24. package/test/integ.existing-bucket.js +0 -53
  25. package/test/integ.no-arguments.js +0 -43
  26. package/test/integ.no-security-headers.js +0 -39
  27. /package/test/{integ.custom-originPath.d.ts → integ.cfts3-custom-headers.d.ts} +0 -0
  28. /package/test/{integ.custom-security-headers.d.ts → integ.cfts3-custom-originPath.d.ts} +0 -0
  29. /package/test/{integ.customCloudFrontLoggingBucket.d.ts → integ.cfts3-customCloudFrontLoggingBucket.d.ts} +0 -0
  30. /package/test/{integ.customLoggingBucket.d.ts → integ.cfts3-customLoggingBucket.d.ts} +0 -0
  31. /package/test/{integ.existing-bucket.d.ts → integ.cfts3-existing-bucket.d.ts} +0 -0
  32. /package/test/{integ.no-arguments.d.ts → integ.cfts3-no-arguments.d.ts} +0 -0
  33. /package/test/{integ.no-security-headers.d.ts → integ.cfts3-no-security-headers.d.ts} +0 -0
@@ -212,6 +212,7 @@
212
212
  },
213
213
  {
214
214
  "Action": [
215
+ "s3:PutBucketPolicy",
215
216
  "s3:GetBucket*",
216
217
  "s3:List*",
217
218
  "s3:DeleteObject*"
@@ -311,13 +312,13 @@
311
312
  "testcloudfronts3SetHttpSecurityHeaders6C5A1E69": {
312
313
  "Type": "AWS::CloudFront::Function",
313
314
  "Properties": {
315
+ "AutoPublish": true,
314
316
  "FunctionCode": "function handler(event) { var response = event.response; var headers = response.headers; headers['strict-transport-security'] = { value: 'max-age=63072000; includeSubdomains; preload'}; headers['content-security-policy'] = { value: \"default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'\"}; headers['x-content-type-options'] = { value: 'nosniff'}; headers['x-frame-options'] = {value: 'DENY'}; headers['x-xss-protection'] = {value: '1; mode=block'}; return response; }",
315
317
  "FunctionConfig": {
316
- "Comment": "SetHttpSecurityHeadersc824484dfea4176847245e871498ffd7e454223fe4",
318
+ "Comment": "SetHttpSecurityHeadersc8966f7b24c95d47868a69c8831fbd3ccac3fa3d70",
317
319
  "Runtime": "cloudfront-js-1.0"
318
320
  },
319
- "Name": "SetHttpSecurityHeadersc824484dfea4176847245e871498ffd7e454223fe4",
320
- "AutoPublish": true
321
+ "Name": "SetHttpSecurityHeadersc8966f7b24c95d47868a69c8831fbd3ccac3fa3d70"
321
322
  }
322
323
  },
323
324
  "testcloudfronts3CloudfrontLoggingBucket985C0FE8": {
@@ -413,6 +414,7 @@
413
414
  },
414
415
  {
415
416
  "Action": [
417
+ "s3:PutBucketPolicy",
416
418
  "s3:GetBucket*",
417
419
  "s3:List*",
418
420
  "s3:DeleteObject*"
@@ -477,7 +479,7 @@
477
479
  "Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity",
478
480
  "Properties": {
479
481
  "CloudFrontOriginAccessIdentityConfig": {
480
- "Comment": "Identity for customoriginPathtestcloudfronts3CloudFrontDistributionOrigin1B44CC042"
482
+ "Comment": "Identity for cfts3customoriginPathtestcloudfronts3CloudFrontDistributionOrigin1AE2DDD7C"
481
483
  }
482
484
  }
483
485
  },
@@ -499,7 +501,7 @@
499
501
  }
500
502
  }
501
503
  ],
502
- "TargetOriginId": "customoriginPathtestcloudfronts3CloudFrontDistributionOrigin1B44CC042",
504
+ "TargetOriginId": "cfts3customoriginPathtestcloudfronts3CloudFrontDistributionOrigin1AE2DDD7C",
503
505
  "ViewerProtocolPolicy": "redirect-to-https"
504
506
  },
505
507
  "DefaultRootObject": "index.html",
@@ -522,7 +524,7 @@
522
524
  "RegionalDomainName"
523
525
  ]
524
526
  },
525
- "Id": "customoriginPathtestcloudfronts3CloudFrontDistributionOrigin1B44CC042",
527
+ "Id": "cfts3customoriginPathtestcloudfronts3CloudFrontDistributionOrigin1AE2DDD7C",
526
528
  "OriginPath": "/testPath",
527
529
  "S3OriginConfig": {
528
530
  "OriginAccessIdentity": {
@@ -581,18 +583,18 @@
581
583
  "S3Bucket": {
582
584
  "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
583
585
  },
584
- "S3Key": "350185a1069fa20a23a583e20c77f6844218bd73097902362dc94f1a108f5d89.zip"
586
+ "S3Key": "b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6.zip"
585
587
  },
586
588
  "Timeout": 900,
587
589
  "MemorySize": 128,
588
- "Handler": "__entrypoint__.handler",
590
+ "Handler": "index.handler",
589
591
  "Role": {
590
592
  "Fn::GetAtt": [
591
593
  "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092",
592
594
  "Arn"
593
595
  ]
594
596
  },
595
- "Runtime": "nodejs16.x",
597
+ "Runtime": "nodejs18.x",
596
598
  "Description": {
597
599
  "Fn::Join": [
598
600
  "",
@@ -629,109 +631,6 @@
629
631
  }
630
632
  }
631
633
  },
632
- "Mappings": {
633
- "DefaultCrNodeVersionMap": {
634
- "af-south-1": {
635
- "value": "nodejs16.x"
636
- },
637
- "ap-east-1": {
638
- "value": "nodejs16.x"
639
- },
640
- "ap-northeast-1": {
641
- "value": "nodejs16.x"
642
- },
643
- "ap-northeast-2": {
644
- "value": "nodejs16.x"
645
- },
646
- "ap-northeast-3": {
647
- "value": "nodejs16.x"
648
- },
649
- "ap-south-1": {
650
- "value": "nodejs16.x"
651
- },
652
- "ap-south-2": {
653
- "value": "nodejs16.x"
654
- },
655
- "ap-southeast-1": {
656
- "value": "nodejs16.x"
657
- },
658
- "ap-southeast-2": {
659
- "value": "nodejs16.x"
660
- },
661
- "ap-southeast-3": {
662
- "value": "nodejs16.x"
663
- },
664
- "ca-central-1": {
665
- "value": "nodejs16.x"
666
- },
667
- "cn-north-1": {
668
- "value": "nodejs16.x"
669
- },
670
- "cn-northwest-1": {
671
- "value": "nodejs16.x"
672
- },
673
- "eu-central-1": {
674
- "value": "nodejs16.x"
675
- },
676
- "eu-central-2": {
677
- "value": "nodejs16.x"
678
- },
679
- "eu-north-1": {
680
- "value": "nodejs16.x"
681
- },
682
- "eu-south-1": {
683
- "value": "nodejs16.x"
684
- },
685
- "eu-south-2": {
686
- "value": "nodejs16.x"
687
- },
688
- "eu-west-1": {
689
- "value": "nodejs16.x"
690
- },
691
- "eu-west-2": {
692
- "value": "nodejs16.x"
693
- },
694
- "eu-west-3": {
695
- "value": "nodejs16.x"
696
- },
697
- "me-central-1": {
698
- "value": "nodejs16.x"
699
- },
700
- "me-south-1": {
701
- "value": "nodejs16.x"
702
- },
703
- "sa-east-1": {
704
- "value": "nodejs16.x"
705
- },
706
- "us-east-1": {
707
- "value": "nodejs16.x"
708
- },
709
- "us-east-2": {
710
- "value": "nodejs16.x"
711
- },
712
- "us-gov-east-1": {
713
- "value": "nodejs16.x"
714
- },
715
- "us-gov-west-1": {
716
- "value": "nodejs16.x"
717
- },
718
- "us-iso-east-1": {
719
- "value": "nodejs14.x"
720
- },
721
- "us-iso-west-1": {
722
- "value": "nodejs14.x"
723
- },
724
- "us-isob-east-1": {
725
- "value": "nodejs14.x"
726
- },
727
- "us-west-1": {
728
- "value": "nodejs16.x"
729
- },
730
- "us-west-2": {
731
- "value": "nodejs16.x"
732
- }
733
- }
734
- },
735
634
  "Parameters": {
736
635
  "BootstrapVersion": {
737
636
  "Type": "AWS::SSM::Parameter::Value<String>",
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
6
+ * with the License. A copy of the License is located at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
11
+ * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
12
+ * and limitations under the License.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ // Imports
16
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
17
+ const lib_1 = require("../lib");
18
+ const core_1 = require("@aws-solutions-constructs/core");
19
+ // Setup
20
+ const app = new aws_cdk_lib_1.App();
21
+ const stack = new aws_cdk_lib_1.Stack(app, core_1.generateIntegStackName(__filename));
22
+ stack.templateOptions.description = 'Integration Test for originPath with aws-cloudfront-s3';
23
+ new lib_1.CloudFrontToS3(stack, 'test-cloudfront-s3', {
24
+ cloudFrontLoggingBucketProps: {
25
+ removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
26
+ autoDeleteObjects: true
27
+ },
28
+ originPath: '/testPath',
29
+ bucketProps: {
30
+ removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
31
+ autoDeleteObjects: true
32
+ }
33
+ });
34
+ core_1.suppressAutoDeleteHandlerWarnings(stack);
35
+ // Synth
36
+ app.synth();
37
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2Z0czMtY3VzdG9tLW9yaWdpblBhdGguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jZnRzMy1jdXN0b20tb3JpZ2luUGF0aC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7O0dBV0c7O0FBRUgsVUFBVTtBQUNWLDZDQUF3RDtBQUN4RCxnQ0FBd0M7QUFDeEMseURBQTJHO0FBRTNHLFFBQVE7QUFDUixNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLDZCQUFzQixDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUM7QUFDakUsS0FBSyxDQUFDLGVBQWUsQ0FBQyxXQUFXLEdBQUcsd0RBQXdELENBQUM7QUFFN0YsSUFBSSxvQkFBYyxDQUFDLEtBQUssRUFBRSxvQkFBb0IsRUFBRTtJQUM5Qyw0QkFBNEIsRUFBRTtRQUM1QixhQUFhLEVBQUUsMkJBQWEsQ0FBQyxPQUFPO1FBQ3BDLGlCQUFpQixFQUFFLElBQUk7S0FDeEI7SUFDRCxVQUFVLEVBQUUsV0FBVztJQUN2QixXQUFXLEVBQUU7UUFDWCxhQUFhLEVBQUUsMkJBQWEsQ0FBQyxPQUFPO1FBQ3BDLGlCQUFpQixFQUFFLElBQUk7S0FDeEI7Q0FDRixDQUFDLENB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
311
312
  "testcloudfronts3SetHttpSecurityHeaders6C5A1E69": {
312
313
  "Type": "AWS::CloudFront::Function",
313
314
  "Properties": {
315
+ "AutoPublish": true,
314
316
  "FunctionCode": "function handler(event) { var response = event.response; var headers = response.headers; headers['strict-transport-security'] = { value: 'max-age=63072000; includeSubdomains; preload'}; headers['content-security-policy'] = { value: \"default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'\"}; headers['x-content-type-options'] = { value: 'nosniff'}; headers['x-frame-options'] = {value: 'DENY'}; headers['x-xss-protection'] = {value: '1; mode=block'}; return response; }",
315
317
  "FunctionConfig": {
316
- "Comment": "SetHttpSecurityHeadersc88d4d30b2e66a3bd009aa7f11e35596ee70824ece",
318
+ "Comment": "SetHttpSecurityHeadersc853f5cf48adabb9680b666a0c549e9b779fe54127",
317
319
  "Runtime": "cloudfront-js-1.0"
318
320
  },
319
- "Name": "SetHttpSecurityHeadersc88d4d30b2e66a3bd009aa7f11e35596ee70824ece",
320
- "AutoPublish": true
321
+ "Name": "SetHttpSecurityHeadersc853f5cf48adabb9680b666a0c549e9b779fe54127"
321
322
  }
322
323
  },
323
324
  "testcloudfronts3CloudfrontLoggingBucket985C0FE8": {
@@ -413,6 +414,7 @@
413
414
  },
414
415
  {
415
416
  "Action": [
417
+ "s3:PutBucketPolicy",
416
418
  "s3:GetBucket*",
417
419
  "s3:List*",
418
420
  "s3:DeleteObject*"
@@ -477,7 +479,7 @@
477
479
  "Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity",
478
480
  "Properties": {
479
481
  "CloudFrontOriginAccessIdentityConfig": {
480
- "Comment": "Identity for customCloudFrontLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin115B4D0FD"
482
+ "Comment": "Identity for cfts3customCloudFrontLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin18A4ECB64"
481
483
  }
482
484
  }
483
485
  },
@@ -499,7 +501,7 @@
499
501
  }
500
502
  }
501
503
  ],
502
- "TargetOriginId": "customCloudFrontLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin115B4D0FD",
504
+ "TargetOriginId": "cfts3customCloudFrontLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin18A4ECB64",
503
505
  "ViewerProtocolPolicy": "redirect-to-https"
504
506
  },
505
507
  "DefaultRootObject": "index.html",
@@ -522,7 +524,7 @@
522
524
  "RegionalDomainName"
523
525
  ]
524
526
  },
525
- "Id": "customCloudFrontLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin115B4D0FD",
527
+ "Id": "cfts3customCloudFrontLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin18A4ECB64",
526
528
  "S3OriginConfig": {
527
529
  "OriginAccessIdentity": {
528
530
  "Fn::Join": [
@@ -580,18 +582,18 @@
580
582
  "S3Bucket": {
581
583
  "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
582
584
  },
583
- "S3Key": "350185a1069fa20a23a583e20c77f6844218bd73097902362dc94f1a108f5d89.zip"
585
+ "S3Key": "b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6.zip"
584
586
  },
585
587
  "Timeout": 900,
586
588
  "MemorySize": 128,
587
- "Handler": "__entrypoint__.handler",
589
+ "Handler": "index.handler",
588
590
  "Role": {
589
591
  "Fn::GetAtt": [
590
592
  "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092",
591
593
  "Arn"
592
594
  ]
593
595
  },
594
- "Runtime": "nodejs16.x",
596
+ "Runtime": "nodejs18.x",
595
597
  "Description": {
596
598
  "Fn::Join": [
597
599
  "",
@@ -628,109 +630,6 @@
628
630
  }
629
631
  }
630
632
  },
631
- "Mappings": {
632
- "DefaultCrNodeVersionMap": {
633
- "af-south-1": {
634
- "value": "nodejs16.x"
635
- },
636
- "ap-east-1": {
637
- "value": "nodejs16.x"
638
- },
639
- "ap-northeast-1": {
640
- "value": "nodejs16.x"
641
- },
642
- "ap-northeast-2": {
643
- "value": "nodejs16.x"
644
- },
645
- "ap-northeast-3": {
646
- "value": "nodejs16.x"
647
- },
648
- "ap-south-1": {
649
- "value": "nodejs16.x"
650
- },
651
- "ap-south-2": {
652
- "value": "nodejs16.x"
653
- },
654
- "ap-southeast-1": {
655
- "value": "nodejs16.x"
656
- },
657
- "ap-southeast-2": {
658
- "value": "nodejs16.x"
659
- },
660
- "ap-southeast-3": {
661
- "value": "nodejs16.x"
662
- },
663
- "ca-central-1": {
664
- "value": "nodejs16.x"
665
- },
666
- "cn-north-1": {
667
- "value": "nodejs16.x"
668
- },
669
- "cn-northwest-1": {
670
- "value": "nodejs16.x"
671
- },
672
- "eu-central-1": {
673
- "value": "nodejs16.x"
674
- },
675
- "eu-central-2": {
676
- "value": "nodejs16.x"
677
- },
678
- "eu-north-1": {
679
- "value": "nodejs16.x"
680
- },
681
- "eu-south-1": {
682
- "value": "nodejs16.x"
683
- },
684
- "eu-south-2": {
685
- "value": "nodejs16.x"
686
- },
687
- "eu-west-1": {
688
- "value": "nodejs16.x"
689
- },
690
- "eu-west-2": {
691
- "value": "nodejs16.x"
692
- },
693
- "eu-west-3": {
694
- "value": "nodejs16.x"
695
- },
696
- "me-central-1": {
697
- "value": "nodejs16.x"
698
- },
699
- "me-south-1": {
700
- "value": "nodejs16.x"
701
- },
702
- "sa-east-1": {
703
- "value": "nodejs16.x"
704
- },
705
- "us-east-1": {
706
- "value": "nodejs16.x"
707
- },
708
- "us-east-2": {
709
- "value": "nodejs16.x"
710
- },
711
- "us-gov-east-1": {
712
- "value": "nodejs16.x"
713
- },
714
- "us-gov-west-1": {
715
- "value": "nodejs16.x"
716
- },
717
- "us-iso-east-1": {
718
- "value": "nodejs14.x"
719
- },
720
- "us-iso-west-1": {
721
- "value": "nodejs14.x"
722
- },
723
- "us-isob-east-1": {
724
- "value": "nodejs14.x"
725
- },
726
- "us-west-1": {
727
- "value": "nodejs16.x"
728
- },
729
- "us-west-2": {
730
- "value": "nodejs16.x"
731
- }
732
- }
733
- },
734
633
  "Parameters": {
735
634
  "BootstrapVersion": {
736
635
  "Type": "AWS::SSM::Parameter::Value<String>",
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
6
+ * with the License. A copy of the License is located at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
11
+ * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
12
+ * and limitations under the License.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ // Imports
16
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
17
+ const aws_s3_1 = require("aws-cdk-lib/aws-s3");
18
+ const lib_1 = require("../lib");
19
+ const core_1 = require("@aws-solutions-constructs/core");
20
+ // Setup
21
+ const app = new aws_cdk_lib_1.App();
22
+ const stack = new aws_cdk_lib_1.Stack(app, core_1.generateIntegStackName(__filename));
23
+ stack.templateOptions.description = 'Integration Test for aws-cloudfront-s3 custom CloudFront Logging Bubkcet';
24
+ new lib_1.CloudFrontToS3(stack, 'test-cloudfront-s3', {
25
+ bucketProps: {
26
+ removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
27
+ autoDeleteObjects: true
28
+ },
29
+ cloudFrontLoggingBucketProps: {
30
+ removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
31
+ autoDeleteObjects: true,
32
+ encryption: aws_s3_1.BucketEncryption.S3_MANAGED,
33
+ versioned: true
34
+ }
35
+ });
36
+ core_1.suppressAutoDeleteHandlerWarnings(stack);
37
+ // Synth
38
+ app.synth();
39
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2Z0czMtY3VzdG9tQ2xvdWRGcm9udExvZ2dpbmdCdWNrZXQuanMiLCJz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J0Bhd3Mtc29sdXRpb25zLWNvbnN0cnVjdHMvY29yZSc7XG5cbi8vIFNldHVwXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5jb25zdCBzdGFjayA9IG5ldyBTdGFjayhhcHAsIGdlbmVyYXRlSW50ZWdTdGFja05hbWUoX19maWxlbmFtZSkpO1xuc3RhY2sudGVtcGxhdGVPcHRpb25zLmRlc2NyaXB0aW9uID0gJ0ludGVncmF0aW9uIFRlc3QgZm9yIGF3cy1jbG91ZGZyb250LXMzIGN1c3RvbSBDbG91ZEZyb250IExvZ2dpbmcgQnVia2NldCc7XG5cbm5ldyBDbG91ZEZyb250VG9TMyhzdGFjaywgJ3Rlc3QtY2xvdWRmcm9udC1zMycsIHtcbiAgYnVja2V0UHJvcHM6IHtcbiAgICByZW1vdmFsUG9saWN5OiBSZW1vdmFsUG9saWN5LkRFU1RST1ksXG4gICAgYXV0b0RlbGV0ZU9iamVjdHM6IHRydWVcbiAgfSxcbiAgY2xvdWRGcm9udExvZ2dpbmdCdWNrZXRQcm9wczoge1xuICAgIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgICBhdXRvRGVsZXRlT2JqZWN0czogdHJ1ZSxcbiAgICBlbmNyeXB0aW9uOiBCdWNrZXRFbmNyeXB0aW9uLlMzX01BTkFHRUQsXG4gICAgdmVyc2lvbmVkOiB0cnVlXG4gIH1cbn0pO1xuXG5zdXBwcmVzc0F1dG9EZWxldGVIYW5kbGVyV2FybmluZ3Moc3RhY2spO1xuLy8gU3ludGhcbmFwcC5zeW50aCgpO1xuIl19
@@ -86,6 +86,7 @@
86
86
  },
87
87
  {
88
88
  "Action": [
89
+ "s3:PutBucketPolicy",
89
90
  "s3:GetBucket*",
90
91
  "s3:List*",
91
92
  "s3:DeleteObject*"
@@ -275,6 +276,7 @@
275
276
  },
276
277
  {
277
278
  "Action": [
279
+ "s3:PutBucketPolicy",
278
280
  "s3:GetBucket*",
279
281
  "s3:List*",
280
282
  "s3:DeleteObject*"
@@ -374,13 +376,13 @@
374
376
  "testcloudfronts3SetHttpSecurityHeaders6C5A1E69": {
375
377
  "Type": "AWS::CloudFront::Function",
376
378
  "Properties": {
379
+ "AutoPublish": true,
377
380
  "FunctionCode": "function handler(event) { var response = event.response; var headers = response.headers; headers['strict-transport-security'] = { value: 'max-age=63072000; includeSubdomains; preload'}; headers['content-security-policy'] = { value: \"default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'\"}; headers['x-content-type-options'] = { value: 'nosniff'}; headers['x-frame-options'] = {value: 'DENY'}; headers['x-xss-protection'] = {value: '1; mode=block'}; return response; }",
378
381
  "FunctionConfig": {
379
- "Comment": "SetHttpSecurityHeadersc8adfb824ff76ff8867fe60ef9e02c0d312ebd9f83",
382
+ "Comment": "SetHttpSecurityHeadersc8c3d2243132d57b810e98b12d9e3c4c64e6e1cabe",
380
383
  "Runtime": "cloudfront-js-1.0"
381
384
  },
382
- "Name": "SetHttpSecurityHeadersc8adfb824ff76ff8867fe60ef9e02c0d312ebd9f83",
383
- "AutoPublish": true
385
+ "Name": "SetHttpSecurityHeadersc8c3d2243132d57b810e98b12d9e3c4c64e6e1cabe"
384
386
  }
385
387
  },
386
388
  "testcloudfronts3CloudfrontLoggingBucket985C0FE8": {
@@ -476,6 +478,7 @@
476
478
  },
477
479
  {
478
480
  "Action": [
481
+ "s3:PutBucketPolicy",
479
482
  "s3:GetBucket*",
480
483
  "s3:List*",
481
484
  "s3:DeleteObject*"
@@ -540,7 +543,7 @@
540
543
  "Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity",
541
544
  "Properties": {
542
545
  "CloudFrontOriginAccessIdentityConfig": {
543
- "Comment": "Identity for customLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin10D3900D7"
546
+ "Comment": "Identity for cfts3customLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin169BF6A51"
544
547
  }
545
548
  }
546
549
  },
@@ -562,7 +565,7 @@
562
565
  }
563
566
  }
564
567
  ],
565
- "TargetOriginId": "customLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin10D3900D7",
568
+ "TargetOriginId": "cfts3customLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin169BF6A51",
566
569
  "ViewerProtocolPolicy": "redirect-to-https"
567
570
  },
568
571
  "DefaultRootObject": "index.html",
@@ -585,7 +588,7 @@
585
588
  "RegionalDomainName"
586
589
  ]
587
590
  },
588
- "Id": "customLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin10D3900D7",
591
+ "Id": "cfts3customLoggingBuckettestcloudfronts3CloudFrontDistributionOrigin169BF6A51",
589
592
  "S3OriginConfig": {
590
593
  "OriginAccessIdentity": {
591
594
  "Fn::Join": [
@@ -643,18 +646,18 @@
643
646
  "S3Bucket": {
644
647
  "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
645
648
  },
646
- "S3Key": "350185a1069fa20a23a583e20c77f6844218bd73097902362dc94f1a108f5d89.zip"
649
+ "S3Key": "b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6.zip"
647
650
  },
648
651
  "Timeout": 900,
649
652
  "MemorySize": 128,
650
- "Handler": "__entrypoint__.handler",
653
+ "Handler": "index.handler",
651
654
  "Role": {
652
655
  "Fn::GetAtt": [
653
656
  "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092",
654
657
  "Arn"
655
658
  ]
656
659
  },
657
- "Runtime": "nodejs16.x",
660
+ "Runtime": "nodejs18.x",
658
661
  "Description": {
659
662
  "Fn::Join": [
660
663
  "",
@@ -691,109 +694,6 @@
691
694
  }
692
695
  }
693
696
  },
694
- "Mappings": {
695
- "DefaultCrNodeVersionMap": {
696
- "af-south-1": {
697
- "value": "nodejs16.x"
698
- },
699
- "ap-east-1": {
700
- "value": "nodejs16.x"
701
- },
702
- "ap-northeast-1": {
703
- "value": "nodejs16.x"
704
- },
705
- "ap-northeast-2": {
706
- "value": "nodejs16.x"
707
- },
708
- "ap-northeast-3": {
709
- "value": "nodejs16.x"
710
- },
711
- "ap-south-1": {
712
- "value": "nodejs16.x"
713
- },
714
- "ap-south-2": {
715
- "value": "nodejs16.x"
716
- },
717
- "ap-southeast-1": {
718
- "value": "nodejs16.x"
719
- },
720
- "ap-southeast-2": {
721
- "value": "nodejs16.x"
722
- },
723
- "ap-southeast-3": {
724
- "value": "nodejs16.x"
725
- },
726
- "ca-central-1": {
727
- "value": "nodejs16.x"
728
- },
729
- "cn-north-1": {
730
- "value": "nodejs16.x"
731
- },
732
- "cn-northwest-1": {
733
- "value": "nodejs16.x"
734
- },
735
- "eu-central-1": {
736
- "value": "nodejs16.x"
737
- },
738
- "eu-central-2": {
739
- "value": "nodejs16.x"
740
- },
741
- "eu-north-1": {
742
- "value": "nodejs16.x"
743
- },
744
- "eu-south-1": {
745
- "value": "nodejs16.x"
746
- },
747
- "eu-south-2": {
748
- "value": "nodejs16.x"
749
- },
750
- "eu-west-1": {
751
- "value": "nodejs16.x"
752
- },
753
- "eu-west-2": {
754
- "value": "nodejs16.x"
755
- },
756
- "eu-west-3": {
757
- "value": "nodejs16.x"
758
- },
759
- "me-central-1": {
760
- "value": "nodejs16.x"
761
- },
762
- "me-south-1": {
763
- "value": "nodejs16.x"
764
- },
765
- "sa-east-1": {
766
- "value": "nodejs16.x"
767
- },
768
- "us-east-1": {
769
- "value": "nodejs16.x"
770
- },
771
- "us-east-2": {
772
- "value": "nodejs16.x"
773
- },
774
- "us-gov-east-1": {
775
- "value": "nodejs16.x"
776
- },
777
- "us-gov-west-1": {
778
- "value": "nodejs16.x"
779
- },
780
- "us-iso-east-1": {
781
- "value": "nodejs14.x"
782
- },
783
- "us-iso-west-1": {
784
- "value": "nodejs14.x"
785
- },
786
- "us-isob-east-1": {
787
- "value": "nodejs14.x"
788
- },
789
- "us-west-1": {
790
- "value": "nodejs16.x"
791
- },
792
- "us-west-2": {
793
- "value": "nodejs16.x"
794
- }
795
- }
796
- },
797
697
  "Parameters": {
798
698
  "BootstrapVersion": {
799
699
  "Type": "AWS::SSM::Parameter::Value<String>",