Skip to content

fix(api): Fix panic that occurred when sentry-cli login called with --auth-token#1893

Merged
szokeasaurusrex merged 3 commits intomasterfrom
szokeasaurusrex/auth-token-login-error
Jan 8, 2024
Merged

fix(api): Fix panic that occurred when sentry-cli login called with --auth-token#1893
szokeasaurusrex merged 3 commits intomasterfrom
szokeasaurusrex/auth-token-login-error

Conversation

@szokeasaurusrex
Copy link
Copy Markdown
Member

@szokeasaurusrex szokeasaurusrex commented Jan 8, 2024

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 login command was called with the --auth-token argument.

We determined that the CLI panicked because the auth_token was being downcast to a String instead of to an AuthToken type when being read from the matches within the login command. This PR corrects the login command, so that the auth_token is correctly obtained from the matches as an AuthToken. We also checked whether the auth_token argument was being read as a String anywhere else in the code, and found that the login command was the only place the argument was being read as a String. Therefore, we would expect this PR to fix this class of bug completely.

Fixes GH-1859
Fixes GH-1888

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
config.get_base_url()?
);
let predefined_token = matches.get_one::<String>("auth_token");
let predefined_token = matches.get_one::<AuthToken>("auth_token");
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the change that fixes the error – the other changes to this file in this commit are to handle the new type

@szokeasaurusrex szokeasaurusrex merged commit 8be89c6 into master Jan 8, 2024
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/auth-token-login-error branch January 8, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sentry-cli 2.24.0 login with auth token causes errors Improve error message if not full token is not copied (Checksum correct)

2 participants