fix(airtable,dropbox,microsoft-teams,openrouter): pin OAuth redirect_uri to deco domain allowlist - #540
Open
0xcucumbersalad wants to merge 2 commits into
Open
fix(airtable,dropbox,microsoft-teams,openrouter): pin OAuth redirect_uri to deco domain allowlist#5400xcucumbersalad wants to merge 2 commits into
0xcucumbersalad wants to merge 2 commits into
Conversation
…uri to deco domain allowlist authorizationUrl()/exchangeCode() forwarded the runtime-supplied callback URL verbatim as redirect_uri (or callback_url for OpenRouter) to the third-party IdP without validating the host. The IdP delivers the authorization code to that host, so an attacker-influenced origin could hijack the code/token. Same vuln class already fixed in github (#453) and shared/google-oauth (#539). Each MCP gets its own self-contained redirect-allowlist.ts (mirroring github's/shared's) rather than depending on the shared package, so this lands independently of #539. Allows decocms.com, deco.site, and deco.host (local-dev tunnel domain) plus loopback over http for dev. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… check tsconfig.json's explicit "types" array excluded @types/bun (unlike sibling MCPs, which don't restrict "types" and pick it up automatically), so CI's type check failed on the new redirect-allowlist.test.ts's bun:test import. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
0xcucumbersalad
requested review from
JonasJesus42 and
viktormarinho
and removed request for
viktormarinho
August 18, 2026 14:04
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
authorizationUrl()/exchangeCode()forwarded the runtime-supplied callback URL verbatim asredirect_uri(callback_urlfor OpenRouter) to the third-party IdP with zero host validation. The IdP delivers the auth code to that host, so an attacker-influenced origin could hijack the code/token.server/lib/redirect-allowlist.ts(assertAllowedRedirectUri/isAllowedRedirectUri, same shape as github's/shared's) rather than depending onshared/, so this lands independently of fix(shared): pin Google OAuth redirect_uri to decocms.com/deco.site allowlist #539.decocms.com,deco.site(production hosting — confirmed via each MCP'sapp.json/wrangler.toml), anddeco.host(local-dev tunnel domain, needed since some providers rejecthttp://localhostredirect URIs). Loopback allowed over http for dev.isAllowedCallback()), whatsapp (validates againstMESH_URL/SELF_URL), github-repo-reports (no redirect_uri param at all).Test plan
bun test server/lib/redirect-allowlist.test.tsin each of the 4 MCPs — 40/40 pass total (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 OAuth redirect/callback domains for
airtable,dropbox,microsoft-teams, andopenrouterto a Deco allowlist to block redirect_uri hijack. Previously we forwarded the runtime-supplied callback verbatim; now we validate hosts and throw on disallowed domains. Non‑Deco hosts fail with a clear error; loopback dev remains supported.server/lib/redirect-allowlist.tswithassertAllowedRedirectUri/isAllowedRedirectUri, called inauthorizationUrlandexchangeCode(callback_urlforopenrouter).decocms.com,deco.site,deco.hostover https;localhost/127.0.0.1/::1allowed over http for dev only.microsoft-teamstsconfig.jsonto include@types/bunsobun:testtype checks.decocms.com,deco.site, ordeco.host, or use loopback for local development.Written for commit 98d228c. Summary will update on new commits.