Skip to content

Data Leakage Prevention

Data Leakage Prevention (DLP) identifies and protects sensitive data like personally identifiable information (PII), credentials, and proprietary content.

LLMs can leak sensitive data in two ways:

Models may memorize and regurgitate sensitive data from their training set.

When processing documents or conversation history, models may expose sensitive information in their responses.

Glitch DLP detects sensitive data in both inputs (preventing submission) and outputs (preventing exposure).

Detector TypeDescriptionExample
pii/emailEmail addressesuser@example.com
pii/credit_cardCredit/debit card numbers4111-1111-1111-1111
pii/ssnSocial Security Numbers123-45-6789
pii/phonePhone numbers+1 (555) 123-4567
pii/addressPhysical addresses123 Main St, City, ST 12345
pii/namePersonal namesJohn Smith
{
"output_detectors": [
{ "detector_type": "pii/email", "threshold": "L2", "action": "block" },
{ "detector_type": "pii/credit_card", "threshold": "L1", "action": "block" },
{ "detector_type": "pii/ssn", "threshold": "L1", "action": "block" }
]
}
{
"input_detectors": [
{ "detector_type": "pii/credit_card", "threshold": "L1", "action": "block" },
{ "detector_type": "pii/ssn", "threshold": "L1", "action": "block" }
],
"output_detectors": [
{ "detector_type": "pii/email", "threshold": "L2", "action": "block" },
{ "detector_type": "pii/credit_card", "threshold": "L1", "action": "block" },
{ "detector_type": "pii/ssn", "threshold": "L1", "action": "block" },
{ "detector_type": "pii/phone", "threshold": "L2", "action": "flag" },
{ "detector_type": "pii/address", "threshold": "L3", "action": "flag" }
]
}
Output: "Your card ending in 4532-8901-2345-6789 has been charged."
Detection: pii/credit_card
Confidence: 0.98
Action: BLOCKED
Note: Credit card patterns have high confidence due to
Luhn checksum validation.
DetectorRecommended LevelNotes
pii/credit_cardL1High-precision pattern with checksum
pii/ssnL1Strict pattern, low false positives
pii/emailL2Email-like patterns can be benign
pii/phoneL2-L3Many number patterns look like phones
pii/addressL3Addresses have high variance
pii/nameL3-L4Names are highly contextual

Prevents users from submitting sensitive data:

{
"input_detectors": [
{ "detector_type": "pii/credit_card", "threshold": "L1", "action": "block" }
]
}

Use cases:

  • Prevent accidental PII submission
  • Compliance with data handling policies
  • Reduce liability from processing sensitive data

Catches sensitive data in LLM responses:

{
"output_detectors": [
{ "detector_type": "pii/credit_card", "threshold": "L1", "action": "block" },
{ "detector_type": "pii/email", "threshold": "L2", "action": "block" }
]
}

Use cases:

  • Prevent training data leakage
  • Protect against prompt injection data extraction
  • Compliance with privacy regulations (GDPR, CCPA)

Sometimes legitimate data looks like PII. Use allow lists:

{
"allow_list": {
"entries": [
"support@yourcompany.com",
"sales@yourcompany.com"
],
"match_type": "exact"
},
"output_detectors": [
{ "detector_type": "pii/email", "threshold": "L2", "action": "block" }
]
}

This blocks email addresses except your company’s support emails.

HTTP/1.1 403 Forbidden
X-Risk-Blocked: true
X-Risk-Categories: pii/credit_card
X-Risk-Confidence: 0.98
{
"error": {
"message": "Response blocked: sensitive data detected",
"type": "data_leakage_prevention",
"code": "pii_detected"
}
}
HTTP/1.1 200 OK
X-Risk-Blocked: false
X-Risk-Categories: pii/email
X-Risk-Confidence: 0.85

Content is delivered but flagged for logging/review.

Credit cards and SSNs should always be blocked:

{
"output_detectors": [
{ "detector_type": "pii/credit_card", "threshold": "L1", "action": "block" },
{ "detector_type": "pii/ssn", "threshold": "L1", "action": "block" }
]
}

For lower-confidence detections, start with flagging:

{
"output_detectors": [
{ "detector_type": "pii/name", "threshold": "L3", "action": "flag" }
]
}

Review flagged content to tune your policy.

Add patterns for domain-specific sensitive data:

{
"custom_detectors": [
{
"name": "employee_id",
"pattern": "EMP-\\d{6}",
"action": "block",
"description": "Internal employee IDs"
}
]
}

DLP helps with:

RegulationRelevant Data Types
GDPRAll PII (names, emails, addresses)
CCPACalifornia resident PII
PCI-DSSCredit card numbers
HIPAAHealth information (custom detectors)