Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ssm): correctly deduplicate parameter names #3183

Merged
merged 7 commits into from
Jul 3, 2019

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Jul 3, 2019

Parameter names with '/' in them would not be correctly deduplicated,
since the '/' is also used to delimit identifiers in construct paths.

Change findChild() so it no longer traverses into the tree; if we assume it
will only ever find one child deep, we can do the same kind of escaping
there as we apply to construct IDs.

Fixes #3076.

BREAKING CHANGE:

  • core: construct.findChild() can only find direct children anymore.

Please read the contribution guidelines and follow the pull-request checklist.

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

Parameter names with '/' in them would not be correctly deduplicated,
since the '/' is also used to delimit identifiers in construct paths.

Add protection in core to not allow construct identifiers to be created
with '/' in them, as tryFindChild() would not be able to find it
anymore.

Fixes #3076.
@rix0rrr rix0rrr requested review from SoManyHs and a team as code owners July 3, 2019 09:10
@ghost ghost requested a review from eladb July 3, 2019 09:10
*/
function sanitizeId(id: string) {
// Escape path seps as double dashes
return id.replace(/\//g, '--');
Copy link
Contributor

Choose a reason for hiding this comment

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

Use PATH_SEP

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

Update PR description

@eladb eladb merged commit 47bf435 into master Jul 3, 2019
@eladb eladb deleted the huijbers/slashes-in-construct-name branch July 3, 2019 11:58
Kaixiang-AWS pushed a commit to Kaixiang-AWS/aws-cdk that referenced this pull request Jul 3, 2019
Parameter names with '/' in them would not be correctly deduplicated,
since the '/' is also used to delimit identifiers in construct paths.

Change findChild() so it no longer traverses into the tree; if we assume it
will only ever find one child deep, we can do the same kind of escaping
there as we apply to construct IDs.

Fixes aws#3076.

BREAKING CHANGE: `construct.findChild()` now only looks up direct children
@NGL321 NGL321 added the contribution/core This is a PR that came from AWS. label Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with machineImages when multiple autoscalinggroups in the same scope
3 participants