fix(gmail): add x-goog-user-project header to helpers bypassing executor.rs - #939
Open
mittalpk wants to merge 1 commit into
Open
Conversation
…tor.rs fetch_message_metadata, fetch_send_as_identities, and fetch_attachment_data all call gmail.googleapis.com directly with .bearer_auth(token) only, so ADC callers with no explicit quota project get a 403 accessNotConfigured. Standard resource commands avoid this because executor.rs already adds the header via auth::get_quota_project(). Apply the same header conditionally in all three helpers, which affects +read, +forward, +reply, send-as resolution, and original-attachment forwarding. Fixes googleworkspace#843
🦋 Changeset detectedLatest commit: d515881 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #843.
fetch_message_metadata,fetch_send_as_identities, andfetch_attachment_dataincrates/google-workspace-cli/src/helpers/gmail/mod.rsall callgmail.googleapis.comdirectly and only set.bearer_auth(token), so an ADC caller with no explicit quota project gets a 403accessNotConfigured.executor.rsalready handles this correctly viaauth::get_quota_project()for standard resource commands; this applies the same pattern to the three Gmail helpers that bypass it.This is a superset of the issue title:
fetch_message_metadatais shared by+read,+forward, and+reply, and I found the identical bug infetch_send_as_identities(used by From-header resolution) andfetch_attachment_data(original-attachment forwarding) in the same file, which the issue's own suggested fix called out as in scope ("and other helper functions that bypass executor.rs"). Other.bearer_auth-only call sites exist incalendar.rs,events/*.rs,workflows.rs,gmail/watch.rs, andgmail/triage.rs, but those hit different Google APIs (Calendar, Pub/Sub, Workspace Events) with potentially different quota-project requirements, so I left them out of this PR.Verified
cargo test(709 passing) andcargo clippy -- -D warningsclean on the changed file; there's one pre-existing clippy failure inhelpers/script.rsunrelated to this change that reproduces on unmodifiedmaintoo.