fix(auth): robustly enforce readonly scopes by injecting prompt=consent#504
fix(auth): robustly enforce readonly scopes by injecting prompt=consent#504dumko2001 wants to merge 7 commits intogoogleworkspace:mainfrom
Conversation
…nt and fix warnings
🦋 Changeset detectedLatest commit: 937c6bf The changes in this PR will be included in the next version bump. 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 addresses an issue where readonly scopes might not be consistently enforced during the OAuth authentication process. By introducing a mechanism to explicitly inject 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 robustly enforces readonly scopes by injecting prompt=consent into the OAuth flow. The changes are well-structured, adding a force_consent flag to CliFlowDelegate and dynamically modifying the OAuth URL. My main feedback is to improve the robustness of the check for an existing consent value in the prompt parameter to avoid potential issues with partial matches.
|
Applied the suggested fix for robust |
|
/gemini review |
Description
Robustly enforce readonly scopes by injecting
prompt=consentinto the OAuth flow when the--readonlyflag is used. This ensures that Google always returns a refresh token and honors the requested readonly scopes, even if the user had previously authenticated with broader scopes.The implementation:
CliFlowDelegateto handle aforce_consentflag.promptparameter in the OAuth URL to includeconsent, while preserving existing prompt values (e.g.select_account) using space-delimiting as per RFC 6749.force_consentflag to the authenticator based on the presence of--readonlyin the login arguments.Fixes #168
Dry Run Output:
N/A (Authentication flow change)
Checklist:
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings.pnpx changeset) to document my changes.