Documentation
¶
Overview ¶
Package redact scrubs secrets out of text before it's written to the database. Tool outputs routinely contain API keys (a Bash line that did `cat .env`), and a tool call's own input can contain one too (an agent writing a config file). Everything that lands in messages.content or messages.raw goes through Redact first — no exceptions, since we can't know in advance which sessions will have touched a secret.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Redact ¶
Redact replaces likely secrets in s with a fixed placeholder: named vendor-token patterns, .env-style KEY=VALUE assignments, and a generic high-entropy fallback. It over-redacts on purpose — a false positive blanks out a UUID or a git commit hash, a false negative leaks a key — so when in doubt, this redacts.
func Scan ¶ added in v0.2.0
Scan reports which redaction rules still match s, without changing it. It exists for auditing already-stored text: a hit means something Redact would scrub today got into the database anyway (rules added after that row was ingested, or a bug). It returns the rule names, never the matched text, so an audit report can't itself leak what it found. The result is empty for text Redact would leave alone, including text Redact already scrubbed.
Types ¶
This section is empty.