Repository navigation
fix: stop redacting prose after "pass:" in transcripts and logs - #160888
Conversation
The unquoted config-assignment pattern treated bare `pass` as a secret key in both the colon and the equals form, so a sentence such as "tests now pass: older clients ..." lost its next word to `***` in persisted transcripts and logs. The colon alternative now uses a key list without bare `pass`; `pass=`, `pass = `, namespaced, prefixed, quoted, query, and form-body forms keep masking.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 29, 2026, 2:46 AM ET / 06:46 UTC (Revision 12). ClawSweeper reviewWhat this changesThe branch changes log and transcript redaction to preserve prose after Merge readiness✅ Ready for maintainer review Keep open. Current main still masks ordinary prose after Priority: P1 Review scores
Verification
How this fits togetherOpenClaw's redaction policy processes agent messages, provider errors, and log text. Its output reaches persisted transcripts, logs, and error previews. flowchart LR
A[Agent messages and logs] --> B[Redaction policy]
C[Provider errors] --> B
B --> D{Prose or credential field?}
D --> E[Preserved text]
D --> F[Masked credential]
E --> G[Transcript and log output]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +96, Tests +199. Total +295 across 7 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the shared redaction policy at transcript, log, and provider-preview boundaries, preserving ordinary prose while masking credential-shaped records and retaining the documented inline-field tradeoff. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main's bare Is this the best way to solve the issue? Yes. The patch changes the shared redaction owner and covers its transcript and provider-preview callers; the earlier preview gap is repaired on this head. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c259398c7cb3. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
|
Review found that dropping bare `pass` from the colon form also exposed
unquoted `pass: value` lines in config-shaped text. A record-start pattern now
keeps those masked (text or line start with indentation, or right after `{` or
`,`); only a `pass:` that follows another word mid-sentence is treated as prose.
…terns Review found `- pass: value` list items uncovered by the record-start rule; the rule now accepts a YAML `- ` marker after indentation and a `;` separator. The first attempt used an optional nested group that the safe-regex guard rejects, which silently dropped the whole pattern, so a new test asserts every default string pattern compiles under that guard.
…-pass # Conflicts: # src/logging/redact.test.ts
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…able Leave src/logging/redact.test.ts byte-identical to main and host the prose/config `pass:` boundary cases in redact-patterns.test.ts next to the patterns they pin.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…ith full context Review found two boundary gaps in the record-start rule: a carriage-return-only line break before `pass:` was not a record start, and the `^` alternative could read a 16 KiB chunk start as a record start in long text, masking prose. Accept `\r` as well as `\n`, and register the pattern as chunk-unsafe so it always sees the full text. Regressions cover both, and the chunk case fails without the registration.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Review found `user=bot pass: value` unmasked: the record-start rule only knew line starts and a few separators. A preceding inline `key=value` / `key:value` field, and `(`, `[`, `|`, `&` or a quote, now count as record context, while a `pass:` that follows a plain word mid-sentence stays prose.
|
@clawsweeper re-review |
…l-text limit The Bun test lane drops full-text masks for this pattern above roughly 100k characters (tracked separately); 60k exercises the same linear-cost property and masks identically under Node and Bun.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Replace the record-start regex for bare `pass:` with a programmatic RedactMatcher. One matchAll finds every `pass:<value>` occurrence and a single forward pass over the text classifies each one: prose only when a plain word plus one space precedes it and no `=` or glued `key:value` field has been seen on that line; everything else masks, including the YAML value-on-next-line shape the generic rule covered. Namespaced and prefixed keys stay with their own patterns. The cost is linear in the text, so long unbroken tokens and dense occurrences no longer need length bounds that left gaps.
The obfuscated-key trigger in DEFAULT_REDACT_PREFILTER_SOURCES used a repeated group inside a lookbehind. JavaScriptCore allocates a backtracking frame per iteration and abandons the whole match, returning no match and no error, once the key run before `=` passes roughly 70k characters. redactSensitiveText then took its nothing-could-match fast path and skipped every default pattern for that text on Bun; Node was unaffected. Express the same language with two flat lookbehinds (the run right before `=` holds a splice and a key character), checked exhaustively equivalent on all strings up to length 6 over the relevant alphabet and faster on both runtimes.
…e's position Rework BARE_PASS_ASSIGNMENT_MATCHER after review: one case-insensitive matchAll finds every credential key with a colon (bare `pass` plus the generic colon key list; `pass` inside another word is never a key), and one forward pass classifies each. Namespaced, prefixed and other credential keys only mark their line as a record without consuming their value; a bare `pass:` is prose only after a plain word or number with no assignment earlier on the line, otherwise its unquoted value is read in place and masked, skipping past it so line breaks inside the match and keys inside the value cannot disturb the scan. The matcher now runs where the generic rule handled bare `pass:`, before the namespaced and prefixed rules, and is registered as an ambiguous assignment shape so tool-payload exclusion and source-assignment preservation match the old rule. The string pattern list is derived from the ordered default list.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Knip's production scan flags the export as unused: the matcher is registered inside the pattern table and consumed through the default lists, so nothing imports it by name.
… policy getDefaultRedactPatterns() returned only the configurable string sources, and the embedded-agent error observation owner composes its explicit policy from it, so providerErrorMessagePreview lost bare `pass:` masking once that rule became a programmatic matcher. Return the full default policy, matchers included; the string-only list had no other production consumer and is removed, and the logger plugin test helper that builds logging.redactPatterns config keeps only the strings. The matcher's ambiguous-assignment treatment moves to its own matcher set so the string set stays pattern text. A regression asserts a provider message starting with `pass: <secret>` reaches the preview masked.
|
Merged via squash.
|
OpenClaw #160879 rewrote src/logging/redact.test.ts. The pinned TruffleHog 3.97.4 scan now labels its synthetic connection-string fixtures PLAIN, ESCAPED_UNICODE, or HTML nondeterministically, and the redacted Postgres assertion changed indentation. The exact attribution rows only permitted PLAIN/ESCAPED_UNICODE for that path, so every OpenClaw PR touching the file was refused before review (hosted run 36514869480 on openclaw/openclaw#160888). Add seven exact rows for the post-rewrite identities and permit HTML for this one source. Rows still bind detector, decoder, Raw/RawV2 and complete-line digests, path, mode, and committed roles. Pre-rewrite rows stay for merge bases that predate #160879. Proof: source-admission replay of the #160888 range with pinned native 3.97.4: original policy refused 5/5 runs; candidate admitted 12/12 (104 classified findings). Focused production-policy regression added. OpenClaw Bay is unaffected; no status, queue, publication, telemetry, or observer contract changes.
…claw#160888) * fix(logging): stop redacting prose after "pass:" as a secret The unquoted config-assignment pattern treated bare `pass` as a secret key in both the colon and the equals form, so a sentence such as "tests now pass: older clients ..." lost its next word to `***` in persisted transcripts and logs. The colon alternative now uses a key list without bare `pass`; `pass=`, `pass = `, namespaced, prefixed, quoted, query, and form-body forms keep masking. * fix(logging): keep config-shaped pass: assignments masked Review found that dropping bare `pass` from the colon form also exposed unquoted `pass: value` lines in config-shaped text. A record-start pattern now keeps those masked (text or line start with indentation, or right after `{` or `,`); only a `pass:` that follows another word mid-sentence is treated as prose. * fix(logging): mask pass: in YAML sequence items and guard default patterns Review found `- pass: value` list items uncovered by the record-start rule; the rule now accepts a YAML `- ` marker after indentation and a `;` separator. The first attempt used an optional nested group that the safe-regex guard rejects, which silently dropped the whole pattern, so a new test asserts every default string pattern compiles under that guard. * test(logging): keep the pass boundary regression beside the pattern table Leave src/logging/redact.test.ts byte-identical to main and host the prose/config `pass:` boundary cases in redact-patterns.test.ts next to the patterns they pin. * fix(logging): treat CR line breaks as record starts and match pass: with full context Review found two boundary gaps in the record-start rule: a carriage-return-only line break before `pass:` was not a record start, and the `^` alternative could read a 16 KiB chunk start as a record start in long text, masking prose. Accept `\r` as well as `\n`, and register the pattern as chunk-unsafe so it always sees the full text. Regressions cover both, and the chunk case fails without the registration. * fix(logging): treat inline key=value context before pass: as a record Review found `user=bot pass: value` unmasked: the record-start rule only knew line starts and a few separators. A preceding inline `key=value` / `key:value` field, and `(`, `[`, `|`, `&` or a quote, now count as record context, while a `pass:` that follows a plain word mid-sentence stays prose. * fix(logging): accept spaced key = value context before pass: and prove the transcript path Review found `user = bot pass: value` unmasked because the inline-record context required the preceding field's value to touch its `=`. Spaces around `=` now count; a spaced `key: value` phrase stays prose. A transcript-level test shows a config-shaped `pass:` credential masked in assistant text before persistence. * fix(logging): bound the inline-field prefix in the full-text pass: rule Review noted the inline `key=value` branch scanned an unbounded identifier at every start position while running over the full text. Bound the key (64) and value (256) so each attempt costs a constant amount, and cover a 200k-character single token before `pass:` in both prose and record shape. * test(logging): keep the long-token pass: regression below the Bun full-text limit The Bun test lane drops full-text masks for this pattern above roughly 100k characters (tracked separately); 60k exercises the same linear-cost property and masks identically under Node and Bun. * fix(logging): classify bare pass: records with a linear matcher Replace the record-start regex for bare `pass:` with a programmatic RedactMatcher. One matchAll finds every `pass:<value>` occurrence and a single forward pass over the text classifies each one: prose only when a plain word plus one space precedes it and no `=` or glued `key:value` field has been seen on that line; everything else masks, including the YAML value-on-next-line shape the generic rule covered. Namespaced and prefixed keys stay with their own patterns. The cost is linear in the text, so long unbroken tokens and dense occurrences no longer need length bounds that left gaps. * fix(logging): keep the default prefilter linear on long key runs The obfuscated-key trigger in DEFAULT_REDACT_PREFILTER_SOURCES used a repeated group inside a lookbehind. JavaScriptCore allocates a backtracking frame per iteration and abandons the whole match, returning no match and no error, once the key run before `=` passes roughly 70k characters. redactSensitiveText then took its nothing-could-match fast path and skipped every default pattern for that text on Bun; Node was unaffected. Express the same language with two flat lookbehinds (the run right before `=` holds a splice and a key character), checked exhaustively equivalent on all strings up to length 6 over the relevant alphabet and faster on both runtimes. * fix(logging): classify bare pass: keys in one pass at the generic rule's position Rework BARE_PASS_ASSIGNMENT_MATCHER after review: one case-insensitive matchAll finds every credential key with a colon (bare `pass` plus the generic colon key list; `pass` inside another word is never a key), and one forward pass classifies each. Namespaced, prefixed and other credential keys only mark their line as a record without consuming their value; a bare `pass:` is prose only after a plain word or number with no assignment earlier on the line, otherwise its unquoted value is read in place and masked, skipping past it so line breaks inside the match and keys inside the value cannot disturb the scan. The matcher now runs where the generic rule handled bare `pass:`, before the namespaced and prefixed rules, and is registered as an ambiguous assignment shape so tool-payload exclusion and source-assignment preservation match the old rule. The string pattern list is derived from the ordered default list. * chore(logging): keep the bare pass matcher module-private Knip's production scan flags the export as unused: the matcher is registered inside the pattern table and consumed through the default lists, so nothing imports it by name. * fix(logging): give provider error previews the full default redaction policy getDefaultRedactPatterns() returned only the configurable string sources, and the embedded-agent error observation owner composes its explicit policy from it, so providerErrorMessagePreview lost bare `pass:` masking once that rule became a programmatic matcher. Return the full default policy, matchers included; the string-only list had no other production consumer and is removed, and the logger plugin test helper that builds logging.redactPatterns config keeps only the strings. The matcher's ambiguous-assignment treatment moves to its own matcher set so the string set stays pattern text. A regression asserts a provider message starting with `pass: <secret>` reaches the preview masked.
…#1716) OpenClaw #160879 rewrote src/logging/redact.test.ts. The pinned TruffleHog 3.97.4 scan now labels its synthetic connection-string fixtures PLAIN, ESCAPED_UNICODE, or HTML nondeterministically, and the redacted Postgres assertion changed indentation. The exact attribution rows only permitted PLAIN/ESCAPED_UNICODE for that path, so every OpenClaw PR touching the file was refused before review (hosted run 36514869480 on openclaw/openclaw#160888). Add seven exact rows for the post-rewrite identities and permit HTML for this one source. Rows still bind detector, decoder, Raw/RawV2 and complete-line digests, path, mode, and committed roles. Pre-rewrite rows stay for merge bases that predate #160879. Proof: source-admission replay of the #160888 range with pinned native 3.97.4, bound to the committed policy digest: baseline (main at the PR base) refused 5/5 runs; candidate admitted 11/12 and classified 86 findings, with one refusal from the existing duplicate-record guard on a native chunk-overlap duplicate. Focused production-policy regression added. OpenClaw Bay is unaffected; no status, queue, publication, telemetry, or observer contract changes. Known limit (maintainer exception, follow-up #1724): decoded HTML/ESCAPED_UNICODE URI findings are attributed to the plain literal wherever it occurs, so an entity-encoded copy of an approved synthetic value borrows the plain witness; this is pre-existing exact-path behavior for every HTML row and admits only the same digest-bound synthetic value.
What Problem This Solves
Fixes: ordinary prose is masked as a secret when a sentence contains
pass:followed by a word, for example an agent's status line "The boundary tests now pass: older clients receive compatible speed values" was persisted as "…now pass: *** clients…" in the Team chat transcript. Because transcript redaction runs before the message is committed, the masked word is unrecoverable.Also fixes, found while proving the first fix on Bun: on the Bun runtime the default redaction fast-path skipped every default pattern for a text once a run of key characters longer than roughly 70k preceded an
=(a long base64 blob with=padding is enough), so long tool output and transcripts could keep credentials unmasked. Node was unaffected.User Impact
Chat transcripts, logs, and tool output keep prose intact when a sentence clause ends with
pass:, including in long texts. Real password assignments stay redacted:pass: valueat a text or line start (LF or CR), indented YAML, YAML list items (- pass: value), a value on the next line (pass:\n value), after{,,,;,(,[, tabs or quotes, after any inlinekey=valueorkey:valuefield regardless of spacing or length (user=bot pass: value,user = bot pass: value,key=<300 chars> pass: value), pluspass=value,pass = value,pass= value, quotedpass: "value", prefixeddb-pass: value, namespacedsmtp.pass: value, and?pass=/ form-body pairs are unchanged. On Bun, default redaction now runs for long texts the same way it does on Node.Why This Change Was Made
Bare
pass:classification. The unquoted config-assignment pattern treated barepassas a secret key in both its colon and equals forms. Barepassis an English word far more often than a config key, and the colon form is exactly how prose introduces a list. The generic colon alternative now uses a key list without barepass; the equals alternative and every other pattern keep the full list. Barepass:is handled by a small programmatic matcher (BARE_PASS_ASSIGNMENT_MATCHER, same interface as the existing AWS matcher) that runs at the generic rule's old position, before the namespaced and prefixed rules, and is registered as an ambiguous assignment shape like that rule (tool-payload exclusion and source-assignment preservation unchanged). OnematchAllfinds everypass:key that is not inside another word, then a single forward pass over the text classifies each one and reads the unquoted value that follows a record key. An occurrence is prose only when a plain word or number plus one space precedes it and no assignment (=,:glued to a value, or an earlierpass:field, bare or namespaced) has been seen since the last line break; a recognized field skips past its value so a line break before a continued value does not reset that state. A spacedkey: valuephrase earlier on the line is deliberately not an assignment: that is how prose introduces lists ("Release notes: all suites pass: nothing else changed"), so an inlineuser: bot pass: valuerecord on one line is the accepted cost of this fix (user=bot pass: valueanduser:bot pass: valuestay records; maintainer decision from review rounds 4 and 5, restated when Codex autoreview raised the same shape on the final revision); every other position is a record start and masks exactly as before. Keys preceded by.,-or_are left to the namespaced and prefixed patterns (their value is not consumed) but still mark their line as a record, and so does any other credential key with a colon, in any letter case (password: x pass: y,Authorization: Bearer x pass: y);passinside another word (bypass:,compass:) is not a key and cannot swallow a realpass:field that follows it. Whitespace around the colon may include line breaks, as in the old rule, so a YAML explicit key (? pass\n: value) stays covered. Earlier revisions tried to express this as a regex with a bounded look-back; every bound left a gap (aligned spacing, long inline fields) that review found, and an unbounded regex was not linear. The forward pass has no bounds and is linear in the text, and the matcher is excluded from tool-payload redaction like the other ambiguous assignment rules.Provider error previews. The embedded-agent error observation owner composed its explicit redaction policy from
getDefaultRedactPatterns(), which returns only the configurable string sources, so it would have lost barepass:masking inproviderErrorMessagePreviewonce that rule became a matcher (found by ClawSweeper on the previous head).getDefaultRedactPatterns()now returns the full default policy, programmatic matchers included, so that caller keeps working unchanged; the string-only list it used to return had no other production consumer and is removed (the one test helper that buildslogging.redactPatternsconfig keeps only the strings). The matcher's ambiguous-assignment treatment (tool-payload exclusion, source-assignment preservation) comes from a small matcher set beside the string set, which stays pattern text because tests feed it to config. A regression asserts a provider message starting withpass: <secret>reaches the preview masked.Default prefilter on Bun.
redactSensitiveTextfirst runs one prefilter regex over the whole text and returns early when nothing could match. Its obfuscated-key trigger used a repeated group inside a lookbehind (=(?<=(?:\+|[INV])(?:[INV+]*[KEY])+[INV+]*=)). JavaScriptCore allocates a backtracking frame per iteration of that group and abandons the whole match, returningfalsewith no error, once the key run before=exceeds roughly 70k characters. The trigger is rewritten as two flat lookbehinds that accept the same language (the run right before=holds a splice and a key character):=(?<=[INV+][INV+KEY]*=)(?<=[KEY][INV+KEY]*=). Equivalence was checked exhaustively on all strings up to length 6 over{a, +, ZWSP, =, space, %}(55,986 strings, 0 differences), and the new form is faster on both runtimes (200k-character text: Node 4.2 ms → 2.9 ms, Bun 243 ms false → 13.6 ms true).Evidence
redactSensitiveText(pattern owner; the cases live inredact-patterns.test.tsbeside the pattern table,redact.test.tsis untouched) andredactTranscriptMessage(the transcript entry point that produced the incident): the prose stays unchanged, and an assistant message carryingsmtp:\n user = bot pass: <secret>is persisted with the secret replaced byopaque…7890(transcript-redact.test.ts).pass:line, indented YAML,- pass:list item, value on the next line,;-separated, CR-separated,{ user: bot, pass: … },user=bot pass: …,user = bot pass: …,user= bot pass: …,user = bot pass: …,key=<300 chars> pass: …,user\tpass: …, two records on one line (including values that end in letters, a namespaced, underscore-prefixed,password:orAuthorization: Bearerfirst field, a first value continued on the next line, and a first value that itself containspass:), a YAML explicit key? pass\n: …,bypass:\n pass: …,host:db.example.test pass: …,login (pass: …), and a 200k-character token followed by=v pass: …. Prose shapes asserted unchanged: the incident sentence, "Release notes: all suites pass: nothing else changed. Both pass: done.", "Suite result: 12 pass: 0 fail, 1 skipped.", "Use the bypass: it keeps the compass: north.", a clause wrapped across a line break, a 200k-character token followed bypass: still prose, and a 40 KiB text whosepass:lands exactly on a 16 KiB chunk start.redactSensitiveTextwas used as the Bun proof because the PR CI test lanes run under Node.node scripts/run-vitest.mjsover the 13 redaction and transcript suites (src/logging/*redact*.test.ts,src/agents/transcript-redact*.test.ts,src/agents/provider-request-header-redaction.test.ts): 288 tests passed.bun --bun node_modules/vitest/vitest.mjs run src/logging/redact-patterns.test.ts: 5 passed. A test asserts every default string pattern compiles under the safe-regex guard, because a rejected default pattern is dropped silently (an earlier YAML attempt hit exactly that).pass:field after a masked value ending in a letter, a bare field after a namespaced or underscore-prefixed one, a second field after a continued value, the YAML explicit-key form, a word-internalbypass:swallowing the next field, apassword:field before a bare one, and a key occurrence inside a consumed value stalling the scan; all are fixed and asserted. ClawSweeper's review of the matcher head (round 10) found the provider-error preview policy gap described above, fixed and asserted inembedded-agent-error-observation.test.ts. ClawSweeper rounds 1–8 on earlier regex revisions found the record-start, YAML list, CR, chunk-start, spaced inline field, aligned/long inline field, and Bun large-input gaps; all are covered by the matcher and the prefilter fix above.--maxWorkers=1wall):src/logging/redact-patterns.test.ts3.4 s (5 tests, including the 200k-character inputs),src/agents/transcript-redact.test.ts6.9 s (87 tests, whole file). No timers, sleeps, or process boots added.a+a+a+…password=valuetakes ~15 s under Node because the form-body key grammar backtracks quadratically inside each 16 KiB chunk; the result is correct, the time is not. Tracked separately.