MCPcopy Create free account
hub / github.com/codehamr/codehamr / redactSlash

Function redactSlash

internal/tui/debuglog.go:67–76  ·  view source on GitHub ↗

redactSlash strips the /hamrpass bearer token before it lands in any log. A central hook covers any future secret-bearing command from one place. The split mirrors runSlash's strings.Fields: both must agree on command vs. args, else a multi-line `/hamrpass\n ` (Alt+Enter inserts a literal

(line string)

Source from the content-addressed store, hash-verified

65// case-sensitive) but its token would still reach scrollback, recall ring,
66// history, and log.txt, so redaction errs wider than dispatch, the safe way.
67func redactSlash(line string) string {
68 fields := strings.Fields(line)
69 if len(fields) == 0 || !strings.EqualFold(fields[0], "/hamrpass") {
70 return line
71 }
72 if len(fields) == 1 {
73 return line // no key portion to redact
74 }
75 return "/hamrpass <redacted>"
76}
77
78// dbgEnabled reports whether logging is on. Callers use it to skip building
79// expensive log payloads (e.g. accumulating a round's reasoning) when the log

Callers 2

submitMethod · 0.85

Calls

no outgoing calls

Tested by 1