pub struct DlpCfg {Show 20 fields
pub mode: String,
pub redact_style: String,
pub scan_request: bool,
pub scan_response: bool,
pub stream_redact: bool,
pub reversible: bool,
pub detect_email: bool,
pub detect_credit_card: bool,
pub luhn_validate_credit_card: bool,
pub detect_secrets: bool,
pub detect_ssn: bool,
pub detect_phone: bool,
pub detect_iban: bool,
pub detect_high_entropy: bool,
pub detect_prompt_injection: bool,
pub entropy_min_len: usize,
pub entropy_threshold: f64,
pub gazetteer_terms: Vec<String>,
pub custom_patterns: Vec<String>,
pub ner: NerCfg,
}Expand description
Edge-DLP settings ([llm.dlp]). When mode is not off, request and/or response bodies are
scanned for PII and secrets; the mode decides what happens on a finding (report / block /
redact). See crate::dlp.
Fields§
§mode: Stringoff | report | block | redact. Default off.
redact_style: StringHow a span is rewritten in redact mode: full ([REDACTED:<cat>], default) | mask
(keep last 4) | hash (stable opaque token). See crate::dlp::RedactStyle.
scan_request: boolScan the inbound request body (the prompt). Default true.
scan_response: boolScan the (buffered) response body and, in report mode, streamed frames. Default true.
stream_redact: boolIn redact mode, also rewrite streamed SSE frames (not just buffered bodies). Deterministic
detectors only — NER never runs on the stream. Off by default: streaming redaction can only
rewrite spans the carry buffer fully contains, so enable it deliberately. See crate::dlp.
reversible: boolReversible masking (redact mode only). When on, an inbound finding is replaced with a
stable placeholder token (<edgeguard-<cat>-<n>>) instead of an irreversible [REDACTED]
tag, and the placeholder→original map is kept for the request so the response is unmasked
(buffered and streamed) back to the original value. The provider never sees the PII; the
client gets its own data back — the round-trip an unmask keyed on shared state gets wrong.
Off by default.
When on, the response is unmasked rather than re-scanned/redacted (restore, not detect).
detect_email: boolBuilt-in detectors.
detect_credit_card: boolDetect card numbers. Pair with luhn_validate_credit_card to require a valid
checksum, which removes most false positives from ordinary long digit strings.
luhn_validate_credit_card: boolRequire the Luhn checksum before flagging a digit run as a card (cuts false positives). Default true.
detect_secrets: boolAWS keys, provider-style xx-… keys, and private-key blocks.
detect_ssn: boolUS SSN (NNN-NN-NNNN). Default true.
detect_phone: boolPhone numbers. Off by default — false-positives on ordinary numeric runs.
detect_iban: boolIBAN account numbers. Off by default — false-positives on uppercase+digit tokens.
detect_high_entropy: boolHigh-entropy token sweep (catch-all). Off by default — can false-positive.
detect_prompt_injection: boolPrompt-injection / jailbreak heuristics for agent traffic (a small, high-precision built-in
deny set — “ignore previous instructions”, “reveal your system prompt”, etc.), reported under
the prompt_injection category. Off by default (opt-in, report-first) since instructions to a
model are legitimate traffic; enable and watch the counter before moving to block.
entropy_min_len: usizeMinimum token length the entropy sweep considers.
entropy_threshold: f64Per-character Shannon-entropy threshold (bits) for the entropy sweep.
gazetteer_terms: Vec<String>Dictionary deny-list: literal terms matched case-insensitively (Aho-Corasick), reported under
the gazetteer category. The fast, many-term path for known names / codenames / identifiers.
custom_patterns: Vec<String>Extra regexes (linear-time regex syntax), all reported under the custom category.
ner: NerCfgOptional ML NER family ([llm.dlp.ner]). Requires the ner cargo feature; catches
person/address/org spans regex can’t. See NerCfg.