Data Loss Prevention (DLP)
Automatically detect and mask sensitive data — PII, API keys, credentials, and custom patterns — before it reaches your LLM provider or leaves your system in a response.
Overview
AI agents frequently handle sensitive data: customer emails, phone numbers, API tokens, internal documents. Without a safeguard, that data passes through LLM providers and third-party services — outside your control.
Trappr's DLP layer scans every request and response at the gateway. When a sensitive pattern is detected, it's replaced with a placeholder before being forwarded. The real value never leaves your controlled environment.
Built-in pattern library
Trappr ships with a curated set of patterns enabled by default. You can enable or disable individual patterns per app.
| Category | Detected types | Default |
|---|---|---|
| Credentials | API keys, Bearer tokens, AWS access keys, private keys | On |
| PII | Email addresses, phone numbers, SSNs, passport numbers | On |
| Financial | Credit card numbers, bank account numbers, IBANs | On |
| Network | IP addresses, MAC addresses, internal hostnames | Off |
| Custom | Your own regex patterns | Configurable |
Enabling DLP
Go to Dashboard → DLP. You'll see the full list of built-in pattern categories and any custom rules you've created.
Toggle the categories relevant to your agent's data. For agents that handle customer records, enable PII. For agents with tool access to cloud APIs, enable Credentials.
Under DLP → Custom rules, add regex patterns for data specific to your domain — for example, internal employee IDs, project codes, or domain-specific secrets.
# Example: internal employee ID
^EMP-[0-9]{6}$
# Example: internal project code
\bPROJ-[A-Z]{3}-[0-9]{4}\bDLP is applied automatically to all requests routed through the AI Gateway. No agent code changes are needed beyond the base URL update.
How masking works
When a pattern match is found, the detected value is replaced with a typed placeholder. The placeholder is scoped to the request — so if your agent uses the masked value in a follow-up message, Trappr resolves it back correctly.
| Original value | Masked as |
|---|---|
john.doe@company.com | [EMAIL_1] |
sk-proj-abc123... | [API_KEY_1] |
+1-555-867-5309 | [PHONE_1] |
4111 1111 1111 1111 | [CREDIT_CARD_1] |
DLP in ENFORCE mode
When an app is in ENFORCE mode, DLP violations can be configured to block the request entirely rather than masking and forwarding. The agent receives an error response with a policy violation code.
{
"error": {
"code": "dlp_policy_violation",
"message": "Request blocked: sensitive data detected.",
"type": "trappr_enforcement"
}
}Viewing DLP events
Every DLP match is logged with the category, pattern, and the request context under Dashboard → DLP → Events. You can filter by category, time range, and app.