data_loss_prevention) finds sensitive data —
PII and secrets — in prompts and model output, and can mask it in flight. It is the
only mutable detector: the only one that supports redact mode and the only one that
populates transformed_payload.
| Property | Value |
|---|---|
| Slug | data_loss_prevention |
| Category | data_loss_prevention |
| Sides | input, output |
| Protocols | all |
| Modes | observe, block, redact |
| Mutable | ✅ |
detection_type: "secret"; other entities as "pii".
Modes
observe— report what was found, change nothing.block— report and setis_flagged(caller blocks).redact— report and return atransformed_payloadwith matches masked. Forward the masked payload instead of the original.
Settings
| Field | Type | Notes |
|---|---|---|
apply_all | boolean | Mask every catalog entity. |
predefined_entities | array<{ entity, enabled, mask_with, preserve_len }> | Select specific PII entities and how to mask them. |
rules | array<{ pattern, type, mask_with, preserve_len }> | Custom rules; type is keyword or regex. |
mask_with— the replacement token (e.g.[MASKED_EMAIL]).preserve_len— keep the original length when masking.
redact response:
Entity catalog
60+ built-in entities, grouped by false-positive risk. Pick the tier appropriate to your tolerance — Tier 1 is safe to enable broadly; Tier 3 benefits fromobserve first.
Tier 1 — near-zero false positives: password, api_key, access_token, email,
uuid, jwt_token, crypto_wallet, stripe_key, ip_address, ip6_address,
mac_address, device_mac, italian_cf, mexican_curp, french_nir, cvv.
Tier 2 — structural markers: spanish_iban, iban, us_medicare, ssn,
brazilian_cnpj, brazilian_cpf, credit_card, spanish_dni, spanish_nie,
spanish_cif, spanish_nss, spanish_phone, german_id, mexican_rfc,
chilean_rut, date, swift_bic, address.
Tier 3 — higher false positives (validate first): device_imei, bank_account,
colombian_cc, tax_id, routing_number, peruvian_dni, argentine_dni, zip_code,
phone_number, vehicle_vin, passport, drivers_license, isin.
When to use
- Output
redactto strip PII the model regurgitates before it reaches the user. - Input
redactto keep PII out of third-party model providers entirely. blocksecrets (api_key,password,access_token,jwt_token) to stop credential leakage.