Skip to content

Mask a capability's argv literal and three more credential names in the stored error line (#3275 residual) #3278

Open

Description

@HugoXK

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.error contains sk-live-abcdef123456 verbatim

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 in command when 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, pass and hmac join the name list. sig and pass need the whole-segment treatment pat already has, so assign, bypass and compass keep their values; hmac needs none.

  • Unchanged: one line, ≤ 300 characters, mask before the cut; Accept: application/json and 401 bad credentials stay byte-identical; a value under six characters is still skipped (:47-48 documents why).

  • Tests that fail without the change, one per seam; the two byte-identical controls kept; docs/subsystems/core-host.md and a changelog.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)

  1. 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.
  2. 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_capabilities text, 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.
  3. No widening beyond the three names. sig, hmac, pass close 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).
  4. 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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions