-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(cli): --notification-arns
not validated
#20806
Labels
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
good first issue
Related to contributions. See CONTRIBUTING.md
p1
package/tools
Related to AWS CDK Tools or CLI
Comments
4 tasks
mergify bot
pushed a commit
that referenced
this issue
Jul 23, 2022
When deploying using the `--notification-arns` argument, it's possible to pass in an invalid arn as an SNS topic arn, causing a change set to be uploaded with an invalid arn. This PR adds a check for the structure of the input ARN. I was originally looking into possibly adding the check earlier in the process such as adding a .check() method to the yargs option in [packages/aws-cdk/lib/cli.ts](https://github.com/aws/aws-cdk/blob/f66f94e9201b9c9d5e0f1b713a6f30194b323b28/packages/aws-cdk/lib/cli.ts). But as I see it there are no tests for these, so it was difficult to validate the change. closes #20806 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
comcalvi
pushed a commit
to comcalvi/aws-cdk
that referenced
this issue
Jul 25, 2022
When deploying using the `--notification-arns` argument, it's possible to pass in an invalid arn as an SNS topic arn, causing a change set to be uploaded with an invalid arn. This PR adds a check for the structure of the input ARN. I was originally looking into possibly adding the check earlier in the process such as adding a .check() method to the yargs option in [packages/aws-cdk/lib/cli.ts](https://github.com/aws/aws-cdk/blob/f66f94e9201b9c9d5e0f1b713a6f30194b323b28/packages/aws-cdk/lib/cli.ts). But as I see it there are no tests for these, so it was difficult to validate the change. closes aws#20806 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
josephedward
pushed a commit
to josephedward/aws-cdk
that referenced
this issue
Aug 30, 2022
When deploying using the `--notification-arns` argument, it's possible to pass in an invalid arn as an SNS topic arn, causing a change set to be uploaded with an invalid arn. This PR adds a check for the structure of the input ARN. I was originally looking into possibly adding the check earlier in the process such as adding a .check() method to the yargs option in [packages/aws-cdk/lib/cli.ts](https://github.com/aws/aws-cdk/blob/f66f94e9201b9c9d5e0f1b713a6f30194b323b28/packages/aws-cdk/lib/cli.ts). But as I see it there are no tests for these, so it was difficult to validate the change. closes aws#20806 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
good first issue
Related to contributions. See CONTRIBUTING.md
p1
package/tools
Related to AWS CDK Tools or CLI
Describe the bug
When deploying using the
--notification-arns
argument, it's possible to pass in an invalid arn as an SNS topic arn, causing a change set to be uploaded with an invalid arn. If possible, the cli should at least validate the structure of the notification arn's being passed in.Creating a change set with an invalid SNS arn seems to put the stack into a bad state, as the change seemingly cannot be deleted. So far I've found the only remedy is to delete the stack
Expected Behavior
Expected the cli to throw when receiving invalid notification arns.
Current Behavior
The deploy still uploads a change set with an invalid SNS topic arn.
Reproduction Steps
This can be reproduced easily with any type of stack.
--notification-arns
cdk deploy --require-approval never --all
arn:aws:sns:us-east-1::some-sns-topic
cdk deploy --require-approval never --all --notification-arns arn:aws:sns:us-east-1::some-sns-topic
An error occurred (InvalidChangeSetStatus) when calling the DeleteChangeSet operation: An operation on this ChangeSet is currently in progress. Please attempt this operation again later.
Possible Solution
The nicest thing to have is making a check to see if the SNS topic in fact exists. However even the simplest check for a valid SNS arn structure could prevent this from occurring.
Additional Information/Context
No response
CDK CLI Version
2.27.0
Framework Version
No response
Node.js Version
14.19.1
OS
Macos Monterey
Language
Typescript
Language Version
Typescrit 4.5.5
Other information
No response
The text was updated successfully, but these errors were encountered: