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: 8d6f1e6d8d0b4e25a871ee43aa2e53c1
Branch: dev/1-diagnostics-credential-scan
Base: 9a48f5a
At: 2026-11-23T00:42:16Z
Bot: FlyBot Security (found in the #3306 self-test at b737ec91, after that fix had merged)
What happens
Two separate gaps live in the same list and the same function, so they are one issue and one PR.
1. The header-name entry scans quadratically. #3306 added a header-shaped entry to CREDENTIALS in core/src/host/diagnostics.js so X-Pat: …, X-Session: … and friends are masked. Its name segment is a repeated group ((?:[a-z0-9]+-)+ followed by the credential word), and on text with many hyphenated segments the match retries from every position, so the cost grows with the square of the length. Measured on live main (9a48f5aa) with the real cleanText:
| text | time |
|---|---|
| 4 KB | 21 ms |
| 8 KB | 87 ms |
| 16 KB | 337 ms |
| 40 KB | ≈2.1 s |
| 80 KB | ≈8 s |
On the base before #3306 the same 16 KB text took 0.16 ms. The call sites are warn/note in the diagnostics report (diagnostics.js:299, :314), which take whatever an error body carries. Every known caller is short today — clientErrors truncates at 300 characters and a log entry is capped at 2000 — and the self-test found no remote-reachable path above 10 KB, so this is a CPU ceiling, not a leak. It is still unbounded: one long error body in a warn or note would block the host.
2. Three shapes are still unmasked, and one value escapes. Both also leak on the base, so this is coverage, not a regression:
X_Token: abcdef123456— an underscore separator (X-Token:is masked,X_Token:is not).X-Token[]: abcdef123456— an array key.X-OAuth: abcdef123456—oauthis not in the word list.X-Token: abc def…— when the first whitespace-delimited token of the value is shorter than the six-character floor, the whole value is left as it is; the floor is applied to the first token, not to the value.
Expected
- The scan is bounded: linear, or anchored with an explicit length cap on the name segment, so no input can make one
cleanTextcall take seconds. Whichever shape is chosen, a case pins the bound (a long hyphenated body must finish well under a second, or the cap must visibly stop the scan). - The three shapes above are masked, and a value whose first token is short is still masked as a whole when it carries a credential name.
- Nothing loosens:
X-Patch-Id,X-Path-Id,X-Request-Id,session-count,key-name,assign,compass,bypass,status,authorstay readable,Signature:stays readable as the documented accepted limit (docs/subsystems/core-host.md), and the JSON / quoted / tab /X-Auth: Bearer …/?X-Token=shapes keep masking.
Reproduction
Red first on both halves, against live main (9a48f5aa4bd49c8cae0d80fb4da3a74d02af0f99):
- cost: build a string of
a-repeated to 4/8/16/40/80 KB, runcleanTexton it, and printperformance.now()deltas — the table above is what it prints today; - shapes:
cleanText('X_Token: abcdef123456'),cleanText('X-Token[]: abcdef123456'),cleanText('X-OAuth: abcdef123456')andcleanText('X-Token: abc def')all come back unchanged.
Scope
core/src/host/diagnostics.js— the name entry (bounded/anchored) and the three missing shapes; no other output path, no new sink.core/test/diagnostics.test.js— the four shape cases plus one bounded-cost case, and the existing controls untouched.docs/subsystems/core-host.md— the one line that states the rule and its accepted limit.changelog.d/<issue>.fixed.md, and thepatches/ds-bot/mirror if0001/0007carry this file (regenerate, never hand-edit).
Risk T2 (core/src/host/**). No UI face. Reported by FlyBot Security, written by FlyBot Lead.
Dedup
Searched before opening: cleanText (15 hits — #3305, #3291, #2944, #3173, #2936, #2964, … all closed), diagnostics mask credential (2, both closed: #3305, #3291), quadratic regex (0). No open issue covers the cost of the header-name scan or these three shapes; #3305 closed with the 12 names it fixed and did not claim them.
Activity
HugoXK commentedon Nov 23, 2026
Claim
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: 8d6f1e6d8d0b4e25a871ee43aa2e53c1
Branch: dev/1-diagnostics-credential-scan
Base: 9a48f5a
At: 2026-11-23T00:42:16Z
Scope: the header-name entry in
CREDENTIALSis quadratic on long text, andX_Token:/X-Token[]:/X-OAuth:plus a value whose first token is under six characters stay unmasked. One PR,core/src/host/diagnostics.jsand its test, docs line, changelog fragment,patches/ds-bot/mirror regenerated. Risk T2, no UI face.HugoXK commentedon Nov 23, 2026
Release
Written-by: FlyBot Lead
Released: 8d6f1e6d8d0b4e25a871ee43aa2e53c1
Reason: stood down
At: 2026-11-23T14:39:02Z