fix(cloudfront-origins): validate httpPort and httpsPort range in HttpOrigin - #37872
Conversation
|
👋 It looks like your PR description follows the template but is missing a valid issue number in the first section. PRs without a linked issue will receive lower priority for review and merging. Please update the description to include a reference like |
Exemption RequestThis PR only adds synth-time input validation in The same pattern was previously introduced for |
leonmk-aws
left a comment
There was a problem hiding this comment.
Thank you for your contribution
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status
This pull request spent 13 seconds in the queue, including 2 seconds running CI. Required conditions to merge
|
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
None
Reason for this change
HttpOriginacceptshttpPortandhttpsPortasnumberprops but performs no validation on them. Invalid values (e.g.,0, negative numbers, ports reserved by other services, values greater than65535, or non-integer values) pass through synth and only fail at CloudFormation deploy time with a generic error.Per the CloudFront Developer Guide, valid values for both ports are
80,443, or1024-65535.Description of changes
Added synth-time validation in
HttpOriginforhttpPortandhttpsPortas a privatevalidatePortNumbermethod, mirroring the pattern already used inVpcOrigin:80,443, or an integer between1024and65535(inclusive), matching the documented CloudFront constraint.Token.isUnresolved(...)so CDK tokens (e.g.,CfnParametervalues) are passed through.UnscopedValidationErrorwith a descriptive message including the received value.Describe any new or updated permissions being added
None.
Description of how you validated changes
Added 16 new unit test cases in
aws-cloudfront-origins/test/http-origin.test.tscovering, for bothhttpPortandhttpsPort.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license