Repository navigation
Description
Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment on this issue.
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: d502a1267d0d4ec696aefc9d09021969
Branch: dev/1-capability-echo
Base: e3caccb
At: 2026-11-21T02:48:43Z
Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment on this issue.
A capability's stored failure reason is printed into the system prompt on every turn, and a server that echoes a request header in its own error body can put a literal credential there.
What happens
#3274 taught the Bot to name a broken capability before it acts: core/src/host/prompt.js renders capabilityStatusesView()[bot.id] and prints one line per capability in state error or needs-approval. The error text comes from core/src/host/capabilities.js:315, which joins the mount error and its cause, runs rt.redactSecrets(...), then cuts to 300 characters and stores it.
redactSecrets (core/src/host/secrets.js:43-74) is value-based: it replaces the saved secret values of this host, and nothing else. So any credential-shaped text that is not a saved value passes through into the stored reason, and from there into the prompt:
- github (mcp): Error POSTing to endpoint: {"error":"unauthorized","echoed":"X-Tenant-Key: abc123"} — tell the user before acting.
Two things make that reachable with a real server, both verified on live main 4a3ad732 plus the installed transport:
- An MCP capability's
headersmay be literal strings, not only$DSH_SECRET_*refs —resolveValues(capabilities.js:255-263) only substitutes secret refs, andstringMapat:119accepts any text. - When a
streamable-httpmount fails, the transport builds its error from the server's own response body:throw new StreamableHTTPError(response.status, 'Error POSTing to endpoint: ' + bodyText)— read in the installed@modelcontextprotocol/sdk,dist/esm/client/streamableHttp.js:378, which reaches us through@deepseek-ai/dsh@0.2.1-rc.2→dsh-mcp-client(core/dev/harness/package.json).
A server that reflects request headers (or just echoes its request body) therefore writes a header value into a host-stored string that the model reads every turn.
Reproduction
- Attach an MCP capability (streamable-http) whose server answers a JSON-RPC request with a 401/5xx body that echoes a request header, e.g.
X-Tenant-Key: abc123, and configure that header as a literal string (not a secret ref). - Let the mount fail.
capabilities.js:315storesError POSTing to endpoint: …X-Tenant-Key: abc123…, 300 chars max. - Open a Bot turn. The system prompt now carries
X-Tenant-Key: abc123— every turn, in the prompt, not just in a log.
Expected
A stored reason never carries a credential-shaped literal taken from configuration: either the value is masked at the store, or a literal header value that looks like a credential is refused at input with a message pointing at secrets. A plain reason (401 bad credentials, Connection failed) must render exactly as it does today — #3274's line format and its byte-identical case do not change.
Scope (smallest cut that closes it)
core/src/host/capabilities.js— mask credential-shaped text in the joined error before the 300-char cut (the same place the userinfo masking from Tell a Bot in its system prompt when one of its capabilities is down #3274 lives), and/or refuse a literal header value that matches a credential shape at:114-119with a clear sentence that names secrets.core/test/capabilities.test.js— red first: a stored reason carryingX-Tenant-Key: abc123is masked;401 bad credentialsis stored unchanged; Tell a Bot in its system prompt when one of its capabilities is down #3274's userinfo case still passes.changelog.d/<issue>.fixed.md;docs/subsystems/core-host.mdonly if the capability/prompt doc line changes.
Risk tier: T2 — core/src/host/** is T2 in .github/agent/risk-rules.json; core/test/** and changelog.d/** are T1. No gate file, no Policy-sign:.
What this is not
This is not a hole opened by #3274. The same string already reaches the client badge (channel.js:223) and list_capabilities output today, and a connected server's own instructions already enter the system prompt via systemPrompt.section({name: 'mcp:<server>'}). #3274 widened how often it is read (every turn, one line, 300 chars), which is why it is worth closing — not why it exists. #3274's body records it as a weighed residual; this issue is the follow-up.
Dedupe (checked before opening, on live main)
Error POSTing to endpoint → only #3274 (the PR that closes the adjacent URL-userinfo half). redactSecrets → #2002/#2007 (300 UTF-16 units, half a surrogate pair) and #2016 (no … on the cut) are closed and about the cut, not about what the text carries; #2699/#2700 (paths and keys out of room lines) are a different sink. userinfo URL and capability error message secret → #3274 and unrelated closed issues. No duplicate.
Bot: FlyBot Lead
Written-by: FlyBot Lead
Activity
Mask cookie, session and PAT values an echoed error repeats