ContentRedactor that applies regex-based patterns to strip sensitive data from memory content before it reaches the storage adapter. Redaction runs as part of the pipeline, after auth and before risk assessment, so downstream components never see raw PII or secrets.
How It Works
TheContentRedactor maintains an ordered list of RedactionPattern objects. When redact() is called, each pattern is applied in order. Matched substrings are replaced with a bracketed placeholder (e.g., [SSN_REDACTED]), and a RedactionResult is returned alongside the safe content.
Default Patterns
The following patterns are enabled out of the box:Basic Usage
- Python
- TypeScript
Multiple Matches
The redactor handles content with multiple types of sensitive data in a single pass.- Python
- TypeScript
Custom Patterns
Add your ownRedactionPattern to handle domain-specific sensitive data.
- Python
- TypeScript
RedactionResult Fields
TheRedactionResult object returned from redact() contains metadata about what was redacted:
The redactor does not store or log the original sensitive values. Once redacted, the raw content is discarded. Audit events record that redaction occurred and which patterns matched, but never the matched content itself.