Skip to content

fix(core,daemon): redact gateway.token in the start log line and daemon.started - #279

Merged
V3RON merged 4 commits into
mainfrom
bug/170
Oct 2, 2026
Merged

V3RON merged 4 commits into
mainfrom
bug/170

Conversation

@V3RON

@V3RON V3RON commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Closes #170

A worker's gateway.token no longer reaches daemon.log, the event ring, or events.jsonl.

redactConfig(config) in src/core/config.ts returns a copy with a set gateway.token replaced by [redacted]. DaemonServer uses it for the daemon.started payload and the Daemon started log line. The payload keeps all its keys, so set and unset still read differently. config.get and the gateway uplink still get the live config, and the token with it.

Records written before this fix still hold the token. The release note should tell operators to rotate their join tokens.

Docs: the daemon.started row in both EVENTS.md files, the log contents list in docs/CLI.md, and the gateway.token row in docs/CONFIGURATION.md.

Checklist

  • Regression test: src/daemon/main.test.ts › "keeps gateway.token out of the daemon log, the events.replay answer, and events.jsonl, while config.get still returns it". This is the triage test, and it now passes.
  • The payload and the log line show the marker instead of dropping the key: src/daemon/main.test.ts › "keeps gateway.token in the daemon.started payload and the Daemon started log line as the redaction marker…".
  • redactConfig leaves its input untouched, and leaves an unset token unset: the two tests under redactConfig in src/core/config.test.ts.
  • Each test fails on a named assertion when its code is broken (no redaction, delete instead of mask, mutate the input, always mask).
  • pnpm check passes.

Review

Spec review: 7 findings over two rounds, 2 fixed. Code review: 1 finding, 0 fixed.

Rejected:

  • Editing docs/CLI.md and docs/CONFIGURATION.md goes beyond the fix. Rejected: CLI.md said the log holds the effective config, which this change made untrue. CONFIGURATION.md is where users look up gateway.token.
  • Exporting REDACTED_VALUE was not asked for. Rejected: the tests assert the marker by name instead of copying the literal.
  • The triage test checks the in-memory log sink, not the daemon.log file. Rejected: the sink is the seam daemon.log is written through, and the test swaps a memory sink into that seam.
  • The docs say the log and event show [redacted], which is not true of records written before upgrading. Rejected: the docs describe current behaviour, and older records belong in the release note, as above.

Written by an agent.

@V3RON
V3RON merged commit 3d8eef0 into main Oct 2, 2026
14 checks passed
@V3RON
V3RON deleted the bug/170 branch November 6, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The worker's gateway join token is written in plaintext to the daemon log and the event stream

1 participant