Skip to main content
Data protection stops sensitive data from being sent to an LLM provider or emitted by the model. It is the most-used set of detections in TrustGate because it pairs with the action you really care about: Mask. Like every other detection in TrustGate, you wire it up inline on a policy’s When condition — there’s no separate plugin screen.

Apply to prompts or responses

Data protection runs on either direction of the traffic. You control this with the condition’s Field:
FieldWhat it protectsTypical use
InputWhat the user sends to the model.Prevent PII or secrets from being shipped to a third-party provider.
OutputWhat the model generates.Prevent the LLM from echoing PII it learned, retrieved, or inferred.
Most production deployments run a policy on each direction so the rules tune independently.

Where it lives in the picker

In Create Policy → When, the detection picker exposes two sibling categories for data protection:
CategoryCoversTypical action
PII & ConfidentialPersonal and confidential entities — financial data, IDs, contact info, technical identifiers, international IDs.Mask (most common), Block for the highest-severity entities.
Secrets & KeysCredentials and machine identities — API keys, tokens, passwords, JWTs.Block — secrets should never reach an LLM.

Entity catalog

The catalog is grouped the same way it is in the engine. Every entity ships with a default mask placeholder that replaces the matched fragment on the wire.

Financial

EntityDetectsDefault mask
Credit CardCard numbers (all major brands).[MASKED_CC]
CVVCard verification values.[MASKED_CVV]
Bank AccountBank account numbers.[MASKED_ACCOUNT]
IBANInternational Bank Account Numbers.[MASKED_IBAN]
SWIFT / BICSWIFT/BIC codes.[MASKED_BIC]
Routing NumberBank routing numbers.[MASKED_ROUTING]
Stripe KeyStripe API keys.[MASKED_API_KEY]

Personal identification

EntityDetectsDefault mask
SSNUS Social Security Numbers.[MASKED_SSN]
Driver’s LicenseDriver’s license numbers.[MASKED_LICENSE]
PassportPassport numbers.[MASKED_PASSPORT]
Tax IDTax identification numbers.[MASKED_TAX_ID]

Contact information

EntityDetectsDefault mask
EmailEmail addresses.[MASKED_EMAIL]
Phone NumberPhone numbers.[MASKED_PHONE]
AddressPhysical addresses.[MASKED_ADDRESS]
ZIP CodePostal codes.[MASKED_ZIP]

Technical identifiers

EntityDetectsDefault mask
IP AddressIPv4 addresses.[MASKED_IP]
IPv6 AddressIPv6 addresses.[MASKED_IP6]
MAC AddressMAC addresses.[MASKED_MAC]
UUIDUniversally unique identifiers.[MASKED_UUID]
Device IMEIDevice IMEI numbers.[MASKED_IMEI]
Vehicle VINVehicle identification numbers.[MASKED_VIN]

Authentication & security (Secrets & Keys)

These are the entities surfaced under the picker’s Secrets & Keys category — block them, don’t mask them.
EntityDetectsDefault mask
PasswordPassword fields (password=secret123, dotenv lines, etc.).[MASKED_PASSWORD]
API KeyGeneric API keys (api_key=…).[MASKED_API_KEY]
Access TokenBearer / access tokens.[MASKED_TOKEN]
JWT TokenJSON Web Tokens.[MASKED_JWT_TOKEN]

Cryptocurrency

EntityDetectsDefault mask
Crypto WalletCryptocurrency wallet addresses.[MASKED_WALLET]

International IDs — Europe

EntityDetectsDefault mask
Spanish DNISpanish national ID.[MASKED_DNI]
Spanish NIESpanish foreigner ID.[MASKED_NIE]
Spanish CIFSpanish company tax ID.[MASKED_CIF]
Spanish NSSSpanish social security.[MASKED_NSS]
Spanish IBANSpanish IBAN.[MASKED_ES_IBAN]
French NIRFrench social security.[MASKED_FR_NIR]
Italian CFItalian fiscal code.[MASKED_IT_CF]
German IDGerman national ID.[MASKED_DE_ID]

International IDs — Latin America

EntityDetectsDefault mask
Brazilian CPFBrazilian individual taxpayer ID.[MASKED_BR_CPF]
Brazilian CNPJBrazilian company registry.[MASKED_BR_CNPJ]
Mexican CURPMexican personal ID.[MASKED_MX_CURP]
Mexican RFCMexican tax ID.[MASKED_MX_RFC]
Argentine DNIArgentine national ID.[MASKED_DNI]
Chilean RUTChilean tax ID.[MASKED_RUT]
Colombian CCColombian citizen ID.[MASKED_CC]
Peruvian DNIPeruvian national ID.[MASKED_DNI]

Other

EntityDetectsDefault mask
US MedicareUS Medicare beneficiary IDs.[MASKED_MEDICARE]
ISINInternational Securities IDs.[MASKED_ISIN]
DateDates (various formats).[MASKED_DATE]

Custom entities

When the built-in catalog isn’t enough, add custom detectors for entities that matter to you — internal customer IDs, ticket numbers, project codenames, regulated case identifiers. Custom entities are defined per workspace and show up in the same When picker alongside the built-in categories. They support:
  • Keyword / dictionary lists for known vocabulary.
  • Regex patterns for structured identifiers (CASE-\d{6}, CUST-[A-Z0-9]{8}).
Once registered, they behave like any other detection — same Mask / Block / Log actions, same logs and metrics.

Masking — what Mask actually does

Picking Then → Mask on a data-protection policy does three things:
  1. Replaces the matched fragment in-flight with the entity’s default mask placeholder ([MASKED_EMAIL], [MASKED_CC], [MASKED_SSN], …) before the request continues. The upstream provider and the model never see the original value.
  2. Logs the detection with the entity type and position — but not the original value. Logs carry the placeholder (and a hash if you enable it).
  3. Mirrors the redaction on the return path for the same entities, so a masked prompt and the model’s response stay consistent.
This is the difference between data protection and the other detection families: Mask actively rewrites the payload, while Block and Log only inspect it.

Using data protection in a policy

Standard Where / When / Then:
  • Where — typically the Gateway surface, optionally filtered by Routes or Upstreams. Use Browser if you want the same control on extension traffic.
  • When
    • Input · triggers · PII & Confidential: Email, Credit Card (and/or)
    • Input · triggers · Secrets & Keys: API Key, JWT Token
  • ThenMask for PII, Block for secrets.
A single policy can stack multiple detections — they AND together per the policy model. Use separate policies when you need different actions for different entities on the same route (e.g. Mask PII, Block secrets).

Common policies

  • Mask PII before any third-party LLM callWhere: Gateway · Routes /openai/*, /anthropic/* · When: Input · triggers · PII & Confidential · Then: Mask.
  • Block secrets everywhereWhere: Gateway · When: Input · triggers · Secrets & Keys · Then: Block. Duplicate on Output so the model can’t echo them back.
  • Strip PII from generated responsesWhere: Gateway · When: Output · triggers · PII & Confidential: Email, Phone Number · Then: Mask.
  • EU compliance — mask Spanish IDs on EU routesWhere: Gateway · Upstreams = eu-* · When: Input + Output · triggers · PII & Confidential: Spanish DNI, Spanish NIE, Spanish NSS, Spanish IBAN · Then: Mask.
  • LatAm compliance — mask national IDs on regional routesWhen: Input + Output · triggers · Brazilian CPF, Mexican CURP, Argentine DNI, Chilean RUT, Colombian CC, Peruvian DNI · Then: Mask.
  • Log everything for a week, then enforce — clone any of the above with Then: Log to baseline real traffic before flipping to Mask / Block.