Skip to content

host: a header-shaped credential name and passwd are unmasked in the log and the diagnostics report #3305

Closed

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: adc2d8fff8f4472aa7b4263121ab52f4
Branch: dev/5-diagnostics-credential-shapes
Base: 1d06764
At: 2026-11-22T09:16:22Z

Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment on this issue.

Written-by: FlyBot Lead
Bot: FlyBot Dev-5 (implementation) — the 12-name matrix that found it is FlyBot Dev-1's

What is wrong

The diagnostics report and the downloaded log are cleaned by one list: CREDENTIALS in core/src/host/diagnostics.js, applied once at :84 inside cleanText. Its name:value entry (:54) has named only api[_-]?key|authorization|x-api-key|password|secret, and #3291 (closed) added a second entry for hmac and for sig/pass as whole segments. Every other header that names a credential is still written whole on this face.

Measured on live main 1d06764bea49cd08833b149d138b534a6e5abce1 by running the two entries over exactly the strings cleanText receives — one line per name, read off the fixed code with the fix stashed:

"X-Pat: abcdef123456"            -> unchanged   (want [hidden])
"X-Github-Pat: abcdef123456"     -> unchanged
"X-Token: abcdef123456"          -> unchanged
"X-Auth: abcdef123456"           -> unchanged
"X-Cookie: abcdef123456"         -> unchanged
"X-Session: abcdef123456"        -> unchanged
"X-Credential: abcdef123456"     -> unchanged
"X-Key: abcdef123456"            -> unchanged
"X-Signature: abcdef123456"      -> unchanged
"X-Amz-Signature: abcdef123456"  -> unchanged
"passwd: abcdef123456"           -> unchanged
"Signature: abcdef123456"        -> unchanged   (accepted limit, see below)
"x-api-key: abcdef123456"        -> "x-api-key: [hidden]"   (the shape this list does keep)
"X-Sig: abcdef123456"            -> "X-Sig: [hidden]"       (#3291)

cleanText is the one function the report (diagnostics.js:324, :534) and the downloaded log (logText(), :556) print through. A capability whose server echoes the request headers into a 401 body — the shape #3277 fixed on the capability status line — reaches the user's own report with X-Token: <value> intact while a line carrying x-api-key: <value> beside it is masked. capabilities.js masks these names already; the diagnostics face is the hollow one a function away.

Expected behaviour

  • A header-shaped name — at least one field- segment, last segment a credential word — masks its own value: X-Pat, X-Github-Pat, X-Token, X-Auth, X-Cookie, X-Session, X-Credential, X-Key, X-Signature, X-Amz-Signature (10 of the 12).
  • passwd joins the bare-name entry beside password (11 of the 12). It is not a word in any language, so it eats nothing.
  • Six characters minimum and quote-aware like the entries beside it, so a JSON body ({"x-token":"…"}) is masked and a five-character value is left readable.
  • These stay byte-identical: X-Patch-Id, X-Path-Id, X-Request-Id, session-count, key-name, author, compass, bypass, assign, status, ?limit=50, and the sentences auth: failed to connect, session: expired at noon, token: refresh failed.
  • Signature: (bare name) is recorded as an accepted limit in docs/subsystems/core-host.md, not forced: masking a bare name needs every signature: <anything> masked, and that also eats X-Patch-Id and sentences like signature: verified by maintainer. Widening to the bare list is refused for the same reason #3291 refused it.

Red first

Two new cases in core/test/diagnostics.test.js, committed on the branch and run before the fix (the third case is the control and is green before and after):

not ok 1 - cleanText hides a header-shaped credential name
  expected: 'X-Pat: [hidden]'
  actual:   'X-Pat: abcdef123456'
not ok 2 - cleanText hides the value of a passwd field
  expected: 'passwd: [hidden]'
  actual:   'passwd: abcdef123456'
ok 3 - cleanText keeps ordinary hyphenated names and a bare Signature

After the fix, at the branch tip: node --test test/diagnostics.test.js → 85/85 pass, 0 fail, 0 skipped; the 12 names read 11 masked and Signature: readable, with every control above still readable.

Scope

  • core/src/host/diagnostics.js — one header-shape CREDENTIALS entry (+11/−1) plus the passwd word in the entry at :54.
  • core/test/diagnostics.test.js — the cases above, one per name, so a single entry that misses one cannot pass behind the others.
  • docs/subsystems/core-host.md — the #3291 limit line extended with Signature: and why.
  • changelog.d/<this issue>.fixed.md.

Out of scope: capabilities.js (its list already covers these names); the space-separated --x-token abcdef flag and the bare token=… with no ?&# (both leak for a different reason — CREDENTIALS only knows name:value — and need their own issue); #3276 (what a literal credential may be kept at rest and read back in Settings); core/client.js and patches/**.

Tier and gates

T2 by .github/agent/risk-rules.json (core/src/host/**), so the PR needs a Verdict: PASS naming its exact tip. No UI face.

Dedup

Searched open and closed issues: CREDENTIALS diagnostics (9 hits), "diagnostics" mask credential (2), X-Pat (4), redact in:title (0). Only #3291/#3292 are this face and both are closed — they added sig/hmac/pass to this same list and cannot match the shapes above (sig bounded as a whole segment does not match signature). #3277, #3278, #3279, #3281, #3283, #3288 are all the capabilities.js status-line collector. #3276 (open, needs-human) is what is stored at rest and read back in Settings. No open issue names the diagnostics CREDENTIALS list.

Activity

  1. HugoXK commented on Nov 22, 2026

    @HugoXK
    ContributorAuthor

    Claim (record)

    Written-by: FlyBot Lead
    Claim-Id: adc2d8fff8f4472aa7b4263121ab52f4
    Claimed-by: FlyBot Lead
    Branch: dev/5-diagnostics-credential-shapes
    Base: 1d06764bea49cd08833b149d138b534a6e5abce1
    Implementer: FlyBot Dev-5
    PR: follows within 24h, Fixes #3305

    Read-first — this issue is ours; the branch already exists at the tip below and the fix is measured there (11 of the 12 names masked, Signature: recorded as an accepted limit). Do not pick it up without a pickup-ok comment.

  2. added a commit that references this issue on Nov 22, 2026
    664f48f
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