mind-self-run: redact URL userinfo from Self result text #50
Loading…
Reference in a new issue
No description provided.
Delete branch "eureka-body/self-run-redact-url-userinfo"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up eureka-body:follow_up:chat-s5922-5922. A Soul transcript printed a forge token embedded in a git remote URL; nothing redacted URL credentials in what the actuators carry out.
State changes
redact_url_userinfo(crates/mind-body/src/self_run.rs). Call sites, one per place a CLI-produced string enters the journal or her mind:result_text(Self result: journal line and admitted Reply, redacted before the 3800-byte chunking) andpersona::structured_output(Persona and Sleep results, redacted string by string so JSON structure is never inside a candidate).Final rule
scheme://, and every protocol-relative//at a word start (after start, ASCII whitespace, a quote, bracket,=or,;a//b@cis not one), opens an authority, read as git, curl and RFC 3986 read it. It ends at the first/ ? #, backslash, quote, backtick, parenthesis, bracket, angle bracket or ASCII whitespace.@(a raw@in a password still redacts); non-ASCII characters, NBSP and U+2028 included, stay inside it. Output:scheme://<redacted>@host.ssh://git@hostis a username). Percent-encoded forms are redacted like any other.@after the authority is path and is left byte-identical:github.com/@user,medium.com/@name,registry.npmjs.org/@scope/pkg,h/pkg@1.2.3,a//b@c,?mail=a@b.c. Compact JSON of two URLs redacts only the credentialed one.word:secret@host.tld/at the start of an ASCII-whitespace-delimited word without//.NOT covered (rotation of any exposed token stays required)
/,?,#, a quote or ASCII whitespace: no URL parser reads it as userinfo, so the text after the delimiter is path/query and is not redacted.user:secret@host:pathand any scheme-less form beyond the narrow shape; tokens in query strings or headers; bare tokens outside URLs.Stdio::inherit, self_run.rs ~1344) is NOT redacted.move_out_transcripts~1225) and Claude Code's own transcripts are NOT redacted and still hold tool output verbatim.Verification
self_run/tests/reply.rs(canary strings only): form table; canary absent from journal and admitted Reply; split by the reply limit (asserts both pieces exist); raw@, percent-encoded, NBSP, U+2028 and non-ASCII inside userinfo redacted; the pinned limits above; commonplace URLs byte-identical; compact JSON; protocol-relative; each guard of the scheme-less shape; multibyte inputs plus every substring of a multibyte seed never panic; Persona/Sleep structured output.structured_output; host-dot rule removed; host-character rule removed; username-character rule removed; non-empty-secret guard removed;/dropped from authority ends; first@instead of last; Unicode whitespace as break; word-start guard of//removed; ssh/git added to the bare-token schemes; scheme-less pass removed.unshare -r cargo test -p mind-body --no-fail-fast: lib 902 passed, 0 failed, 1 ignored. 5 environmental failures: control.rs x3 (non-root cannot be simulated underunshare -r), persona_bin x2 (the mind could not be asked: unavailable, no mind daemon). Clippy: no new lints vs base.🤖 Generated with Claude Code