feat!: remove multi-account, DWD, and impersonation support#253
Conversation
BREAKING CHANGE: Remove domain-wide delegation, multi-account support, and impersonation from the CLI authentication flow. Removed: - `gws auth list` and `gws auth default` commands - `--account` flag from `gws auth login` and `gws auth logout` - `GOOGLE_WORKSPACE_CLI_ACCOUNT` env var - `GOOGLE_WORKSPACE_CLI_IMPERSONATED_USER` env var - Per-account credential storage (accounts.json registry) - Service account impersonation (subject/DWD) Preserved: - `GOOGLE_WORKSPACE_CLI_TOKEN` (raw access token) - `GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE` (SA key path) - `GOOGLE_WORKSPACE_CLI_CLIENT_ID` / `CLIENT_SECRET` (OAuth config) - `GOOGLE_WORKSPACE_CLI_CONFIG_DIR` (config dir override)
|
| Name | Type |
|---|---|
| @googleworkspace/cli | Minor |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a 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 significantly refactors the authentication system by eliminating multi-account management, domain-wide delegation, and impersonation capabilities. The change aims to simplify the CLI's authentication flow, focusing on a single-user credential model. This impacts how users log in, manage, and utilize credentials, streamlining the process by removing complex account-specific configurations and commands. Highlights
Changelog
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
|
|
/gemini review |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #253 +/- ##
==========================================
+ Coverage 57.69% 57.97% +0.28%
==========================================
Files 38 37 -1
Lines 14327 13797 -530
==========================================
- Hits 8266 7999 -267
+ Misses 6061 5798 -263 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request removes all multi-account management features from the gws CLI tool. The accounts.rs module, which handled account registration, default account management, and email normalization, has been deleted. Consequently, the auth::get_token function no longer accepts an account parameter, and all calls to it across various helper modules (calendar, chat, docs, drive, events, gmail, modelarmor, script, sheets, workflows) have been updated to reflect this change. The auth_commands.rs file has been modified to remove list and default subcommands, and the login and logout commands no longer support --account flags or per-account operations. The credential_store.rs module has removed functions for per-account encrypted credentials. Finally, main.rs has removed all global --account flag parsing logic, related environment variable documentation, and associated test cases, streamlining the authentication flow to a single, non-account-specific credential store.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a significant and welcome simplification of the authentication flow, removing multi-account support, domain-wide delegation, and impersonation. The changes are extensive and touch many parts of the codebase, but they appear to be correctly implemented for the most part. I've identified a couple of areas for improvement, mainly concerning cleanup of old credential files during logout and ensuring robust test coverage for the encryption logic. Overall, this is a great step towards a more streamlined and maintainable CLI.
I am having trouble creating individual review comments. Click here to see my feedback.
src/credential_store.rs (390-399)
The test decrypt_rejects_tampered_nonce has been removed. This test was important as it verified that tampering with the nonce of an encrypted payload would cause decryption to fail, which is a critical security property of AEAD ciphers like AES-GCM. Removing this test reduces confidence in the security of the credential encryption. Please consider re-adding this test or a similar one to ensure this security guarantee is maintained.
There was a problem hiding this comment.
Code Review
This pull request correctly removes multi-account, domain-wide delegation, and impersonation support, which significantly simplifies the authentication flow. The changes are extensive and consistent with the stated goal. I've identified a couple of areas for improvement related to the completeness of the cleanup logic and maintaining test coverage for security-sensitive components.
I am having trouble creating individual review comments. Click here to see my feedback.
src/credential_store.rs (349-363)
The tests encrypt_decrypt_json_credentials and encrypt_decrypt_large_payload were removed. These tests are valuable for ensuring the encryption logic works correctly with realistic and large payloads. Please consider restoring them to maintain good test coverage for this critical component.
src/credential_store.rs (390-399)
This test, decrypt_rejects_tampered_nonce, is important for verifying the security of the encryption implementation. Tampering with the nonce is a valid attack vector, and ensuring that the decryption function correctly rejects such attempts is crucial. This test should be restored to maintain robust security testing for the credential store.
Upstream removed multi-account support (googleworkspace#253), which changed auth::get_token to no longer accept an account parameter. Updated resolve_auth() and its call sites accordingly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
BREAKING CHANGE: Remove domain-wide delegation, multi-account support,
and impersonation from the CLI authentication flow.
Removed:
gws auth listandgws auth defaultcommands--accountflag fromgws auth loginandgws auth logoutGOOGLE_WORKSPACE_CLI_ACCOUNTenv varGOOGLE_WORKSPACE_CLI_IMPERSONATED_USERenv var