Skip to content

feat(cloudfront): mutual TLS#36245

Open
badmintoncryer wants to merge 43 commits intoaws:mainfrom
badmintoncryer:mtls
Open

feat(cloudfront): mutual TLS#36245
badmintoncryer wants to merge 43 commits intoaws:mainfrom
badmintoncryer:mtls

Conversation

@badmintoncryer
Copy link
Copy Markdown
Contributor

@badmintoncryer badmintoncryer commented Nov 30, 2025

Issue # (if applicable)

None

Reason for this change

AWS cloudfront now supports for mTLS authentication.
https://aws.amazon.com/jp/about-aws/whats-new/2025/11/amazon-cloudfront-mutual-tls-authentication/

Description of changes

L2 Construct Implementation
(distribution.ts)

  • Added MtlsMode enum with REQUIRED and OPTIONAL values
  • Added ViewerMtlsConfig interface with flat structure:
    • mode: mTLS enforcement mode
    • trustStore: Interface of the CloudFront TrustStore
    • advertiseTrustStoreCaNames: Optional flag to advertise CA names during TLS handshake
    • ignoreCertificateExpiry: Optional flag to accept expiredcertificates
  • Added viewerMtlsConfig property to DistributionProps

Add truststore L2 construct.

Describe any new or updated permissions being added

None

Description of how you validated changes

added both unit and integ tests

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the p2 label Nov 30, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team November 30, 2025 01:20
@github-actions github-actions bot added the distinguished-contributor [Pilot] contributed 50+ PRs to the CDK label Nov 30, 2025
@aws-cdk-automation aws-cdk-automation added pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Nov 30, 2025
@aws-cdk-automation aws-cdk-automation removed the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Nov 30, 2025
@badmintoncryer
Copy link
Copy Markdown
Contributor Author

It might be better to avoid using NodejsFunction in integ test.

Copy link
Copy Markdown
Contributor

@mazyu36 mazyu36 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. Before reviewing, let me confirm the implementation direction.

});

// Create TrustStore using L1 construct (CfnTrustStore)
const trustStore = new cloudfront.CfnTrustStore(this, 'TrustStore', {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason why the trust store is not implemented as an L2 construct?
I don't think creating L2 constructs is mandatory, so if you have a reason, please let me know.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, I’m planning to implement it! My initial thought was to merge this PR first, then implement the L2 for truststore while deprecating truststoreId.

However, I’m starting to think it might not be ideal to implement an argument that will soon become obsolete. So it might be better to either implement the L2 first, or include it in this PR.

That said, including the L2 implementation might make this PR a bit too large. What are your thoughts on this?​​​​​​​​​​​​​​​​

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.
In my opinion, if you are going to deprecate the property after implementing L2, it would be better to implement L2 from the beginning. I don't think the trust store itself will be a very complex construct.
If you're not going to deprecate it, I think the current policy is fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I'll add TruestStore L2 construct in this PR. Please wait for a while.

Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 5, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
This security report is NOT a review blocker. Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results48 ran48 passed
TestResult
No test annotations available

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 5, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
This security report is NOT a review blocker. Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates48 ran48 passed
TestResult
No test annotations available

@aws-cdk-automation aws-cdk-automation dismissed their stale review December 5, 2025 13:57

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Dec 5, 2025
@DCzajkowski
Copy link
Copy Markdown

Sorry for the nudge, but are there plans to merge this? Our organization would benefit from using this new feature, but as of now we are blocked.

@badmintoncryer
Copy link
Copy Markdown
Contributor Author

@DCzajkowski This PR is waiting for maintainer's review. Please wait for a while. I think it would take a several months to be merged.

@mazyu36
Copy link
Copy Markdown
Contributor

mazyu36 commented Mar 10, 2026

@badmintoncryer
I already approved , but CI is now failing because of other PRs merged since then.
Could you fix them?

aws-cdk-lib: error: [awslint:prefer-ref-interface:aws-cdk-lib.aws_cloudfront.ViewerMtlsConfig.trustStore] API should prefer to use the L1 reference interface (IxxxRef) and not the L2 interface (aws-cdk-lib.aws_cloudfront.ITrustStore). If this is intentional, add "[disable-awslint:prefer-ref-interface]" to element's jsdoc
aws-cdk-lib: error: [awslint:prefer-ref-interface:aws-cdk-lib.aws_cloudfront.CaCertificatesBundleS3Location.bucket] API should prefer to use the L1 reference interface (IxxxRef) and not the L2 interface (aws-cdk-lib.aws_s3.IBucket). If this is intentional, add "[disable-awslint:prefer-ref-interface]" to element's jsdoc
aws-cdk-lib: Error: /codebuild/output/src1798668233/src/actions-runner/_work/aws-cdk/aws-cdk/tools/@aws-cdk/cdk-build-tools/bin/cdk-awslint exited with error code 1
aws-cdk-lib: Build failed.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
aws-cdk-lib: 

@badmintoncryer
Copy link
Copy Markdown
Contributor Author

@mazyu36 Thanks! I've not realized the error. I'll fix it later.

- Use ITrustStoreRef instead of ITrustStore for ViewerMtlsConfig.trustStore
- Use IBucketRef instead of IBucket for CaCertificatesBundleS3Location.bucket
- Convert integ test zip asset to Git LFS pointer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t/no-duplicates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use `import type` for Construct in integ.distribution-mtls.ts
- Remove unused eslint-disable directive in mtls-test-handler.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fn::GetAtt -> Ref for TrustStoreId, both resolve to the same value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DCzajkowski
Copy link
Copy Markdown

@badmintoncryer sorry for the ping, but it seems like the PR is green and approved. Is there anything left to do?

@badmintoncryer
Copy link
Copy Markdown
Contributor Author

@DCzajkowski Thanks! This PR passed community review and is waiting for maintainers review. I think it will take several months...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distinguished-contributor [Pilot] contributed 50+ PRs to the CDK p2 pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. pr/needs-maintainer-review This PR needs a review from a Core Team Member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants