Skip to content

aws-cloudfront: minimumProtocolVersion setting should not be allowed without custom SSL/TLS certificate #35404

@bruniela

Description

@bruniela

Describe the feature

AWS CDK allows to deploy a CloudFront distribution with the following structure:

new Distribution(this, 'Distribution', {
  defaultBehavior: {
      origin: s3Origin,
      viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
  },
  defaultRootObject: 'index.html',
  sslSupportMethod: SSLMethod.SNI,
  minimumProtocolVersion: SecurityPolicyProtocol.TLS_V1_2_2021,
  webAclId: webAcl.attrArn
});

However, minimumProtocolVersion is a setting that is ignored by CloudFront, as it only allows to set the Security Policy Protocol if a custom SSL/TLS certificate is used (otherwise it will default to TLSv1 despite what has been set in the CDK app). This information is missing from the AWS CDK documentation, and very difficult to find on the CloudFront documentation.

Use Case

Since AWS CDK did not give any warning or error, nor informed me in documentation, I was led to believe that my CloudFront distribution was using TLS 1.2 as its minimum accepted protocol. A scan then revealed that was actually not the case, and that is was accepting TLS 1.0 and TLS 1.1 as well.

Proposed Solution

This setting should not be allowed to be defined without a custom SSL/TLS certificate. On cdk synth, an error should appear, informing the developer that if minimumProtocolVersion is set, certificate is also required to be set. This information should be included in the documentation as well.

Other Information

Documentation about the issue:

AWS CDK CloudFront Distribution class

AWS CDK CloudFront Security Policy Protocol enum

CloudFront Security Policy

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS CDK Library version (aws-cdk-lib)

2.214.0

AWS CDK CLI version

2.1027.0

Environment details (OS name and version, etc.)

KDE neon 6.0

Metadata

Metadata

Labels

@aws-cdk/aws-cloudfrontRelated to Amazon CloudFrontbugThis issue is a bug.effort/smallSmall work item – less than a day of effortgood first issueRelated to contributions. See CONTRIBUTING.mdp1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions