Expand description
PII redaction (DW-081): scrubs PII/secrets from prompt and response text before it reaches the log store.
A Redactor is compiled from a crate::config::ai::RedactionConfig
and applies a set of regex patterns in a single pass over the text.
Built-in patterns (always active when redaction is on) cover the
common PII/secrets surfaces: email addresses, phone numbers, API
keys, and credit card numbers. Custom patterns from the config are
added to the built-in set.
§Dependency direction
ai depends on config only (see scripts/check_deps.py); this
module reads config::ai::RedactionConfig and nothing else. The
regex crate is a workspace dependency (no new addition).
Structs§
- Redactor
- A compiled PII redactor (DW-081). Built from a
RedactionConfig; applies all patterns (built-in + custom) in a single pass over the text, replacing matches with the configured replacement string.
Functions§
- builtin_
pii_ patterns - The built-in PII/secrets pattern strings (public for reuse by the
DW-082 guardrails engine’s PII detection). Returns the same set
the
Redactoralways active when redaction is on.