fix(api): Fix panic that occurred when sentry-cli login called with --auth-token#1893
Merged
szokeasaurusrex merged 3 commits intomasterfrom Jan 8, 2024
Merged
Conversation
Perform client-side validation of all Auth Tokens input to the Sentry CLI. To ensure future-compatibility, we only provide soft validation, meaning that we only print a warning message if we detect that the Auth Token is invalid – the CLI will still proceed with normal execution if the Auth Token is invalid. Fixes GH-1859
szokeasaurusrex
commented
Jan 8, 2024
| config.get_base_url()? | ||
| ); | ||
| let predefined_token = matches.get_one::<String>("auth_token"); | ||
| let predefined_token = matches.get_one::<AuthToken>("auth_token"); |
Member
Author
There was a problem hiding this comment.
This is the change that fixes the error – the other changes to this file in this commit are to handle the new type
Swatinem
approved these changes
Jan 8, 2024
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.
This PR fixes the bug in #1885 that led us to revert that commit. The bug, reported in #1888, caused the CLI to panic when the
sentry-cli logincommand was called with the--auth-tokenargument.We determined that the CLI panicked because the
auth_tokenwas being downcast to aStringinstead of to anAuthTokentype when being read from thematcheswithin thelogincommand. This PR corrects thelogincommand, so that theauth_tokenis correctly obtained from thematchesas anAuthToken. We also checked whether theauth_tokenargument was being read as aStringanywhere else in the code, and found that thelogincommand was the only place the argument was being read as aString. Therefore, we would expect this PR to fix this class of bug completely.Fixes GH-1859
Fixes GH-1888