ENG-8589: Don't log the MCP client secret under --debug - #463
Closed
p0-agentic-workflow-alpha[bot] wants to merge 4 commits into
Closed
p0-agentic-workflow-alpha[bot] wants to merge 4 commits into
p0-agentic-workflow-alpha[bot] wants to merge 4 commits into
Conversation
added 4 commits
September 18, 2026 18:39
Thread 7407cff3-942d-400f-8d0c-4ebade124008 Redacted the MCP OAuth client secret from debug output by reporting only "set" while preserving MCP_CLIENT_SECRET environment handling. Added coverage for the status-only debug output and sentinel absence. Focused tests and formatting checks were attempted but could not run because dependencies (vitest and prettier) are not installed.
Thread 7407cff3-942d-400f-8d0c-4ebade124008 Redacted the MCP OAuth client secret from debug output, reporting only "set" while preserving the exact MCP_CLIENT_SECRET environment value. Added direct provisioning coverage verifying the secret is absent from debug output and Claude arguments. Tests could not run because dependency installation failed with ENOSPC and vitest was unavailable; cleared the yarn cache to recover workspace space, but installation still exceeded available space. No findings were disputed.
Thread 7407cff3-942d-400f-8d0c-4ebade124008 Corrected MCP coverage to exercise provisionServer directly, verify debug output reports only "set", ensure the sentinel secret is absent from logs and Claude arguments, and confirm it remains in MCP_CLIENT_SECRET. Existing source redaction is preserved. Focused tests, TypeScript, and Prettier checks were attempted but could not run because dependencies were unavailable after yarn install failed with ENOSPC; git diff validation passed.
Thread 7407cff3-942d-400f-8d0c-4ebade124008 Added MCP coverage using a sentinel OAuth secret to verify debug output reports only "Client secret set", excludes the secret from logs and Claude arguments, and preserves delivery through MCP_CLIENT_SECRET. The source redaction was already present and remains unchanged. Focused tests and type/format checks could not execute because dependencies are unavailable (vitest, tsc, and prettier not found); dependency installation previously failed with corrupt cache entries and ENOSPC. git diff --check passed.
varunalla
deleted the
first-pass/eng-8589-don-t-log-the-mcp-client-secret-7407cff3
branch
September 18, 2026 19:41
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.
Opened by first-pass-pipeline from thread
7407cff3-942d-400f-8d0c-4ebade124008.Issue
ENG-8589: Don't log the MCP client secret under --debug
Problem
p0 claude mcp addprints the OAuth client secret when the user passes--debug:in
src/commands/claude/mcp.ts.The secret is otherwise handled carefully — it goes to the child process through the
MCP_CLIENT_SECRETenvironment variable specifically so it never lands on disk. The debug line undoes that. Anything that captures the terminal keeps the credential: scrollback, a CI job's log, or the output a user pastes into a support ticket when asking why the command failed.The value isn't needed to debug the command. Knowing whether a secret was set is enough, so the line can say that instead of printing it.
Found by CodeRabbit while reviewing Report failures from "claude mcp add". It's outside that PR's diff — the line has been there since the
claudecommand suite was added in p0-security/p0-docs#406 — so it's tracked here rather than fixed in passing.repo: p0cli
Definition of done
p0 claude mcp adddoes not print the OAuth client secret.MCP_CLIENT_SECRETenvironment variable.Linear: https://linear.app/p0-security/issue/ENG-8589/dont-log-the-mcp-client-secret-under-debug
Plan
Plan: Redact the MCP client secret from debug output
Steps
Replace the sensitive debug argument in
src/commands/claude/mcp.ts.Change the
provisionServerdebug call from passingclient.secretto reporting the literal status"set":debug(argv, "Client secret", "set"). Do not alter the OAuth arguments or the environment construction;MCP_CLIENT_SECRETmust continue receiving the exact secret.Extend coverage in
src/commands/claude/__tests__/mcp.test.ts.Add a debug-output test using a sentinel secret and captured
console.erroroutput. Verify that debug output reportsClient secret set(or the equivalent argument formatting), does not contain the sentinel value, and that the existing child-process environment test still proves the exact secret reachesMCP_CLIENT_SECRET. If needed for direct coverage, expose the provisioning function or use the project’s existing test seams without changing runtime behavior.Run the relevant validation.
Execute the MCP unit tests, then the repository type-check/lint or full unit-test commands as appropriate. Confirm formatting remains compliant.
Acceptance criteria
p0 claude mcp add --debugnever writes the OAuth client secret to debug output.MCP_CLIENT_SECRET; no secret value is added to Claude’s argument list or debug arguments.Files
src/commands/claude/mcp.tssrc/commands/claude/__tests__/mcp.test.tsTests
Client secretasset;MCP_CLIENT_SECRETreaches the spawned child unchanged.yarn test:unit(or the focused MCP test), plus type/lint checks if required by the repository workflow.Out of scope
clientDatahandling.src/drivers/stdio.tsor the Claude command’s--debugoption.Review
Implementation notes
Redacted the MCP OAuth client secret from debug output by logging only "set". Added coverage confirming the secret is absent from debug output and Claude arguments while remaining unchanged in MCP_CLIENT_SECRET. No findings were disputed. Tests and type/format checks could not run because dependencies are unavailable; yarn install failed with ENOSPC, and vitest/tsc/prettier were not found.