Built-in detectors
PromptGlass ships with built-in detectors that classify the content of prompts, pastes, file uploads and (optionally) responses. Each detector emits a data class such as pci.card or secret.aws_key, a count, a confidence, and the character spans it matched. Policies act on data classes, not on individual detectors, so you can tune detection without rewriting policy.
Detection pipeline
Section titled “Detection pipeline”Detectors run in tiers so the gateway stays fast:
- Pattern + validator: regular expressions with checksums or structure checks (Luhn, IBAN mod-97, SIN/SSN rules, key prefixes). Sub-millisecond.
- Dictionary and keyword proximity: medical terms, project code names, deal terms, near identifiers.
- Exact data match (EDM): hashed lookups against your own records. See exact data match.
- ML classifiers: named-entity recognition for people, organizations and addresses; a source-code classifier; document-type classifiers (contract, résumé, financial statement). Runs only when a rule needs it, or asynchronously for observe-only sensors.
Data classes
Section titled “Data classes”| Data class | What it finds | Method |
|---|---|---|
pii.email |
Email addresses | Pattern |
pii.phone |
Phone numbers (E.164 and national formats) | Pattern + libphonenumber validation |
pii.person_name |
Personal names in context | ML NER |
pii.address |
Postal addresses | ML NER + pattern |
pii.national_id.us_ssn |
US Social Security numbers | Pattern + area/group rules + context |
pii.national_id.ca_sin |
Canadian Social Insurance Numbers | Pattern + Luhn |
pii.national_id.uk_nino |
UK National Insurance numbers | Pattern + prefix rules |
pii.national_id.eu |
Selected EU national IDs and tax IDs | Pattern + checksum |
pii.dob |
Dates of birth near identity context | Pattern + proximity |
phi.medical_record |
MRNs, health plan IDs | Pattern + context dictionary |
phi.clinical |
Diagnoses, medications, procedures (ICD-10, SNOMED-like terms) near a person | Dictionary + NER proximity |
pci.card |
Payment card numbers | Pattern + Luhn + IIN ranges |
pci.track_data |
Magnetic stripe track data | Pattern |
financial.iban / financial.bank_account |
IBAN, US routing + account, CA transit | Pattern + mod-97 / checksum |
secret.aws_key |
AWS access key IDs and secret keys | Prefix + entropy |
secret.azure / secret.gcp |
Azure connection strings, SAS tokens, GCP service-account keys | Pattern + structure |
secret.api_key |
OpenAI, Anthropic, GitHub, Slack, Stripe and other vendor tokens | Prefix patterns |
secret.private_key |
PEM/SSH private keys | Pattern |
secret.password |
Passwords in connection strings and config | Pattern + context |
secret.jwt |
JSON Web Tokens | Structure |
code.source |
Source code (with language) | ML classifier |
code.proprietary |
Code matching your repositories’ fingerprints | Fingerprint EDM |
business.financials |
Non-public financial results, forecasts | Keyword proximity + classifier |
business.mna |
M&A and deal terms, code names | Dictionary (customizable) |
business.legal_privileged |
Privileged & confidential legal text | Keyword + classifier |
doc.label.* |
Microsoft Purview / Google sensitivity labels on uploaded files | File metadata |
Confidence and thresholds
Section titled “Confidence and thresholds”Each match has a confidence of low, medium or high. Rules can require a minimum confidence and a minimum count:
match: data_class: [pii.national_id.*] min_confidence: medium min_count: 1Testing a detector
Section titled “Testing a detector”promptglass policy test --text "Customer SIN 046 454 286, card 4111-1111-1111-1111"pii.national_id.ca_sin high 1 [13..24]pci.card high 1 [31..50]→ rule "redact-pci-and-national-ids" → action: redactTuning
Section titled “Tuning”- Allowlists: suppress known test values (
4111 1111 1111 1111), your support phone number, public email domains. - Context words: require nearby context for noisy classes (
pii.dobneeds “born”, “DOB” and so on). - Per-app scope: turn on code detection only for AI coding tools, or skip it in approved internal assistants.
For organization-specific detectors, see custom detectors.