Repository navigation
MCP OAuth: a live session's header survives an access-token renewal through the proxy's placeholder - #78
Closed
erikcostlow wants to merge 2 commits into
Closed
MCP OAuth: a live session's header survives an access-token renewal through the proxy's placeholder#78erikcostlow wants to merge 2 commits into
erikcostlow wants to merge 2 commits into
Conversation
…hrough the proxy's placeholder (task 387a038c) A running Claude, Codex or OpenCode session kept the access token its config baked in at startup: when the refresher renewed the token, every MCP call of the live session was rejected (Claude: "rejected the Authorization header in its config") until a new session started. Stored secrets never had this problem - their headers carry a placeholder that the secret proxy resolves per request - but an OAuth access token is in memory only, no secret of the store, so headersFor baked in the token itself. The proxy's snapshot now carries each cached access token as an entry of its own: the registration's host, the authorization form, the current token as the value, and a placeholder with a fixed generation and shape whose HMAC input holds a NUL no member secret can carry - stable across renewals and restarts, colliding with nothing. headersFor hands engines that placeholder while a proxy listens, and the proxy swaps in the token that is current at the request, so a renewal needs no new session, for any of the three engines at once. Every token change (sign-in, refresh, refusal, drop) pushes a fresh snapshot to the child; the entries join no signature and no environment, so a renewal restarts no agent and moves no revision. With no proxy listening the header still carries the token itself, as before. A side effect of the swap: engine config files no longer hold a raw access token, and the proxy scrubs it from responses.
…7a038c) secrets-design 2.1 records the snapshot entry, its fixed placeholder and its no-restart rule; the integrations-loop A2b line names the follow-up done and keeps the no-proxy raw-token fallback.
nmamano
pushed a commit
that referenced
this pull request
Nov 19, 2026
…n renewal, through the secret proxy's placeholder (task 97994ff5, PR #78, closes #77) A running Claude, Codex or OpenCode session kept the access token its config baked in at startup: when the refresher renewed the token, every MCP call of the live session was rejected until a new session started. Stored secrets never had this problem, because their headers carry a placeholder that the secret proxy resolves per request; an OAuth access token is in memory only, so headersFor baked in the token itself. The proxy's snapshot now carries each cached access token as an entry of its own: the registration's host, the authorization form, the current token as the value, and a placeholder with a fixed generation and shape whose HMAC input holds a NUL no member secret can carry. headersFor gives engines that placeholder while the proxy carries the registration, and the proxy swaps in the token that is current at the request, so a renewal needs no new session. Engine config files no longer hold a raw access token, and the proxy scrubs it from responses and logs. A cached token on a host the proxy can carry counts as a secret of its scope: it starts the proxy, gives its scope's agents the proxy variables, and joins the scope's set signature with its fixed placeholder, so a sign-in or a drop marks the scope's agents and a renewal marks none. A host the proxy does not end TLS for (an IP address, a never-listed host) keeps the raw token in its header. The token module notifies once after each complete change (sign-in, renewal, sign-in-needed, drop, member removal), and the office pushes a fresh snapshot to the proxy child. Docs: secrets-design 2.1/2.2, integrations-loop A2b, security-audit 6.6 and 8.7. Contributed by Erik Costlow in PR #78; review fixes and tests by the Isomux loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
An AI model (an Isomux agent) wrote this comment. Thank you for the issue and the fix. Your fix landed in main as one commit under your name, with one change of ours folded in: a cached access token now counts as a secret of its scope. So the secret proxy also starts in an office with no stored secret, and an agent whose only credential is an OAuth MCP server now gets the proxy variables (before, it got the placeholder header but no proxy, and every MCP call failed). A server on a host the proxy does not end TLS for (an IP address, a never-listed host) keeps the raw token in its header. It ships in the next release. We close #77 when the release is out. |
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.
Fixes #77. An AI model wrote this PR.
The fix follows the A2b follow-up that internal-docs/integrations-loop.md already planned ("the proxy can put the current access token in for a fixed placeholder"):
Because all three engines take their headers from the same mcpServersForUserId path, Claude, Codex and OpenCode live sessions all survive a renewal now. Side effects: a raw access token no longer sits in the Codex/OpenCode config files, the proxy scrubs it from responses, and OAuth MCP uses appear in the secrets.use audit like secret-based ones.
Tests run on macOS:
Not run: bun run ci and the full gate selection (both Linux-only; this branch was developed on macOS), and the ISOMUX_TEST_LIVE-gated engine tests. The existing secret-proxy/engines.live.test.ts already covers an MCP server registered with a placeholder header reaching a listed host through the real proxy with real Claude, which is the path this fix extends to OAuth tokens.
🤖 Generated with Claude Code