Skip to content

Mask a capability's inline command line and a dash-prefixed credential value #3281

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: 01a19417f4864994854adea79c10ba39
Branch: dev/3281-mask-a-capability-s-inline-command-line
Base: 202fcc6
At: 2026-11-21T05:09:09Z

Bot: FlyBot Security (both leaks reproduced at 8bbd01ba, the tip merged as #3279); FlyBot Test (two test-quality items).

Same category as #3273, #3275 and #3278: the one-line status reason a failed capability stores, which the system prompt prints every turn. #3279 merged as 202fcc6711ac1e8af0877a7ab6865f05088487ae and masks credentials in headers, env and the args flags, but two shapes the issue's expected behaviour names are still stored whole (core/src/host/capabilities.js, blob 112c42b3).

1. A command holding an inline command line is not parsed

configFor passes command raw, and the collector reads it only as one token (--flag, --flag=value, NAME=value). A stdio entry saved from a pasted line, command: 'node server.js --api-key sk-live-abcdef123456', fails at spawn and cross-spawn quotes the whole line back:

spawn node server.js --api-key sk-live-abcdef123456 ENOENT

That sentence is stored verbatim and printed every turn. The issue said "and in command when the whole value is the literal"; the inline form is still open.

2. A value starting with - is skipped

withoutCredentialValues skips the next token when it starts with -, so --api-key -s3cr3t-abcdef is stored verbatim. A 6+ character credential that begins with - is a real shape (generated tokens, pasted flags).

Expected behaviour

  • A command that contains whitespace is read as a command line and goes through the same rules as args (--flag value, --flag=value, NAME=value), so the literal is [hidden] in the stored reason.
  • After a credential-looking flag, the next token is the value even when it starts with -. The accepted text cost is recorded in the doc, the fragment and the PR body: --api-key --verbose becomes --api-key [hidden], and --api-key --api-key sk-live-… masks the second --api-key as well.
  • Two test-quality items from Mask a capability's argv literal and three more credential names in the stored error line (#3275 residual) #3279, same PR: the warn/log face is either pinned by a real path or described as construction (never "tested") in the body, and the <6 skip is pinned with a credential-name flag and exactly a five-character value, so removing the value.length >= 6 filter turns that test red.
  • Unchanged: one line, ≤ 300 characters, mask before the cut; Accept: application/json and 401 bad credentials stay byte-identical; the sig/hmac/pass list, pat/sig/pass whole-segment matching and longest-value-first ordering stay as they are.
  • docs/subsystems/core-host.md and a changelog.d/ fragment updated in the same PR.

Out of scope

  • A command that is a single bare token (no whitespace) stays unmasked: it cannot be told from a program name, the same documented limit as a bare args token. No value-shape heuristic is added; the limit is written into core-host.md.
  • Masking configured values in capabilityLibraryView (the Settings editor's read-back) is A capability's literal credential is stored in plain text and sent back to the Settings client #3276's owner decision.
  • The Dsh-side log line dsh-mcp-client lib/index.js:660 connection attempt failed: <error> is outside this repository.

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 command, argv, dash, mask; only #3275, #3276, #3277, #3278 (all closed) and this residual came back. Live main 202fcc6711ac1e8af0877a7ab6865f05088487ae still has both shapes.

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