fix: use gmail.readonly scope in +triage to avoid metadata scope 403#304
fix: use gmail.readonly scope in +triage to avoid metadata scope 403#304zerone0x wants to merge 1 commit intogoogleworkspace:mainfrom
Conversation
The +triage helper uses the `q` query parameter when listing messages, but Gmail's metadata scope does not support `q` and returns 403. When a user's OAuth token includes both gmail.metadata and gmail.modify scopes, the API may resolve to the metadata code path and reject the query. Switch +triage from gmail.modify to gmail.readonly, which is the minimum scope that supports query filtering and aligns with the read-only nature of the triage command. Fixes googleworkspace#265 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 1ee52fe 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 addresses a critical 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
|
|
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. |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a 403 PERMISSION_DENIED error in the gmail +triage command by switching from the gmail.modify scope to the more appropriate gmail.readonly scope. This change resolves a conflict with the gmail.metadata scope, which does not support the q query parameter used by the triage feature. The introduction of a GMAIL_READONLY_SCOPE constant is a good practice for maintainability. The changes are sound and effectively fix the bug.
Summary
gmail +triagefailing with403 PERMISSION_DENIEDwhen the OAuth token includesgmail.metadatascope alongside other Gmail scopes+triagehelper from requestinggmail.modifytogmail.readonlyscope, which supports theqquery parameter and matches the read-only nature of triageGMAIL_READONLY_SCOPEconstant for reuse by read-only Gmail helpersRoot Cause
The
+triagehelper uses theqquery parameter when callingmessages.list, but Gmail's metadata scope does not supportqand returns 403. When a user's OAuth token carries bothgmail.metadataandgmail.modifyscopes, the Gmail API may resolve to the metadata code path and reject the query withPERMISSION_DENIED.Test plan
cargo clippy -- -D warningspasses with no warningscargo testpasses (429 tests)gws gmail +triagewith a token that has bothgmail.metadataandgmail.readonlyscopes -- should return unread inbox summary without 403Fixes #265
🤖 Generated with Claude Code