Gemini CLI PR binds MCP OAuth tokens to issuing server URL to stop token replay

Subhan1794 · ghdev · 2026-11-26

PR #30475 in google-gemini/gemini-cli fixes a security flaw where OAuth tokens for MCP servers were stored by server name without URL binding. If a server's URL was repointed — by typo, config edit, or attack — the stored token would silently be replayed to the new origin without re-consent.

The fix records mcpServerUrl at authentication time and checks same-origin binding on every code path that sends the token (10 files, +834/-9). On mismatch the token is withheld rather than deleted, the user is asked to re-authenticate via /mcp auth, and token refresh is only ever sent to the originally recorded URLs.

Original post →

More from coding & agent

coding & agent channel →