fix(iam): conditions parameters accept array values#21009
Merged
mergify[bot] merged 6 commits intomainfrom Jul 8, 2022
Merged
Conversation
Because of the type declaration of `Conditions`, which was `{ [key:
string}: any }`, and the way TypeScript interprets `any`, it was
possible to pass arrays in where maps/objects were expected.
Tighten up the type, which is now possible because of a change in jsii.
Closes #20974.
Naumel
reviewed
Jul 6, 2022
| // need to emit the type as `Map<String, ? extends Object>`. | ||
| // | ||
| // Feature request in https://github.com/aws/jsii/issues/1517 | ||
| export type Condition = Record<string, unknown>; |
Contributor
There was a problem hiding this comment.
This has all my non-full-context alarms blaring: is this a victimless change of 1 line, no dependencies?
Contributor
Author
There was a problem hiding this comment.
It should have been, but it doesn't work.
mrgrain
previously requested changes
Jul 7, 2022
Contributor
|
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). |
Collaborator
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Contributor
|
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). |
daschaa
pushed a commit
to daschaa/aws-cdk
that referenced
this pull request
Jul 9, 2022
Because of the type declaration of `Conditions`, which was `{ [key: string]: any }`, and the way TypeScript interprets `any`, it was possible to pass arrays in where maps/objects were expected.
Change the type of `Condition` to `unknown`, which makes the type of `Conditions == { [key: string]: unknown }`. This makes TypeScript no longer accept arrays where objects were expected.
Would love loved to make the type of `Condition == { [key: string]: unknown }` as well to be even tighter, but apparently we rely on being able to pass `CfnJson` in where a condition goes, which is an object.
Closes aws#20974.
----
*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.
Because of the type declaration of
Conditions, which was{ [key: string]: any }, and the way TypeScript interpretsany, it was possible to pass arrays in where maps/objects were expected.Change the type of
Conditiontounknown, which makes the type ofConditions == { [key: string]: unknown }. This makes TypeScript no longer accept arrays where objects were expected.Would love loved to make the type of
Condition == { [key: string]: unknown }as well to be even tighter, but apparently we rely on being able to passCfnJsonin where a condition goes, which is an object.Closes #20974.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license