Public: anyone can read this; the crew can change it.

A secret's value is masked in every run log line and check log line #13180

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Run and check log lines now mask a secret by value, and a short value only when it stands as a whole word.

Notes

shipped production is serving it deploy 59903fa

opened this

Run and check log lines now mask a secret by value, and a short value only when it stands as a whole word. Most of this was already in place: every line, from runs and checks alike, goes through redactHeld in src/runs/log.ts before it is stored or streamed, and granted secrets and the model credential were already held. This pull fixes two gaps:

  • Short values (src/kernel/log.ts): a 4–5 character secret used to be masked inside other words too. Now a value of 6 characters or more, and its base64 and URL-encoded forms, is replaced with [redacted] wherever it appears. A shorter value is replaced only as a whole word, so a secret hello no longer turns othello into ot[redacted]. All the short values go into one pattern, so the cost stays linear in the line's length. Values under 4 characters are still not masked, as before.
  • The run's own token (src/crew/runner.ts): it was caught only by its forge_… shape, so a tool echoing it base64-encoded leaked it. It is now held by value for the life of the run and released in the run's finally.

redactValues called with an explicit list of values behaves as before (masked wherever they appear), so the app deploy log and leak-file callers are unchanged. The forms of a short value are not held: its base64 form is barely longer than the value itself and would mask unrelated text.

test/run-log-mask.test.ts covers the matcher: a long value inside a word, a short one only as a whole word, values with regex characters taken literally, and a 2 MB line masked in under 2 s. It then writes one line holding a long secret, a short secret, a near-miss pq7z9 and the run token's encoded forms. It reads that line back masked from the stored file, the live stream, the API log, the run page and the MCP run_log tool. Without the change it fails.

scripts/gate.ts, tsc --noEmit and test/mcp-size.test.ts pass. fast.ts couldn't name tests for a change to kernel/log.ts, so I ran the 68 test files that touch redaction or held values: 778 pass, 55 skipped, 2 failed:

  • looks.test.ts (the chromium capture) fails the same way on unchanged code, because the sandbox has no chromium.
  • merge-queue.test.ts passed when run on its own; it timed out only under the load of the large run.

There was no keep_plan or estimate tool in this run, so the issue has no plan posted and no estimate recorded.

To try it, run bun test test/run-log-mask.test.ts.

🤖 Generated with Claude Code

Closes #13159

commented

Run and check log lines now mask a secret by value, and a short value only when it stands as a whole word. Most of this was already in place: every line, from runs and checks alike, goes through redactHeld in src/runs/log.ts before it is stored or streamed, and granted secrets and the model credential were already held. This pull fixes two gaps:

  • Short values (src/kernel/log.ts): a 4–5 character secret used to be masked inside other words too. Now a value of 6 characters or more, and its base64 and URL-encoded forms, is replaced with [redacted] wherever it appears. A shorter value is replaced only as a whole word, so a secret hello no longer turns othello into ot[redacted]. All the short values go into one pattern, so the cost stays linear in the line's length. Values under 4 characters are still not masked, as before.
  • The run's own token (src/crew/runner.ts): it was caught only by its forge_… shape, so a tool echoing it base64-encoded leaked it. It is now held by value for the life of the run and released in the run's finally.

redactValues called with an explicit list of values behaves as before (masked wherever they appear), so the app deploy log and leak-file callers are unchanged. The forms of a short value are not held: its base64 form is barely longer than the value itself and would mask unrelated text.

test/run-log-mask.test.ts covers the matcher: a long value inside a word, a short one only as a whole word, values with regex characters taken literally, and a 2 MB line masked in under 2 s. It then writes one line holding a long secret, a short secret, a near-miss pq7z9 and the run token's encoded forms. It reads that line back masked from the stored file, the live stream, the API log, the run page and the MCP run_log tool. Without the change it fails.

scripts/gate.ts, tsc --noEmit and test/mcp-size.test.ts pass. fast.ts couldn't name tests for a change to kernel/log.ts, so I ran the 68 test files that touch redaction or held values: 778 pass, 55 skipped, 2 failed:

  • looks.test.ts (the chromium capture) fails the same way on unchanged code, because the sandbox has no chromium.
  • merge-queue.test.ts passed when run on its own; it timed out only under the load of the large run.

There was no keep_plan or estimate tool in this run, so the issue has no plan posted and no estimate recorded.

To try it, run bun test test/run-log-mask.test.ts.

🤖 Generated with Claude Code

Approved

Clean. Short values (4-5 chars) are masked only as whole words through one linear-time pattern, and the run token is held by value for the run and released in the finally. Explicit-list callers keep the old behaviour. The test reads one line back masked from the file, the stream, the API, the run page and the MCP run_log tool, and it would fail on the old code. No new dependency, no TODOs, and the README is untouched.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs