Data Loss Prevention & Email Security
Scan pasted text or uploaded files for exposed secrets and PII, and review a log of inbound email scored on SPF/DKIM/DMARC results and common phishing heuristics.
/dlpHow it works
OverviewThe page has two tabs, backed by two independent engines. Both are fully deterministic — pattern and heuristic matching only, with no AI/LLM involved, so they behave identically whether or not an AI provider is configured.
DLP Scanner
An on-demand utility that runs pasted content or an uploaded file through a set of regular-expression detectors for sensitive data (SSNs, credit-card numbers, AWS keys, generic API secrets, private keys, and JWTs). It is ephemeral — the scan runs in memory and nothing is written to the database. Every finding carries only a redacted preview of the match, never the raw value.
The same detector (scanForSensitiveData) is wired into several other surfaces automatically, so this tab is for one-off, ad-hoc checks:
- AI Copilot chat — a hit blocks the send entirely; the message never reaches conversation history or the external LLM, and the user gets a "Message blocked" reply.
- Malware-lab uploads and ticket comments — a hit raises a DLP alert (it does not block the action).
Inbound Mail Log
A read-only log of email received through a SendGrid Inbound Parse webhook. Each message is scored for phishing risk and given a verdict of clean, suspicious, or phishing. Only metadata is stored — never the email body or attachments.
When an inbound message scores as suspicious or phishing, the webhook also raises an alert, injects a SIEM event, and triggers any matching SOAR playbooks. DLP is additionally run over the subject line (the only message content this route ever reads).
Using the DLP Scanner
How to useScan pasted text
- Open Data Loss Prevention & Email Security and stay on the DLP Scanner tab.
- Paste text, config, logs, or code into the box.
- Click Scan Text.
Scan a file
Click Scan a File and pick a file. It is read as UTF-8 text and only the first ~1 MB (1,000,000 bytes) is scanned; anything beyond that is ignored.
Reading the results
Results appear in a table. A clean scan shows "No sensitive data detected". Each finding row has four columns:
| Column | Meaning |
|---|---|
| Type | What was detected (SSN, Credit Card, AWS Access Key, API Key / Secret, Private Key, JWT). |
| Redacted Match | A masked preview — typically the first four and last four characters with the middle starred out. The raw value is never returned. |
| Confidence | high or medium. |
| Severity | Critical, High, or Medium. |
The scanner does not save anything. Re-running is the only way to see a previous result, and results are visible only to you in the current session.
Inbound Mail Log
SetupThe Inbound Mail Log tab lists the most recent received messages for your organization (newest first, up to 200), showing From, To, Subject, the SPF/DKIM/DMARC results, the verdict, and the received time.
Wiring up the webhook
- Point a receiving domain or subdomain's MX records at SendGrid.
- Configure SendGrid's Inbound Parse route to POST to
/api/email-security/inbound?token=. - Set
INBOUND_EMAIL_WEBHOOK_SECRETin the deployment's environment (see.env.example). If it is unset the webhook fails closed and returns503; a missing or wrongtokenreturns401.
To scope scans to an organization, set that org's inboundEmailDomain to the receiving domain (the part after @ in the To address). Scans whose recipient domain matches are attributed to that org; unmatched mail is stored with no organization.
How the verdict is scored
SendGrid supplies a pre-computed SPF verdict directly; DKIM and DMARC verdicts are parsed from the Authentication-Results line in the raw MIME headers. Points are added deterministically:
| Signal | Points |
|---|---|
SPF result is fail | +30 |
DKIM result is fail | +25 |
DMARC result is fail | +25 |
| All three authentication checks failed | +10 |
| Display name suggests an internal role (e.g. "IT support", "help desk", "admin", "security team", "payroll", "HR department", "CEO", "finance") but the From domain is a generic mailbox provider (gmail.com, yahoo.com, outlook.com, hotmail.com, aol.com) | +20 |
| Subject contains a common urgency/phishing phrase (e.g. "verify your account", "urgent action required", "payment failed", "wire transfer") | +15 |
The score is capped at 100. A score of 60 or more is phishing, 30–59 is suspicious, and below 30 is clean. Non-clean verdicts raise an alert at High severity for phishing and Medium for suspicious.
Detection reference & API
ReferenceDetected data types
| Type | What it matches | Confidence | Severity |
|---|---|---|---|
| Social Security Number | US SSN format (excludes reserved 000/666/9xx area, 00 group, 0000 serial) | high | High |
| Credit Card Number | 13–19 digit sequences that pass a Luhn check | high | High |
| AWS Access Key | AKIA followed by 16 uppercase/alphanumeric characters | high | Critical |
| API Key / Secret | An api_key/secret/token/password assignment with a 16+ character value | medium | Critical |
| Private Key | A -----BEGIN ... PRIVATE KEY----- header (RSA/EC/OPENSSH/DSA) | high | Critical |
| JWT Token | A three-part eyJ... JSON Web Token | medium | Critical |
Scan endpoint
POST /api/dlp/scan is session-authenticated (call it from a signed-in session). Send either a JSON body with a text field, or multipart/form-data with a file field. It returns findings (the array shown above) and scannedLength (the number of characters scanned).
curl -X POST https://portal.guardfoxsecurity.com/api/dlp/scan \
-H "Content-Type: application/json" \
-d '{"text":"aws_secret AKIAIOSFODNN7EXAMPLE and ssn 123-45-6789"}'Inbound mail endpoints
GET /api/email-security/inbound— session-authenticated; returns up to 200 scans for your organization, newest first, each with its parsedflaggedReasons.POST /api/email-security/inbound?token=— the SendGrid Inbound Parse webhook target (token-authenticated, not session-authenticated). Reads thefrom,to,subject,SPF, andheadersform fields and returns{ ok, verdict, riskScore }.
Stored inbound fields (metadata only): from address and display name, to address, subject (truncated to 500 chars), SPF/DKIM/DMARC results, risk score, verdict, flagged reasons, organization, and received time. The message body and attachments are never persisted.