> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neuraltrust.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These docs cover three products: TrustGate (AI agent gateway), TrustGuard (runtime security), and TrustTest (AI red teaming). Start from each product overview for the definition and How it works. Prefer the .md URL next to a page in /llms.txt when you need the full article. Use /llms-full.txt for a single-file dump of the site.

# Data loss prevention

> Detect and mask PII and secrets in AI traffic on input and output. Configure data categories and custom rules in the console — the only transform-capable detector.

The **Data Loss Prevention** detector finds sensitive data — PII and secrets — in
prompts and model output, and can **mask it in flight**. Create and configure it in
the console under **Detectors**; attach it from a [policy](https://docs.neuraltrust.ai/trustguard/concepts/policies.md)
to choose what happens when it matches.

It is the only **mutable** detector: the only one that supports the **Transform**
action (mask matched values before the payload continues).

| Property | Value |
| - | - |
| Catalog type | Data Loss Prevention |
| Sides | Input, Output |
| Protocols | All |
| Mutable | ✅ |

JSON bodies are masked **structurally** (string values only — keys are never
touched); plain-text bodies are masked directly. Matches that are secrets (API
keys, access tokens, JWTs, Stripe keys) are reported as secret findings; other
entities as PII.

## What it protects against

Three different problems, and they are worth separating because each wants a
different action:

* **Personal data leaving your control** — reaching a third-party model provider
  in a prompt. Input + **Transform**: the request still goes through, masked.
* **Personal data reaching a person who should not see it** — regurgitated in an
  answer. Output + **Transform**.
* **Credentials leaking** — API keys, access tokens, JWTs, Stripe keys. **Block**
  rather than Transform: a masked credential has still left, and a request
  carrying one is usually a bug worth surfacing rather than cleaning.

## Configure

1. Open **Detectors** → create a detector and pick **Data Loss Prevention**.
2. Under **Data Categories**, choose what to detect (or use **Enable all**).
3. Optionally add **Custom rules** for keywords or regex patterns that are not in
   the built-in catalog.
4. Save the detector, then add it to a [policy](https://docs.neuraltrust.ai/trustguard/concepts/policies.md) rule
   (Input and/or Output) with an action.

You must configure at least one of: **Enable all**, one or more data categories, or
one or more custom rules.

## What happens when it matches

The detector only finds and (when Transform is selected) masks. The action is set
on the policy rule that references it:

| Console label | Effect |
| - | - |
| **Monitor** | Record a finding; leave the payload unchanged. |
| **Block** | Record a finding and flag the request to be blocked. |
| **Transform** | Record a finding and forward a masked payload. Only DLP supports this. |

In **Runtime → Activity**, masked values are shown masked. Only Owner, Global Admin and
Admin can switch to **Original** to see them; Editor and Viewer cannot. See
[Masked values](https://docs.neuraltrust.ai/trustguard/data-handling.md#masked-values).

## Data Categories

The form groups **67** built-in entities into six searchable categories. Toggle
them individually, use **Search categories** to narrow the list, or **Enable all**
to mask every entity at once.

### Personal information

| Entity | What it matches |
| - | - |
| **Email address** | Email addresses |
| **Phone number** | Phone numbers |
| **Spanish phone** | Spain phone numbers |
| **Driver's license** | Driver's license numbers |
| **Passport number** | Passport numbers |
| **Vehicle VIN** | Vehicle identification numbers |

### Financial data

| Entity | What it matches |
| - | - |
| **Credit card number** | Credit and debit cards |
| **CVV / security code** | Card verification codes |
| **Bank account** | Bank account numbers |
| **IBAN** | International bank accounts |
| **Spanish IBAN** | Spain bank accounts |
| **Routing number** | Bank routing numbers |
| **SWIFT / BIC** | SWIFT and BIC codes |
| **ISIN** | Securities identifiers |
| **Crypto wallet** | Crypto wallet addresses |

### Secrets & credentials

Every entity here except **UUID** is reported as a **secret** finding rather than
PII. See [Secrets are a different kind of finding](#secrets-are-a-different-kind-of-finding).

| Entity | What it matches |
| - | - |
| **API key** | API keys and secrets |
| **Access token** | OAuth and bearer tokens |
| **Bearer token** | Tokens following an `Authorization: Bearer` header |
| **JWT token** | JSON Web Tokens |
| **HTTP Basic credentials** | Base64 `user:password` in an Authorization header |
| **Password field** | `password=` and `password:` assignments |
| **Database connection string** | DSNs carrying a user and password |
| **Private key (PEM)** | PEM private key blocks |
| **AWS access key** | `AKIA` and `ASIA` access key IDs |
| **Azure storage key** | Azure account keys and SAS signatures |
| **Google API key** | `AIza` API keys |
| **GitHub token** | `ghp_`, `gho_`, `ghs_` and `github_pat_` tokens |
| **GitLab token** | GitLab personal access tokens |
| **npm token** | npm automation and granular tokens |
| **Vault token** | HashiCorp Vault service tokens |
| **OpenAI API key** | `sk-` and `sk-proj-` keys |
| **Anthropic API key** | `sk-ant-` keys |
| **Hugging Face token** | `hf_` access tokens |
| **Stripe key** | Stripe API keys |
| **Slack token** | `xoxb`, `xoxp` and `xoxa` tokens |
| **SendGrid API key** | `SG.` API keys |
| **Twilio credential** | Account and API key SIDs |
| **UUID** | Unique identifiers — **not** treated as a secret |

### Device & network

| Entity | What it matches |
| - | - |
| **IP address** | IPv4 addresses |
| **IPv6 address** | IPv6 addresses |
| **MAC address** | Hardware MAC addresses |
| **Device MAC** | Device MAC addresses |
| **Device IMEI** | Mobile device IMEI |

### Health & medical

Several of these verify a check digit rather than matching a shape, so they
produce far fewer false positives than a bare pattern would.

| Entity | What it matches |
| - | - |
| **NHS number (UK)** | UK patient numbers, checksum verified |
| **NPI (US provider)** | US provider IDs, checksum verified |
| **DEA number (US)** | US prescriber registrations, checksum verified |
| **Medicare (Australia)** | Australian card numbers, checksum verified |
| **US Medicare** | US Medicare IDs |
| **Medical record number** | Record and patient IDs — needs a nearby label to match |

### National & government IDs

| Entity | What it matches |
| - | - |
| **US Social Security Number** | US Social Security |
| **US ITIN** | US taxpayer ID for non-SSN holders |
| **Tax ID** | Taxpayer ID numbers |
| **Spanish DNI** | Spain national ID |
| **Spanish NIE** | Spain foreigner ID |
| **Spanish CIF** | Spain company tax ID |
| **Spanish NSS** | Spain social security |
| **French NIR** | France social security |
| **German ID** | Germany national ID |
| **Italian Codice Fiscale** | Italy tax code |
| **Argentine DNI** | Argentina national ID |
| **Brazilian CPF** | Brazil individual tax ID |
| **Brazilian CNPJ** | Brazil company tax ID |
| **Chilean RUT** | Chile national tax ID |
| **Colombian CC** | Colombia citizenship ID |
| **Mexican CURP** | Mexico population ID |
| **Mexican RFC** | Mexico taxpayer ID |
| **Peruvian DNI** | Peru national ID |

### Secrets are a different kind of finding

A leaked credential is an incident, not a privacy problem, and TrustGuard keeps
them apart: **22 of the 23** entities in Secrets & credentials are reported as
**secret** findings instead of PII. **UUID** is the exception — it sits in that
group for convenience but is reported as PII, because a UUID on its own is rarely
a credential.

That split is why secrets usually deserve their own policy rule: **Block** on
them, while everything else is merely masked.

When Transform runs, predefined entities are replaced with an entity-specific
token (for example `[MASKED_EMAIL]`) unless you rely only on custom rules.

## Custom rules

Use **Custom rules** when you need patterns that are not in the built-in catalog
— internal account IDs, project codes, product-specific tokens, and so on.

1. In the detector form, open **Custom rules**.
2. Click **Add custom rule**.
3. Set **Type**:
   * **Keyword** — exact substring match (e.g. `confidential`).
   * **Regex** — a regular-expression pattern (e.g. `ACME-\d{6}`).
4. Enter the keyword or pattern (required).
5. Optionally set **Mask with** (default `***`) and **Preserve length** (replace
   with `*` repeated to the original length).
6. Add more rules as needed; each rule is evaluated in order along with the
   selected data categories.

Empty patterns are invalid — the console blocks save until every custom rule has
a non-empty keyword or regex.

## When to use

* **Output + Transform** — strip PII the model regurgitates before it reaches the
  user.
* **Input + Transform** — keep PII out of third-party model providers.
* **Block** on the **Secrets & credentials** group — a masked credential has
  still left your perimeter, so cleaning it up is not enough.
* Start with **Monitor** (and policy **Report** mode) when enabling broad
  categories, then switch to **Enforce** + Block/Transform once the signal looks
  right.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.