Skip to content

fix(auth): preserve isolated credentials on decryption failure - #891

Open
mandalorianuy wants to merge 1 commit into
googleworkspace:mainfrom
mandalorianuy:codex/preserve-undecryptable-credentials-pr
Open

fix(auth): preserve isolated credentials on decryption failure#891
mandalorianuy wants to merge 1 commit into
googleworkspace:mainfrom
mandalorianuy:codex/preserve-undecryptable-credentials-pr

Conversation

@mandalorianuy

Copy link
Copy Markdown

Description

Preserve isolated encrypted credentials and token caches when decryption fails, fail closed instead of silently authenticating with another credential source, and default custom config directories to profile-local file key storage unless the backend is explicitly overridden.

Source implementation commit: d594aec746955373976619876e95f237872ab0db.
Delivery commit: 27619dc7ccbf46f7cdf85d6c54c5bcc3a1ad42f2 (cherry-picked with traceability).

Dry Run Output:
Not applicable; this is an authentication and credential-storage fix with no API request or helper command change.

Validation

  • cargo fmt --all -- --check
  • cargo test -p google-workspace-cli --bin gws auth::tests — 23 passed
  • cargo test -p google-workspace-cli --bin gws credential_store::tests — 28 passed
  • cargo test -p google-workspace-cli — 703 passed
  • cargo clippy -p google-workspace-cli --bin gws -- -D warnings
  • cargo build -p google-workspace-cli
  • git diff --check
  • pre-push hook — cargo check, google-workspace 82 tests, CLI 703 tests
  • Changeset added: .changeset/preserve-undecryptable-credentials.md

The final branch is based on origin/main a3768d0e82ad83cca2da97724e46bea4ff0e6dbd and changes only the changeset, auth.rs, and credential_store.rs. No Google Workspace APIs, credentials, scopes, users, Sheet, or email were touched; human review and merge remain pending.

(cherry picked from commit d594aec746955373976619876e95f237872ab0db)
@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 27619dc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@googleworkspace/cli Patch

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

@google-cla

google-cla Bot commented Aug 4, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 improves the robustness and security of the credential management system. By changing the behavior to fail closed on decryption errors, it prevents potential silent authentication issues. Additionally, it introduces smarter defaults for key storage backends when using isolated configuration directories, enhancing support for multi-profile environments.

Highlights

  • Credential Decryption Failure Handling: Modified the authentication flow to preserve encrypted credentials and token caches upon decryption failure, ensuring the system fails closed rather than silently falling back to other identity sources.
  • Default Key Storage Backend: Updated the keyring backend logic to default to profile-local file storage when a custom configuration directory is used, preventing unintended sharing of OS-keyring entries across profiles.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. 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.

Footnotes

  1. Review the Generative AI Prohibited Use Policy, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the CLI's credential handling to fail closed upon decryption failure, preserving the encrypted credentials and token caches instead of deleting them and falling through to other sources. It also updates the keyring backend selection to default to file-based storage when a custom configuration directory is specified, preventing profile conflicts. As there are no review comments, I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants