Skip to main content

Options

Detector Backend

The detector combines deterministic checks with a semantic backend. GLiNER is currently the only backend. See Semantic Backends and GLiNER.

Phone Regions

Detection is multilingual and language-agnostic. Names and places use one model. Structured identifiers use format or checksum checks. Phone numbers are + international-only by default. Add phone_regions only when you need local formats.
Keep the list focused. More regions can mean more false positives on IDs and ticket numbers.

Entities

Names and locations are multilingual. IBAN, credit card, email, IP, and + phone numbers work internationally. VAT_CODE requires a country prefix and is validated with python-stdnum.

Score Threshold

score_threshold raises the confidence floor for the tunable semantic labels PERSON and LOCATION only. Higher = fewer false positives, might miss some PII; lower = catches more, more false positives.
Checksum-validated identifiers are always reported (score 1.0) and are never dropped by the threshold. Street addresses are detected by the semantic backend and reported as LOCATION. GLiNER floors are configured with GLINER_FLOOR_PERSON, GLINER_FLOOR_LOCATION, and GLINER_FLOOR_ADDRESS. See GLiNER.

Allowlist

Exclude specific text patterns from PII masking. Useful for preventing false positives on company names or product identifiers.
A literal entry is matched as a substring: a detected value is left unmasked if it contains the entry, or the entry contains it. Set regex: true for JavaScript regex syntax — a regex entry must match the entire detected value, so \d{4} won’t unmask a longer number that merely contains four digits.

Denylist

Force specific text or regex patterns to be masked, even when the detector does not report them or PII detection is disabled. Each entry needs a type, which is used for the placeholder name.
Patterns are matched literally by default. Set regex: true for JavaScript regex syntax — use single quotes in YAML when the pattern contains backslashes. A regex pattern must not match the empty string (use \d+, not \d*); empty-matching patterns are rejected at startup because they would mask nothing.

Scan Roles

By default, PasteGuard scans user messages and tool results. It skips system, developer, and assistant text. Set scan_roles to replace that default:
If scan_roles is set, PasteGuard scans exactly those roles.