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: f9473a412e0b4492aae2bc5fe5843b3c
Branch: dev/3278-mask-a-capability-s-argv-literal-and-thr
Base: 56db822
At: 2026-11-21T03:55:19Z
Bot: FlyBot Security, FlyBot Dev-1 (each reproduced a different seam of this residual)
Same category as #3273 and #3275: the one-line status reason a failed capability stores, which the system prompt prints every turn. #3277 masked headers/env values whose name promises a credential. Three seams are still open at the merged tip 56db8225141e6aeeed2ae46cc69f690873c46f3c.
1. command / args are not masked at all
configFor (core/src/host/capabilities.js:296) builds { transport: 'stdio', serverName, command, args, env, failOnStartupError }, but withoutCredentialValues (:54-66) reads only config.headers and config.env:
const values = Object.entries({ ...config?.headers, ...config?.env })
.filter(([name, value]) => CREDENTIAL_NAME.test(name) && typeof value === 'string' && value.length >= 6)A stdio server is routinely started with the literal on its argv. When it fails to start, the transport's message quotes that argv back, so the literal is stored and then printed into the prompt every turn:
- entry:
kind: mcp,transport: stdio,command: node,args: ['server.js', '--api-key', 'sk-live-abcdef123456'] - the server exits non-zero at startup
- the stored
status.errorcontainssk-live-abcdef123456verbatim
2. Three name holes in the list
CREDENTIAL_NAME (:53) is key|token|secret|auth|password|passwd|credential|signature|cookie|session|bearer, plus pat as a whole segment. Probed by FlyBot Security at 48f1eb43702d3f429fefa380bee3fc81034a475c against the tip's own runtime: a body echoing X-Sig: <value>, X-Hmac: <value> or X-Pass: <value> is stored verbatim (values ≥ 6 characters, so the length filter is not the reason).
Expected behaviour
-
A literal that follows a credential-looking flag in
args(and incommandwhen the whole value is the literal) is replaced with[hidden], in the same place and order as today: inside the single expression at:345, before.slice(0, 300). -
sig,passandhmacjoin the name list.sigandpassneed the whole-segment treatmentpatalready has, soassign,bypassandcompasskeep their values;hmacneeds none. -
Unchanged: one line, ≤ 300 characters, mask before the cut;
Accept: application/jsonand401 bad credentialsstay byte-identical; a value under six characters is still skipped (:47-48documents why). -
Tests that fail without the change, one per seam; the two byte-identical controls kept;
docs/subsystems/core-host.mdand achangelog.d/fragment updated in the same PR. -
An entry written before this fix still holds the old text. Its read-back must be sanitized too, so the stored-state API response,
list_capabilities, the prompt line and logs never carry the literal. This holds whichever way A capability's literal credential is stored in plain text and sent back to the Settings client #3276 is settled.
Acceptance (Chief's call, before implementation)
- Independent of A capability's literal credential is stored in plain text and sent back to the Settings client #3276. These criteria hold whichever way the owner settles A capability's literal credential is stored in plain text and sent back to the Settings client #3276: that issue decides whether a literal credential may be stored at all; this one decides that what is stored never comes back verbatim.
- Covers data already on disk. A Bot whose library state was written before this fix still holds the literal in
status.error; the read-back path must stop emitting it too, not only the new-write path. The tests assert on the outward faces (the prompt line,list_capabilitiestext, the stored-state API response and the log line), not only on the masking helper: no API response and no log line may carry the literal. - No widening beyond the three names.
sig,hmac,passclose this hole and the list stops there; do not restructure the heuristic or add names outside it. A heuristic rewrite is a different risk tier (a sibling project's PR was blocked for exactly that). - Does not displace other work. Mask a capability's argv literal and three more credential names in the stored error line (#3275 residual) #3278 keeps its 24h PR window without taking the Dev off anything else in the queue.
Out of scope
- What a literal credential may be kept at rest, and whether the input should refuse it: that is A capability's literal credential is stored in plain text and sent back to the Settings client #3276 (needs-human), not this issue.
- A value under a name nobody would call a credential is outside the heuristic by definition.
- Masking the configured values that
capabilityLibraryView(:572, the Settings editor’s read-back) returns is A capability's literal credential is stored in plain text and sent back to the Settings client #3276’s owner decision, not this PR.
T2 by .github/agent/risk-rules.json (core/src/host/**), so the PR needs a Verdict: PASS naming its tip.
Duplicate check: searched open and closed issues for credential, args and mask — only #3275, #3276 and #3277 came back; live main at 56db8225 still has the mask reading headers/env only (:54-66).
Activity
Prove a stored capability reason has one masked source on every surface