Repository navigation
Conversation
An INVALID_ARGS message embeds the raw argv the parse refused, and a rejected positional can be a credential the caller typed into the wrong slot, so the error line echoed it verbatim into transcripts. The scrub lives at the display line, per the callstack#4778 principle that values stay raw until a display line is built. - kernel/redaction: redactSecretLikeText replaces each whitespace token whose word is past 12 characters and mixes upper and lower case with a digit or a symbol by <redacted len=N>. Edge punctuation never counts, so an instruction identifier like deviceTarget. keeps its text. - command-output: formatHumanError scrubs the INVALID_ARGS message. The Next step stays as the producer wrote it, because a hint can carry a machine-parsable example the reader is meant to run. - cli json view: the --json error message scrubs the same way. The hint and the typed details keep their existing owners (hint examples, the structured redaction normalizeError already applied). Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Thanks for tackling this leak. At c1ec2c4 the approach needs a rethink before the details are worth fixing, so this review asks one question first. Would it be simpler to stop echoing the rejected values where they start? For example, Two problems with the display-layer scrub as written make that worth deciding now:
If the scrub stays instead, it needs to apply only to values that were argv of the failed parse, through one view used by all surfaces, with the existing kernel patterns reused. That is a larger change than the producer-side fix. Also on this head: Repo Guards fails because Not verified here: the head was not checked out or run. The redactor behavior was checked by running its |
The Fallow audit flags isSecretLikeToken as an exported symbol with no known consumers: redactSecretLikeText is its only caller. The helper keeps its role and its JSDoc; it no longer widens the kernel surface. Co-Authored-By: Claude Code <noreply@anthropic.com>
The scrub treated any long mixed-case token as a credential, so the project config path in a device-pin conflict came out as <redacted len=101>: the reader lost the file the message names for them to fix. A token that carries a path separator is a location, not a credential, and keeps its text. The conservative-path table row moves to the same rule, and the conflict message shape gets its own row. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Thanks for the quick follow-up. The ordinary-value regression from the earlier review (#4851 (comment)) is fixed at c916708, and Coverage now passes. Two high-priority problems remain, so the PR is not ready to merge. The path exemption at packages/kernel/src/redaction.ts:190 skips any token that contains The scrub still covers only the two display writers, Could the heuristic and both call sites be deleted instead? Not blocking, and fine to take or leave: the heuristic at redaction.ts:181 now has three special cases that each followed a failing test, and removing the echo at the producers makes it unnecessary; the Body rules job also fails because the PR body has no The Body rules failure is a PR-body format gate. Runner Build (tvOS + visionOS + watchOS) builds the Swift runner, and this diff touches only TypeScript, so that failure looks unrelated. Not verified here: a live CLI or MCP run of this head, the Runner Build logs, and the Body rules job log. The base64 bypass came from running the head's function on sample strings, and the MCP and diagnostics routes were read in code. Before merge, decide between removing the echo at the producers and scoping a scrub to the failed parse's argv on every route. Then fix the PR body sections. |
…d-argv echo route The path exemption skipped any token that carries a path separator, so a credential with a slash (standard base64, a URL query) was echoed verbatim by the INVALID_ARGS display lines. The exemption now holds only when every character is a path character; a separator next to any other character falls through to the word test, and the existing path rows keep their text. Two routes still published the unscrubbed message: the MCP error result set structuredContent unredacted beside its already-scrubbed text line, and the cli_parse_failed diagnostic carried the raw message into the --debug transcript. Both apply the same kernel display scrub now; every other code keeps its typed message. exitOnParseFailure moves to cli/failure-output beside the other failure writers, which also keeps cli.ts under the 1000-line guard. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Round-2 items, pushed at 135bcaf (kept in draft for your re-review):
On the open question (remove the echo at the producers vs. scoped scrub): this round implements the scoped-scrub option with the shape heuristic unchanged in strictness (only the exemption narrowed). If you confirm that dropping the echoed values from Gates: 🤖 Generated with Claude Code |
|
Thanks for the update. The earlier review (#4851 (comment)) is partly addressed, but the review of 135bcaf found that credential-shaped values and some real config paths are still handled wrongly. The path exemption in redaction.ts#L193 passes any token with a slash or backslash whose characters are all in The same line also breaks real paths. A path token with any character outside that set, such as A second independent pass found that A second independent pass found that the 24-character token A second independent pass found that A second independent pass found that a project config with malformed JSON at a path containing A second independent pass found that the remote diagnostics tail republishes a scrubbed refusal. With a supported remote app session and a readable request record, Not blocking, and fine to take or leave: the guard Would deleting The required evidence is present. The Body rules job failed on the earlier PR body (no Not verified here: a live CLI or MCP run of this head; the redaction results come from running the head's Before merge, the slash-containing base64 leak and the config-path redaction need to be closed, and the maintainer needs to approve removing the argv echo at the producers, which closes both and deletes the heuristic. |
Summary
An
INVALID_ARGSmessage embeds the raw argv the parse refused, and a rejected positional can be a credential the caller typed into the wrong slot, so every route that publishes the message scrubs secret-like tokens (#4778). Round-2 fixes:kernel/redactionno longer covers a token whose separator sits next to a non-path character (+,=,?): those are the base64 and query shapes of a credential. Real config paths keep their text.structuredContent.messagelike its text line.cli_parse_faileddiagnostic scrubs the same way.exitOnParseFailuremoves tocli/failure-output, keepingcli.tsunder the 1000-line guard.Before / after
--debugdiagnosticdata.error: raw value at base,Invalid platform: <redacted len=20>at head. MCPstructuredContent.messagelikewise.Validation
Tested at 135bcaf.
tsc -b tsconfig.typecheck.jsonclean.check:affected: format, lint, typecheck green; the layering ratchet reads the fork mirror'sorigin/main(the known blocker recorded earlier — all 12 violations in files this diff does not touch), CI runs the same gate green. Green suites: redaction, command-tools, cli-exit-paths, cli-device-pin, json view, command-output, both budget ratchets. Each new assertion fails atc91670897with the fix reverted per site. Not device-facing: display formatting only.Related: #4778, #4014, #3261.
🤖 Generated with Claude Code