fix(gchat): bind add-on webhook verification to a configured identity - #787
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
bensabic
approved these changes
Aug 5, 2026
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.
summary
endpoint-URL webhook verification accepted any
emailclaim matching the generic Workspace Add-on shape:/^service-\d+@gcp-sa-gsuiteaddons\.iam\.gserviceaccount\.com$/the
\d+is a GCP project number, and service agents areservice-{PROJECT_NUMBER}@gcp-sa-{SERVICE}...for the project that owns them. so that shape identifies "some Workspace Add-on", not this app's add-on, and it was the only thing standing between a public endpoint URL and a verified request. the method's own doc comment already stated the correct invariant, that the token is only trustworthy if it was issued to Google Chat itselfadds
workspaceAddOnServiceAccountEmail(envGOOGLE_CHAT_WORKSPACE_ADDON_SERVICE_ACCOUNT_EMAIL) and compares add-on identities exactly. when it is unset, add-on-shaped tokens are rejected rather than trusted by shape, with a log naming the option to setchat@system.gserviceaccount.comis untouched, so standalone Chat apps behave exactly as before. the project-number and Pub/Sub paths were already bound to exact identities and are unchangedbehavior
emailchat@system.gserviceaccount.comwhy not reject at construction
refusing to initialize when the option is absent would be the stricter-looking choice, but the adapter cannot tell Workspace Add-on mode from config alone, it only sees
endpointUrl. throwing there would break every ordinary endpoint-URL Chat app. rejecting add-on-shaped tokens at verification is the precise equivalent without the collateraltest plan
chat@system.gserviceaccount.comis still accepted with no add-on configemail_verified: falseis rejectedthe two rejection cases above returned 200 before this change and 401 after