Skip to content

fix(airtable,dropbox,microsoft-teams,openrouter): pin OAuth redirect_uri to deco domain allowlist - #540

Open
0xcucumbersalad wants to merge 2 commits into
mainfrom
fix/oauth-redirect-uri-allowlist-batch2
Open

fix(airtable,dropbox,microsoft-teams,openrouter): pin OAuth redirect_uri to deco domain allowlist#540
0xcucumbersalad wants to merge 2 commits into
mainfrom
fix/oauth-redirect-uri-allowlist-batch2

Conversation

@0xcucumbersalad

@0xcucumbersalad 0xcucumbersalad commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Found via a repo-wide sweep for the same redirect_uri hijack vuln class already fixed in github (fix(github): pin OAuth redirect_uri to decocms.com allowlist #453) and shared/google-oauth (fix(shared): pin Google OAuth redirect_uri to decocms.com/deco.site allowlist #539): authorizationUrl()/exchangeCode() forwarded the runtime-supplied callback URL verbatim as redirect_uri (callback_url for 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.
  • Vulnerable: airtable, dropbox, microsoft-teams, openrouter — all followed the identical pattern (dropbox's own comment even said "match the airtable/google pattern").
  • Each gets its own self-contained server/lib/redirect-allowlist.ts (assertAllowedRedirectUri/isAllowedRedirectUri, same shape as github's/shared's) rather than depending on shared/, so this lands independently of fix(shared): pin Google OAuth redirect_uri to decocms.com/deco.site allowlist #539.
  • Allowlist: decocms.com, deco.site (production hosting — confirmed via each MCP's app.json/wrangler.toml), and deco.host (local-dev tunnel domain, needed since some providers reject http://localhost redirect URIs). Loopback allowed over http for dev.
  • Already-safe MCPs checked and left alone: shopify (own isAllowedCallback()), whatsapp (validates against MESH_URL/SELF_URL), github-repo-reports (no redirect_uri param at all).

Test plan

  • bun test server/lib/redirect-allowlist.test.ts in 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
  • Smoke-test an actual OAuth connect flow for one of the 4 MCPs in staging

🤖 Generated with Claude Code


Summary by cubic

Pins OAuth redirect/callback domains for airtable, dropbox, microsoft-teams, and openrouter to 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.

  • Add per‑MCP server/lib/redirect-allowlist.ts with assertAllowedRedirectUri/isAllowedRedirectUri, called in authorizationUrl and exchangeCode (callback_url for openrouter).
  • Allowlist: decocms.com, deco.site, deco.host over https; localhost/127.0.0.1/::1 allowed over http for dev only.
  • Add tests in each package for allowed/denied cases. Update microsoft-teams tsconfig.json to include @types/bun so bun:test type checks.
  • Migration: if your OAuth callback base URL uses a non‑allowed domain, move it to decocms.com, deco.site, or deco.host, or use loopback for local development.

Written for commit 98d228c. Summary will update on new commits.

Review in cubic

0xcucumbersalad and others added 2 commits August 18, 2026 22:00
…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
0xcucumbersalad requested review from JonasJesus42 and viktormarinho and removed request for viktormarinho August 18, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant