Skip to content

fix(token_storage): propagate errors when creating/securing token dir#494

Open
mango766 wants to merge 1 commit intogoogleworkspace:mainfrom
mango766:fix-silent-fs-errors
Open

fix(token_storage): propagate errors when creating/securing token dir#494
mango766 wants to merge 1 commit intogoogleworkspace:mainfrom
mango766:fix-silent-fs-errors

Conversation

@mango766
Copy link

Fixes #493\n\nPreviously, failures to create the token directory or set its permissions were silently ignored with let _. This could lead to confusing errors later when writing the token file, or worse, leave the directory with insecure permissions if the chmod fails. \n\nThis PR changes let _ to ? to ensure these errors are propagated.

…\n\nCloses googleworkspace#493\n\nPreviously, failures to create the token directory or set its permissions were silently ignored with `let _`. This could lead to confusing errors later when writing the token file or result in insecure permissions. This change propagates these errors up to the caller.
@google-cla
Copy link

google-cla bot commented Mar 15, 2026

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.

@changeset-bot
Copy link

changeset-bot bot commented Mar 15, 2026

⚠️ No Changeset found

Latest commit: 08ffce7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@gemini-code-assist
Copy link
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 significantly improves the reliability and security of the token storage mechanism by ensuring that any errors encountered during the setup of the token directory, including its creation and permission configuration, are properly handled. By propagating these errors, the system can now respond proactively to setup failures, thereby preventing subsequent operational issues or potential security vulnerabilities that could arise from an improperly initialized storage location.

Highlights

  • Error Propagation: Failures during the creation of the token storage directory and the setting of its permissions are now explicitly propagated instead of being silently ignored.
  • Improved Robustness: This change prevents potential issues such as confusing errors when writing token files or leaving directories with insecure permissions due to unhandled setup failures.
Changelog
  • src/token_storage.rs
    • Modified the create_dir_all and set_permissions calls to use the ? operator, ensuring that errors from these operations are propagated.
Activity
  • No human activity has been recorded on this pull request yet.
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 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 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

  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.

Copy link
Contributor

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

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 correctly addresses an issue where errors during the creation and permission setting of the token directory were silently ignored. By propagating these errors using ?, the code becomes more robust and less prone to silent failures and potential security risks.

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.

Bug: Silent failures when creating token storage directory

2 participants