CerbIA

PII scanners

Detect common personally identifiable information with built-in or custom regular expressions.

Reference
Scanner

cerbia.core.scanners.PiiScanner uses built-in regular expressions to locate common personally identifiable information. It reports match spans and uses the highest matching pattern score as its risk score.

Parameter Default Meaning

extra_patterns

null

Additional (name, regex) pairs. Extra patterns use risk 0.80.

severity

HIGH

Finding severity.

action

WARN

Findings are visible but do not contribute to blocking aggregation unless changed.

content_types

[TEXT]

Accepted content types.

validate_checksums

false

When true, candidate matches failing checksum validation are discarded (e.g. Modulo 23 for Spanish DNI/NIE, Luhn for credit cards, and Modulo 97 for IBAN). This reduces noise but can also miss sensitive identifiers with typos.

custom_validators

null

Optional dictionary mapping pattern names to custom validator callables (str) → bool.

scanners:
  - scanner: cerbia.core.scanners.PiiScanner
    init_args:
      action: block
      validate_checksums: true
      extra_patterns:
        - ["Employee ID", "EMP-[0-9]{6}"]

For NLP-backed English entity recognition, use the optional PresidioPiiScanner. See the Presidio package reference.

Use action: block when detected PII must affect the aggregate verdict. Keep the default warn when the pipeline should report PII while allowing the caller to make a separate handling decision from the findings and match spans.