fix(shared): pin Google OAuth redirect_uri to decocms.com/deco.site allowlist - #539
Open
0xcucumbersalad wants to merge 2 commits into
Open
fix(shared): pin Google OAuth redirect_uri to decocms.com/deco.site allowlist#5390xcucumbersalad wants to merge 2 commits into
0xcucumbersalad wants to merge 2 commits into
Conversation
…llowlist createGoogleOAuth() forwarded the runtime-supplied callback URL verbatim as redirect_uri to Google and the token endpoint. Google delivers the auth code to that host, so an attacker-influenced origin could hijack the code/token. Mirrors the github MCP fix (#453), extended to also allow deco.site since most Google MCPs are hosted there. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
deco.host is the local-dev tunnel domain (cloudflared-style) used to test OAuth flows against providers that reject http://localhost redirect URIs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
3 tasks
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
createGoogleOAuth()(shared/google-oauth.ts) forwarded the runtime-supplied callback URL verbatim asredirect_urito Google's authorize endpoint and token endpoint. Google delivers the auth code to that host, so an attacker-influenced origin could hijack the code/token — same vuln class fixed for github MCP in fix(github): pin OAuth redirect_uri to decocms.com allowlist #453.shared/redirect-allowlist.ts(assertAllowedRedirectUri/isAllowedRedirectUri), allowing hosts underdecocms.comordeco.site(plus their subdomains) over https, and loopback over http for local dev.app.jsonacross the 17 MCPs usingcreateGoogleOAuth— most are hosted ondeco.site(sites-<name>.deco.site), onlygoogle-gmailusesdecocms.com, hence both suffixes are allowlisted.grafana/template-minimalhave the oauth block commented out, unaffected.)Test plan
bun test shared/redirect-allowlist.test.ts— 9 pass (canonical origins, subdomains, loopback dev, non-loopback http rejection, look-alike/suffix-confusion hosts, other schemes, case-insensitivity)bun run fmt/ pre-commit lint pass🤖 Generated with Claude Code
Summary by cubic
Pins Google OAuth redirect_uri to an allowlist under *.decocms.com, *.deco.site, and *.deco.host to prevent auth code/token hijack. Previously createGoogleOAuth forwarded the callback verbatim; now both authorization URL creation and token exchange validate and reject disallowed hosts. Requires https except loopback over http;
deco.hostis allowed for tunnel-based local dev.assertAllowedRedirectUri/isAllowedRedirectUriand tests; used by all Google-based MCPs.Required actions
*.deco.site,*.decocms.com, or*.deco.host. For local dev, usehttp://localhost/http://127.0.0.1, or an https*.deco.hosttunnel.Written for commit 848550c. Summary will update on new commits.