fix(core): undeployable due to invalid mapping#18922
Merged
mergify[bot] merged 3 commits intomasterfrom Feb 11, 2022
Merged
Conversation
kaizencc
commented
Feb 10, 2022
| } | ||
|
|
||
| private validateMapping(mapping: Mapping): Mapping { | ||
| Object.keys(mapping).forEach((m) => Object.keys(mapping[m]).forEach(this.validateAlphanumeric)); |
Contributor
Author
There was a problem hiding this comment.
Not sure if this matters other than for testing but -- the complexity of this function looks to be O(nm). Can't think of a better way to do it but I'm curious if this is prohibitive (I feel like its ok).
rix0rrr
approved these changes
Feb 11, 2022
Contributor
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Contributor
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Collaborator
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
TikiTDO
pushed a commit
to TikiTDO/aws-cdk
that referenced
this pull request
Feb 21, 2022
In aws#17984, mappings were altered so that non-alphanumeric values were replaced with `_`. However, the names in the name-value pairs must be fully alphanumeric according to the [docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html). The result was potentially invalid mappings generated at `cdk synth` that would fail at `cdk deploy`. One such example is the mappings generated for `lambda-insights` in aws#18789. In this PR, the replacement value is updated from `_` to `x`. The mapping is not surfaced anywhere other than the template, so we just need a value that satisfies cloudformation. Thus we're okay with the slight loss of readability. In addition, `CfnMapping` is updated to validate the names in the name-value pair and ensure that it is alphanumeric. Fixes aws#18789. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #17984, mappings were altered so that non-alphanumeric values were replaced with
_. However, the names in the name-value pairs must be fully alphanumeric according to the docs. The result was potentially invalid mappings generated atcdk synththat would fail atcdk deploy. One such example is the mappings generated forlambda-insightsin #18789.In this PR, the replacement value is updated from
_tox. The mapping is not surfaced anywhere other than the template, so we just need a value that satisfies cloudformation. Thus we're okay with the slight loss of readability. In addition,CfnMappingis updated to validate the names in the name-value pair and ensure that it is alphanumeric.Fixes #18789.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license