Skip to main content

Module redact

Module redact 

Source
Expand description

Secret redaction for outgoing tool output.

winx pipes shell output, file contents, and saved memory straight into the model’s context - env, cat .env, CI logs, etc. This scrubs high-confidence credential patterns from any text leaving the server (and from persisted ContextSave memory) before it reaches the model or disk.

Only named, low-false-positive patterns are matched (provider key prefixes, JWTs, PEM private-key blocks, user:pass@ URLs). There is no entropy heuristic, so ordinary code is never mangled. Set WINX_NO_REDACT=1 to disable entirely (e.g. when you knowingly need the raw value).

A redacted span becomes [REDACTED:<rule>] - the rule name only, never any part of the secret.

Functions§

redact
Scrub credential patterns from text. Returns Cow::Borrowed (no allocation) when nothing matched, so the common case is cheap. The regex crate is linear-time, so this is safe on adversarial/large input.
redact_json
Recursively redact every string inside a JSON value (for structuredContent).