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: faa3c1d2925944138295914255b76a5c
Branch: dev/3288-a-credential-flag-followed-by-another-fl
Base: 5cc2dee
At: 2026-11-21T17:17:14Z
Bot: FlyBot Dev-1 (measured the leak and the minimal fix locally), FlyBot Lead.
#3281 landed on main as 59ee395726317d02c1de57134752ecba8d0d947d ("Mask a capability's inline command line and dash-prefixed credential values"). One shape of that same collector still writes a credential literal whole.
The leak
withoutCredentialValues (core/src/host/capabilities.js, main 5cc2dee8) takes the next token as the value whenever the current token is a credential-looking flag, then skips it:
const next = argv[index + 1]
if (!flag || !CREDENTIAL_NAME.test(flag[1]) || typeof next !== 'string') continue
collect(flag[1], next)
index += 1When that next token is itself a flag, it is collected as the value, replaced, and skipped — so the token after it, the real value, is never collected. The comment above the collector even documents this as intended for a repeated flag ("a second --api-key is masked as a value; that over-mask is the accepted cost"); it is not over-masking, it is a miss.
Two shapes, both measured on the merged code with the real cross-spawn error text:
args: ['server.js', '--api-key', '--api-key', 'sk-live-abcdef123456']
stored: … server.js [hidden] [hidden] sk-live-abcdef123456
args: ['server.js', '--api-key', '--token', 'sk-live-abcdef123456']
stored: … server.js [hidden] [hidden] sk-live-abcdef123456
Both leave a literal credential in the status sentence, which the system prompt prints every turn. Two credential flags side by side (--api-key … --token …) is a shape a real entry can carry; a repeated flag is one paste away.
Expected behaviour
- When the token after a credential-looking flag is itself a flag (
--name/-n/--name=value), do not consume it as the value: leave it to be read as its own flag, so the following token is collected and masked. - Keep the documented cost that is real:
--api-key --verbose→--api-key [hidden](a non-credential flag is still read as the value). Do not widen into a value-shape heuristic and do not mask bare tokens. - Tests, red-first, one per shape: the repeated flag and the two different credential flags, each asserting the stored sentence carries no literal; plus the unchanged
--api-key --verbosecost. - The comment at the collector,
docs/subsystems/core-host.mdand achangelog.d/fragment updated in the same PR: the repeated-flag sentence as written is wrong, and this is the corrected description.
Timing at #3279's merge (recorded as evidence, not a finding of this issue)
PASS naming tip 8bbd01ba at 04:44:00Z; the author stop request and its comment at 04:47:43Z; removed_from_merge_queue at 04:47:57Z; merged as 202fcc67 at 04:47:58Z. The queue entry was already judged when the stop arrived. This issue asks for no gate change here: it exists so the sequence is on the record, and it is not a second occurrence.
Out of scope
- Bare single-token
command/ bareargstokens (documented limit). - Masking configured values in
capabilityLibraryView(A capability's literal credential is stored in plain text and sent back to the Settings client #3276). - Dsh-side
connection attempt failed: <error>log line (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 duplicate, --api-key, mask, credential flag; only #3273, #3275, #3278 and #3281 (all closed, same collector) came back. Live main 5cc2dee8930d8266e01022b2bbf7091c0a40f3e6 still stores the literal.
Activity