GeezerVison is showing github.com — mcpx(logging): PR #1737's Redact mangles URL values under a sensitive keyword — port printed as an elided password, rest of URL dropped · Issue #2463 · developing-today/code
mcpx(logging): PR #1737's Redact mangles URL values under a sensitive keyword — port printed as an elided password, rest of URL dropped #2463Descriptionmcpx(logging): PR #1737's Redact mangles URL values under a sensitive keyword — a port is printed as an elided password and the rest of the URL is dropped
Finding
PR #1737 (merged, fixes #1710) taught Redact to elide URL userinfo passwords. Its replacement function (pkgs/mcpx/internal/logging/trace.go:214 on current main 5a34fa70) decides "this match is a URL userinfo match" purely from strings.Index(m, "://") — but the KEY=VALUE alternative of sensitiveValue (trace.go:189) comes first in the alternation and consumes a whole URL as its \S+ value whenever the pair's name contains a sensitive keyword (auth, token, key, …). For such a match the function:
- mistakes the URL's port colon (or the userinfo colon) for the marker it wants, and
- reconstructs only
prefix + user + ":" + "<elided>@", silently discarding the remainder of the match — host, port and path for a userinfo URL; the path (plus a fabricated @) for a credential-free URL.
The PR's own keep-case — a bare userinfo URL keeps scheme, user, host, port and path — only holds when the URL alternative is the one that matched.
Evidence
- PR: mcpx(logging): fix Redact leaks — full JWT elision, reconciled KEY=VALUE keywords, URL userinfo passwords (#1710) #1737 — merge
ee07ac6cad82ec5ee0484d8545b15a76a71791ee, commit 2d5da5a7.
- Current main
5a34fa70: sensitiveValue at pkgs/mcpx/internal/logging/trace.go:189-200 (pair alternative before the userinfo alternative); Redact's URL branch at trace.go:214-220.
- Probe (verbatim regex +
Redact copied from current main, run on the laptop: ~/git/fleet/probe-2026-10-29-laneB-redact/main.go):
Redact("MCPX_SCRIPT_ENV", "AUTH_URL=https://auth.example.com:8443/callback") → "AUTH_URL=https://auth.example.com:<elided>@" — no credential anywhere in the input, yet the output presents the port 8443 as an elided password, invents a @, and drops /callback.
Redact("MCPX_SCRIPT_ENV", "TOKEN_URL=https://deploy:[email protected]:8443/path") → "TOKEN_URL=https://deploy:<elided>@" — password elided, but host, port and path are lost (the bare-URL control below keeps all of them).
- Controls behave: bare
https://deploy:[email protected]:8443/path → https://deploy:<elided>@example.com:8443/path; SESSION=abc123sessionvalue → SESSION=<elided>; AUTH_URL=https://auth.example.com/callback (no port) → AUTH_URL=<elided>.
Why it matters
Redact is the logging safety boundary for mcpx: its outputs are what operators read when diagnosing from traces. A redactor that fabricates credential-looking output (host:<elided>@) for a credential-free URL sends diagnosis in the wrong direction, and one that silently truncates the non-secret remainder of a value destroys exactly the context the per-match (rather than whole-value) design exists to preserve. Any *_URL/AUTH_*/TOKEN_* pair carried inside MCPX_SCRIPT_ENV-style values — the PR's own motivating case — with a port or userinfo hits this.
Acceptance criteria
- Regression tests in
redact_test.go: a sensitive-keyword pair whose value is a URL with a port and no userinfo keeps the URL readable with only the genuinely sensitive part elided (no fabricated <elided>@, no dropped path); a keyword pair whose value is a userinfo URL elides only the password and keeps scheme, user, host, port and path — matching the bare-URL keep-case from PR mcpx(logging): fix Redact leaks — full JWT elision, reconciled KEY=VALUE keywords, URL userinfo passwords (#1710) #1737.
- The URL-userinfo reconstruction is applied only when the match actually came from the userinfo alternative (or the pair case is handled before the URL check), not on any match containing
://.
- All PR mcpx(logging): fix Redact leaks — full JWT elision, reconciled KEY=VALUE keywords, URL userinfo passwords (#1710) #1737 regression tests (full JWT, reconciled keywords, bare userinfo, credential-free URLs) still pass, in CI.
Found by pr-diff-review lane B reviewing PR #1737. Not a leak — nothing sensitive is exposed; the flaw is corruption/fabrication of the redacted output. #1710 (closed) covered the leak direction only. Activitydeveloping-today commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 🤖 Agent note · filed
- Agent: pr-diff-review-b
- Session / ID: pr-diff-review-b cron run 2026-10-29 18:18 CDT
- Found via: PR mcpx(logging): fix Redact leaks — full JWT elision, reconciled KEY=VALUE keywords, URL userinfo passwords (#1710) #1737 diff review (lane B, developing-today/code)
- Task: Filed the Redact URL-mangling flaw: the replacement func treats any match containing "://" as a userinfo match, but the KEY=VALUE alternative matches first for keyword pairs, so a ported credential-free URL under an AUTH_/TOKEN_ name is printed as host:@ with its path dropped, and a userinfo URL under a keyword loses host/port/path. Verified with a verbatim probe of main's regex+func on the laptop (probe-2026-10-29-laneB-redact/).
- Expectation: effort s; done when the userinfo reconstruction applies only to userinfo-alternative matches, with redact_test.go pins for keyword-pair URL values (port, userinfo) and all mcpx(logging): fix Redact leaks — full JWT elision, reconciled KEY=VALUE keywords, URL userinfo passwords (#1710) #1737 keep-cases still green.
- Links: mcpx(logging): PR #1737's Redact mangles URL values under a sensitive keyword — port printed as an elided password, rest of URL dropped #2463 mcpx(logging): PR #1737's Redact mangles URL values under a sensitive keyword — port printed as an elided password, rest of URL dropped #2463 · PR mcpx(logging): fix Redact leaks — full JWT elision, reconciled KEY=VALUE keywords, URL userinfo passwords (#1710) #1737 mcpx(logging): fix Redact leaks — full JWT elision, reconciled KEY=VALUE keywords, URL userinfo passwords (#1710) #1737 · mcpx(logging): Redact leaks credential fragments — a JWT's signature segment survives, and SESSION=/COOKIE=/PRIVATE= pairs inside MCPX_SCRIPT_ENV and URL userinfo passwords pass through verbatim #1710 (leak direction, closed)
dezren39 commented on Oct 30, 2026 dezren39 commented on Oct 30, 2026 🤖 Agent note · done
- Agent: OpenChamber scheduled lane (repo-worker-code)
- Session / ID: queue task 3683
- Found via: queue claim (
repo-health-code-pilot), resumed from pr_opened
- Task: Merged PR mcpx(logging): keep keyword-pair URL values readable in Redact (#2463) #2833 as
8808dfad. Redact now decides URL-containing matches by shape: a keyword-pair URL that carries no credential stays readable with no fabricated <elided>@ and no dropped path; a userinfo URL under a keyword elides only the password, keeping scheme/user/host/port/path. Codex's P1 (nested credential inside a preserved URL) is fixed in 84be0e32: nested bearer tokens, token literals in the path, and KEY=VALUE pairs in the query are elided while the URL context survives, and the credential shapes are spelled once so the matchers cannot drift. TestRedactKeywordPairURLValues pins all eight shapes.
- Verification:
go test ./internal/logging/ -count=1 and -race -shuffle=on -count=5 pass on the laptop; CI green on 84be0e32 (build, stress on changed tests, time budget); all PR mcpx(logging): fix Redact leaks — full JWT elision, reconciled KEY=VALUE keywords, URL userinfo passwords (#1710) #1737 regressions still pass.
- Links: PR mcpx(logging): keep keyword-pair URL values readable in Redact (#2463) #2833 mcpx(logging): keep keyword-pair URL values readable in Redact (#2463) #2833 · merge
8808dfad · issue mcpx(logging): PR #1737's Redact mangles URL values under a sensitive keyword — port printed as an elided password, rest of URL dropped #2463 (auto-closed by the PR)
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|