GeezerVison is showing github.com — mcpx: prevent custom credential headers from following cross-origin HTTP redirects · Issue #5744 · developing-today/code
mcpx: prevent custom credential headers from following cross-origin HTTP redirects #5744DescriptionProblem
The HTTP client in pkgs/mcpx/internal/mcpclient/http.go applies configured custom headers to upstream requests, but its http.Client uses Go's default redirect policy (around lines 75–83 and request header construction around lines 152–155). Go strips selected standard sensitive headers on some cross-origin redirects, but it does not know that arbitrary configured headers such as X-API-Key contain credentials. A malicious or compromised upstream can return a redirect to another origin and receive the configured secret header.
This affects any MCP server/provider configured with a custom credential header and does not require the destination origin to be trusted.
Required behavior
Do not forward configured secret/custom credential headers across an origin boundary. Prefer refusing cross-origin redirects; if same-origin redirects remain supported, compare normalized scheme/host/port and retain credentials only when the origin is identical. The redirect policy must cover every request through this HTTP transport.
Acceptance criteria
- An httptest upstream returns a redirect to a second server; configure a custom X-API-Key header and assert the second server never receives it.
- The selected behavior for the redirect is explicit and deterministic (reject it or return the 3xx without following).
- Same-origin redirect behavior is covered if it remains supported.
- Existing bearer/auth header behavior and normal HTTP MCP calls remain covered by targeted tests.
Activitydeveloping-today commented on Nov 5, 2026 dezren39 commented on Nov 5, 2026 dezren39 commented on Nov 5, 2026 🤖 Agent note · done
Triage findings (fresh verification, 2026-11-05)
pkgs/mcpx/internal/mcpclient/http.go line 82: newHTTPClients returns &http.Client{Timeout: timeout, Transport: clone()} and &http.Client{Transport: clone()} — neither sets CheckRedirect, so Go's default redirect policy applies. A grep for CheckRedirect across pkgs/mcpx returns nothing.
setHeadersFor (lines 152–155) applies every configured custom header (HTTPOptions.Headers, lines 60/97) to each outgoing request. Go's default redirect handling copies such custom headers to cross-origin redirect targets — it strips only the Authorization / Www-Authenticate / Cookie class — so a malicious or compromised upstream can 3xx to another origin and receive a configured credential header such as X-API-Key. The bug in issue mcpx: prevent custom credential headers from following cross-origin HTTP redirects #5744 is real and live on main.
- Scope for the fix (task 10645): the two clients from
newHTTPClients plus an audit of the package-level streamClient (line 488, used by listen()) — every client that can carry configured headers gets the same policy: refuse cross-origin redirects (normalized scheme/host/port comparison; explicit error or ErrUseLastResponse), same-origin redirects may still be followed.
- No competing owner: no open PR references issue mcpx: prevent custom credential headers from following cross-origin HTTP redirects #5744 or the mcpx redirect work; no hard-stop labels on issue mcpx: prevent custom credential headers from following cross-origin HTTP redirects #5744.
- Cross-repo: mcpx also appears in dezren39/darwin-nix as a consumer/configuration — task 10645 instructs the fixer to confirm there is no vendored
mcpclient copy there and, if one exists, to port the identical policy in the same set under issue mcpx: prevent custom credential headers from following cross-origin HTTP redirects #5744 rather than filing a separate issue.
- Tests are specified in task 10645 per the acceptance criteria on issue mcpx: prevent custom credential headers from following cross-origin HTTP redirects #5744 (httptest cross-origin redirect never delivers the configured
X-API-Key; explicit cross-origin behavior; same-origin covered if supported; existing auth/header tests stay green).
Task 10154 completes as triaged; follow-up: task 10645.
dezren39 commented on Nov 7, 2026 dezren39 commented on Nov 7, 2026 🤖 Agent note · handed off
- Agent: fleet monitor
- Session / ID: task 10645 · repo-fleet-monitor run 2026-11-07 08:12 CST
- Found via: monitor reconciliation
- Task: Claim evaporated — task 10645 in repo-health-code-pilot is queued and unclaimed (no live lease, verified this run), while this issue still carried claimed labels. Labels reset to the truth: queue/queued + status/needs-triage. Checkpoint stage on the task: handed_off.
- Expectation: The next claimant of task 10645 picks this up from the queued state; do not treat any earlier claim as live.
- Links: n/a
developing-today commented on Nov 8, 2026 🤖 Agent note · handed off
developing-today commented on Nov 8, 2026 🤖 Agent note · triaged
- Agent: queue worker (repo-worker-code), lane code-a
- Session / ID: task 13106
- Found via: queue claim (execution lane: direct; claim row verified stamped code-a)
- Task: Triage issue mcpx: prevent custom credential headers from following cross-origin HTTP redirects #5744 — mcpx: prevent custom credential headers from following cross-origin HTTP redirects
- Verdict: CONFIRMED, real and current — and the fix is already built and routed. No new fix packet enqueued (dedupe).
- Fresh evidence (2026-11-08): Issue mcpx: prevent custom credential headers from following cross-origin HTTP redirects #5744 OPEN (kind/bug, priority/high, no hard-stop labels). Laptop main 2d01502: pkgs/mcpx/internal/mcpclient/http.go
newHTTPClients builds both http.Clients with NO CheckRedirect (grep finds no CheckRedirect in the file), and setHeaders applies the configured custom headers (t.headers) to the request — Go's default redirect handling copies non-standard credential headers (e.g. X-API-Key) cross-origin. PR fix(mcpx): refuse cross-origin credential redirects #6560 is OPEN, non-draft, on branch queue/10645-5744-redirect-origin-policy: it refuses cross-origin redirects (http.ErrUseLastResponse) across Streamable HTTP and legacy SSE, with httptest regressions. The PR's Codex review state (comment 6689717716) shows undispositioned findings at 9d77791 — those gate its merge under the 2026-10-29 Codex gate.
- Routing: The owning fix task already exists and is queued: task 10645 (dedupe hit on repo-health:v1:fix:developing-today/code:issue:5744 when this triage attempted the enqueue). Its remaining work: disposition PR fix(mcpx): refuse cross-origin credential redirects #6560's Codex findings, rebase/verify, and merge. Task 13106 completes as triaged.
- Links: task 13106, task 10645, issue mcpx: prevent custom credential headers from following cross-origin HTTP redirects #5744, PR fix(mcpx): refuse cross-origin credential redirects #6560
developing-today commented on Nov 8, 2026 🤖 Agent note · done — Agent: repo queue worker, lane code-b (repo-worker-code). Task: task 13305 (pr_shepherd) for PR #6560. PR #6560 MERGED (squash d58527f): refuseCrossOriginRedirect in pkgs/mcpx/internal/mcpclient covers every request through this transport; redirect_test.go covers the cross-origin credential-header case, explicit refusal, and same-origin behavior per the acceptance criteria above. Codex P2 findings on the head were fixed in 2c39583 and dispositioned (replies 4506551297, 4506551522). Verified this shift on the laptop at head acdab19: go test ./internal/mcpclient/ PASS (12.6s). Basic CI checks remained QUEUED (fleet runner stall); merged under standing merge authority with targeted tests verified. Closing #5744 on this evidence. dezren39 commented on Nov 9, 2026 🤖 Agent note · done (already_done)
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|