Repository navigation
Description
Summary
Credentials still reach logs and structured error responses through paths that #1157 deliberately leaves alone. That PR fixes the MCP/REST read surfaces; these are separate sinks with the same root cause — a raw URL, argv vector, or header written straight into a log field or an error payload.
Found by an independent opencode (gpt-5.6-sol) cross-review of #1157. Scoped out of that PR to keep it reviewable; filed here so they aren't lost.
Findings
1. Trace-mode transport logging records complete credentials and payloads — internal/transport/logging.go:43-53, 74-82, 150-168, 218-225
With tracing enabled, raw request URLs, Authorization/Cookie headers, request bodies, response headers and bodies, and SSE frames are written to stdout/logs. Opt-in, but a user turning on tracing to debug a connection is exactly the user whose token is in that URL.
2. Process-launch logging exposes argv and injected environment credentials — internal/upstream/core/connection_launcher.go:316-321
finalArgs is logged verbatim. That includes configured argv credentials (--api-key sk-live-…) and, under Docker wrapping, environment values converted into command arguments — so env secrets reach the log as argv. Same raw-argv logging at internal/upstream/core/docker.go:263-265 and connection_docker.go:300-302.
This is the sharper one: #1157 masks argv on the read surfaces, and the launcher writes it in the clear on every spawn.
3. OAuth discovery logs configured and derived URLs raw — internal/oauth/config.go:693-704, 746-755, 807-809, 1104-1116; persistent_token_store.go:59-63; transport_wrapper.go:93-111, 151-155, 197-201
URL query/userinfo credentials and injected OAuth query parameters reach logs.
4. Structured OAuth failure responses include raw URLs — internal/upstream/core/connection_oauth.go:959-983 + internal/httpapi/server.go:3131-3139
Metadata-validation errors populate ServerURL and URLChecked from the raw configured/derived URLs and serialize them directly into the API response.
Suggested approach
#1157 established the pattern worth reusing: redact at the seam rather than per-call-site. It redacts transport errors as they enter mcpproxy, so ~176 downstream zap.Error sites inherit the safe rendering, and only sites upstream of that choke point needed individual fixes.
The equivalents here:
- a
logSafeArgshelper at the launcher, so no spawn path logs a raw vector (note the Docker env-to-argv conversion — masking must happen after that transform, not before); - route the OAuth package's URL logging through
oauth.RedactURLQueryParams, which already exists and which fix(security): stop leaking upstream credentials on MCP read surfaces #1157 taught to stripuser:pass@as well; - scrub
ServerURL/URLCheckedwhere the structured error is built, not where it is serialized.
Note url.URL.Redacted() is not sufficient — it masks only the userinfo password and leaves ?token= intact. #1157 replaced one such use for this reason.
Activity
fix(security): close the remaining scoped-caller read doors (#1166 ro…
fix(security): close the OAuth code, error-text and quoting gaps the …
test(security): make the spawn-redaction tests host-independent
fix(security): gate the REST and SSE doors on caller identity and tok…
fix(security): stop credentials reaching logs, stdout and structured …
docs(security): add the release advisory for the credential-exposure …
fix(security): redact the request path on the MCP and OAuth-callback …
fix(security): redact the request path on the MCP and OAuth-callback …