Skip to main content

redact_with_patterns

Function redact_with_patterns 

Source
pub fn redact_with_patterns(
    input: &str,
    patterns: &[(String, Regex)],
) -> (String, usize)
Expand description

Apply caller-supplied policy redaction patterns on top of the built-in secret rules: each regex match becomes [REDACTED:<label>]. Returns the transformed text and the number of redactions applied (for audit counts).

Used by context policy packs (GL #673) so a pack’s [redaction] block actually removes matching content from what the model sees. The patterns are the pack’s [redaction] entries, precompiled by crate::core::policy::runtime.