Skip to main content

Supported Detectors

Spring Prism provides a robust suite of built-in PII detectors grouped into PrismRulePack configurations for easy adoption.

Universal Detectors

For Spring Boot starter users on 1.1.x, the default universal baseline comes from the modular prism-rulepack-common artifact via CommonRulePack.

The legacy in-core UniversalRulePack remains functional for direct prism-core consumers and for starter compatibility fallbacks, but it is deprecated in 1.1.0 and scheduled for removal in 2.0.0.

Entity TypeDescriptionValidation
EMAILStandard email addresses (RFC 5321).Backtracking-safe regex.
CREDIT_CARDMajor credit cards (Visa, MC, Amex, etc.).Luhn algorithm Checksum.
SSNUS Social Security Numbers.Invalid area code (000, 666, 9xx) exclusions.
PHONE_NUMBERCommon international and North American phone numbers.Normalized digit-count and false-positive filtering.
IP_ADDRESSIPv4 and IPv6 addresses.Octet range (0-255) and format validation.

European Detectors

The EuropeRulePack extends the universal baseline with GDPR-critical European PII.

Entity TypeDescriptionValidation
IBANInternational Bank Account Numbers.ISO 13616 Modulo-97 checksum.
EU_VATEU Member State VAT numbers.Format validation per EC VIES.
PESELPolish Personal ID Number.GUS weighted checksum.
CNPRomanian Personal Numerical Code.ANP weighted Mod-11 checksum.
NINOUK National Insurance Numbers.HMRC prefix/suffix logic exclusions.
Compatibility

EuropeRulePack remains available in 1.x for direct prism-core consumers, but it is now deprecated and scheduled for removal in 2.0.0. Prefer the modular regional rulepacks for new starter-based integrations.

Regional Rulepacks in v1.1.0

ModuleLocaleAdded detectorsValidation style
prism-rulepack-roROCIFWeighted checksum
prism-rulepack-usUSEIN, ABA_ROUTINGStructural rules and checksum/range validation
prism-rulepack-plPLNIP plus existing PESELWeighted checksum
prism-rulepack-nlNLBSN11-proef checksum
prism-rulepack-gbGBNHS plus existing NINOMod-11 checksum and format validation
prism-rulepack-frFRNIR, SIREN, SIRETMod-97 and Luhn checksum
prism-rulepack-deDESTEUER_IDISO 7064 Mod 11,10 checksum
Community Feedback

If you find a country-specific edge case, separator format, reserved-number rule, or false positive in one of the regional rulepacks, please open a GitHub Issue and include:

  • the affected module, such as prism-rulepack-fr
  • one valid example and one invalid example
  • the expected detection outcome
  • any official checksum, registry, or standards reference you can share

This is the fastest way to harden Spring Prism geographically without breaking 1.x compatibility.

Custom Detectors

You can implement your own detectors by extending the PiiDetector interface.

public class MyDetector implements PiiDetector {
@Override
public @NonNull String getEntityType() {
return "MY_ENTITY_TYPE";
}

@Override
public @NonNull List<PiiCandidate> detect(@NonNull String input) {
// Return a list of detected candidates with their positions...
}
}

Then add them to a custom PrismRulePack:

public class MyRulePack implements PrismRulePack {
@Override
public @NonNull String getName() {
return "MY_CUSTOM_PACK";
}

@Override
public @NonNull List<PiiDetector> getDetectors() {
return List.of(new MyDetector());
}
}

Optional Integration Detectors

prism-core stays regex and checksum focused by design. If you need probabilistic or model-backed detection such as person names, add it in prism-spring-ai or prism-spring-boot-starter behind optional classpath checks.

This split keeps the core:

  • dependency-free
  • deterministic and fast to test
  • usable outside Spring

It also keeps fail-open metrics and strict-mode policy in the integration layer where Micrometer and application configuration already exist.