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).

Glitch provides comprehensive PII detection with both signature-based (fast, pattern matching) and LLM-based (contextual analysis) detectors.

Detector TypeDescriptionExampleLatency
pii/emailEmail addressesuser@example.com~11µs
pii/credit_cardCredit/debit card numbers (Visa, MC, Amex, Discover)4111-1111-1111-1111~11µs
pii/us_social_security_numberUS Social Security Numbers123-45-6789~11µs
pii/phone_numberPhone numbers (US, international)+1 (555) 123-4567~11µs
pii/ip_addressIPv4 and IPv6 addresses192.168.1.1, 2001:db8::1~11µs
pii/iban_codeInternational Bank Account NumbersDE89370400440532013000~11µs
Detector TypeDescriptionExampleLatency
pii/addressPhysical mailing addresses123 Main St, Apt 4B, NYC 10001~50-100ms
pii/namePersonal names with identifying contextDr. John Smith, patient ID 12345~50-100ms
{
"output_detectors": [
{ "detector_type": "pii/email", "threshold": "L2", "action": "block" },
{ "detector_type": "pii/credit_card", "threshold": "L1", "action": "block" },
{ "detector_type": "pii/us_social_security_number", "threshold": "L1", "action": "block" }
]
}
{
"input_detectors": [
{ "detector_type": "pii/credit_card", "threshold": "L1", "action": "block" },
{ "detector_type": "pii/us_social_security_number", "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/us_social_security_number", "threshold": "L1", "action": "block" },
{ "detector_type": "pii/phone_number", "threshold": "L2", "action": "log" },
{ "detector_type": "pii/ip_address", "threshold": "L2", "action": "log" },
{ "detector_type": "pii/iban_code", "threshold": "L1", "action": "block" },
{ "detector_type": "pii/address", "threshold": "L3", "action": "log" },
{ "detector_type": "pii/name", "threshold": "L3", "action": "log" }
]
}
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 matching card prefixes
pii/us_social_security_numberL1Strict pattern with separators, low false positives
pii/iban_codeL1Strict international bank account format
pii/emailL2Email-like patterns can be benign
pii/phone_numberL2-L3Many number patterns look like phones
pii/ip_addressL2Version numbers can look like IPs
pii/addressL3Addresses have high variance, LLM-analyzed
pii/nameL3-L4Names are highly contextual, LLM-analyzed

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 logged for review.

Credit cards and SSNs should always be blocked:

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

For lower-confidence detections, start with logging:

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

Review logged 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)