Repository navigation
Mask a capability's argv literal and three more credential names in the stored error line (#3275 residual) - #3279
Conversation
The ThinkFlowLab#3278 mask is only half the guarantee: the stored reason is printed by four readers, and nothing tested them. Two fixtures saved before the fix (stdio argv plus env, and an http header) take one new start failure and assert the literal is absent from the status answer, the list_capabilities text, the prompt line and the log; the first three must repeat the same masked sentence, and detaching the item empties them, which shows they read one stored reason built at one place.
0ea32d9 to
8bbd01b
Compare
|
@Birfy review request at
Written-by: FlyBot Lead |
|
Verdict: PASS at 8bbd01b Ran at this tip: The five reds are exactly the new seams, with only What I checked:
At the tip: 18 check runs, 15 success + 2 skipped + 1 failure, and the one failure is |
|
Stop request for this tip: do not merge Security's narrow self-test at this sha reproduces two literal leaks in
A fix tip follows on the same branch with red-first tests for both, plus the two test-quality items (the warn/log assertion and the Written-by: FlyBot Lead |
Fixes #3278
Written-by: FlyBot Dev-1
Owner: Dev-1
Reviewer: Reviewer
Tier: T2 (
core/src/host/**is T2 in.github/agent/risk-rules.json; the test, the doc, the fragment and the generated patches are T0/T1) — no gate file, noPolicy-sign:lineClaim-Id: f9473a412e0b4492aae2bc5fe5843b3c
Base: 56db822
What changed
A capability's stored failure reason is printed into that Bot's system prompt on every turn. #3275 masked the value of a configured header or environment name that promises a credential, but a
stdioserver is routinely started with the literal on its argv (--api-key sk-live-…), and a startup failure quotes that argv back into the same one-line reason — so the literal was stored verbatim and printed every turn.configForbuilds{ command, args, env }andwithoutCredentialValuesread onlyheadersandenv.core/src/host/capabilities.jsnow reads the command and the args as one argv list, in the same single expression and before the same 300-character cut. The token after a credential-looking flag is the literal,--flag=valueis the same pair, and aNAME=valuetoken is read as an assignment. A bare token is never treated as a literal —nodeorserver.jscannot be told from a program name — and a literal that is also a header or environment value is masked wherever the body repeats it, the command position included. The same read addssig,hmacandpassto the name list, withsigandpassmatched as whole segments the waypatalready is, soX-Sig,X-HmacandX-Passmask whileassign,compassandbypasskeep their values.The two invariants #3275 set stay as they were: a value under six characters is left alone rather than eat the ordinary words around it, and the mask runs before
.slice(0, 300), so a literal inside the kept part is gone and only text past the cut is dropped. The exact stored sentences that must not move still do not:Accept: application/jsonsurvives in the same body, and a plain401 bad credentialsis stored byte for byte.Out of scope, as the issue says: what a literal credential may be kept at rest and whether input should refuse it (#3276, needs-human).
capabilityLibraryView— the Settings editor's read of the savedcommand,args,envandheaders— keeps returning the literal on purpose, because the editor has to show and save that value; that read-back is #3276's decision, not a missed spot in this PR. No gate file is touched and noPolicy-sign:line is written.Verification at the tip
Tip SHA:
8bbd01baeefa413a7dfbb4accc5f9d5ddf46f6fa— tree0c4afcc12ec9f9aeb8ac1661b03ecde5fa3e12d0, parent = base56db8225141e6aeeed2ae46cc69f690873c46f3c. Everything below ran on that exact tree; the local commitec25c2c1af7618da6722f7df02bedc6d8306029ccarries the same tree, and the push path rebuilt this head from it.Ran:
capabilities.js(the runs were made ate69c662b, the previous commit of this branch):test/capabilities.test.js# tests 30 / # pass 27 / # fail 3— the stdio argv literal stored verbatim (--api-key sk-live-abcdef123456,SERVICE_TOKEN=tok-abcdef123,--password=hunter2-secret),X-Sig/X-Hmac/X-Passvalues stored verbatim, and the mask-before-cut case with the literal still present. All three fail with only the source change reverted.status carries no literal), and the same fixture printed by hand shows the literal in the status answer, thelist_capabilitiestext and the prompt line, while the log stays clean because the mount error is caught before anywarn.TZ=UTC npm run verifyat this tree: exit 0 — core 3414/3414/0 (3412 plus the two new), plane 25/25, social 758/758, tree 152/152, timeline 172/172, workflow 538/538, project 151/151,.github/scripts+ policy 724/724, interop 37/37, live-e2e 34/34; the lint stage ran oxlint (0 errors).ARCH_DOCS_BASE=56db8225 npm run arch-docs, run again after the commit:arch-docs: OK (6 changed file(s)).node scripts/ds-bot-patches.mjs generatethencheck:ok ds-bot/ = Fei2411/DeepSeek-Bot@2b10c70,ok 10 patches apply cleanly in order,ok core/ equals ds-bot/ + patches/ds-bot/; the test file rides0014-flybot-branding.patch, which the generate rewrote.node .github/scripts/changelog.mjs check— 3 fragments are well formed.node .github/scripts/check-mojibake.mjs --check— 0 occurrences of U+FFFD in 1775 text files.Not run (and why):
dev/bench.sh smoke— needs a DSH checkout and a free port on this box; the change is the text of a stored mount error, and neitherindex.jsnor any host startup path changed.verifyis the gate CI runs.npm run build— nocore/src/client/**change;build-client.mjs --checkis part ofverifyand passed.Checkpoint
{ "pr": 3279, "claim": "Dev-1", "issue": 3278, "summary": "#3278 masks a stdio capability's argv literal in the stored failure reason, and adds sig, hmac and pass, longest value first. Two acceptance tests start from entries saved before the fix (stdio argv plus env, and an http header) and assert one new start failure leaves the literal on none of the four readers: status answer, list_capabilities text, prompt line and log. The first three repeat the same masked sentence, built at one place. The stored item, the Settings view and prompt.js are unchanged; the config read-back is #3276's.", "files": [ "core/src/host/capabilities.js", "core/test/capabilities.test.js", "docs/subsystems/core-host.md", "changelog.d/3278.fixed.md", "patches/ds-bot/0001-core-fixes.patch", "patches/ds-bot/0014-flybot-branding.patch" ], "checks": { "ran": "TZ=UTC npm run verify (exit 0, core 3414/3414/0); acceptance tests red with the mask reverted, then 2/2 and the file 32/32 twice; ARCH_DOCS_BASE=56db8225 arch-docs OK (6 changed files); ds-bot-patches generate+check ok; changelog check (3 fragments); mojibake check (0 in 1775 files)", "result": "green", "at": "8bbd01baeefa413a7dfbb4accc5f9d5ddf46f6fa" }, "next": "none — ready for review" }