fix(auth): resolve per-account credentials in auth export#230
fix(auth): resolve per-account credentials in auth export#230haunchen wants to merge 3 commits intogoogleworkspace:mainfrom
auth export#230Conversation
…rkspace#179) `auth export` only checked the legacy `credentials.enc` path, which no longer exists after multi-account login (credentials are stored as `credentials.<b64-email>.enc`). Use `resolve_account` to find the correct per-account credential file, with support for `--account` flag.
🦋 Changeset detectedLatest commit: 00a15a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical authentication issue where the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes an issue with auth export in multi-account setups by resolving per-account credentials. It also introduces --account support for the export command, and the changes are logical and well-tested. I've added one comment regarding the argument parsing logic in handle_export, suggesting a more robust implementation to handle invalid arguments and prevent user confusion.
Reject unknown arguments and missing --account values instead of silently ignoring them, as suggested in PR review.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses an issue with auth export in multi-account setups by resolving the correct per-account credential file. It also adds support for the --account flag to auth export. The changes are well-tested. I've found a critical issue in the new argument parsing logic for handle_export which could lead to incorrect behavior when flags are passed in a certain order. My review includes a suggested fix for this issue.
Prevent `--account --unmasked` from treating `--unmasked` as the account value by peeking at the next arg and rejecting flag-like values.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly fixes an issue with auth export in multi-account environments by resolving per-account credential files. It also introduces --account support to the export command, which is a great enhancement. The changes are logical and well-tested. I have one suggestion to improve error handling and prevent a potential panic, making the CLI more robust.
Summary
auth exportonly checked the legacycredentials.encpath, which no longer exists after multi-account login (credentials are stored per-account ascredentials.<b64-email>.enc). This caused a 401 error even when accounts were properly authenticated.resolve_account()to find the correct per-account credential file, falling back to legacy path when no account registry exists.--account EMAILsupport toauth exportfor exporting a specific account's credentials.--accountflag through tohandle_auth_commandsogws --account EMAIL auth exportalso works.Fixes #179
Related: #220
Test plan
cargo test— 3 new tests + all existing tests passcargo clippy -- -D warnings— no warningscargo fmt --check— cleangws auth exportexports default account credentialsgws auth export --account EMAILexports specific accountgws --account EMAIL auth exportworks via global flag