DLP, Secrets Detection, and Tokenization
Use this when prompts, retrieved content, tool arguments, model outputs, or reports may contain credentials, tokens, private keys, PII, or customer-sensitive data.
Firefish DLP runs locally. It can detect sensitive patterns, return findings without raw values, redact text, and optionally tokenize values within a local session scope.
What it detects
- API-key-like values.
- Bearer-token-like values.
- Password key/value pairs.
- Private-key blocks.
- Database URLs.
- High-entropy secret-like strings.
- Emails and phone numbers.
- Luhn-valid credit-card-like numbers.
- SSN-like values.
- IP addresses.
- Custom local regex patterns supplied by settings or request metadata.
Local-first defaults
- DLP_ENABLED=true by default.
- DLP_TOKENIZATION_ENABLED=false by default.
- Raw sensitive values are not returned in findings, API metadata, or audit previews.
- Token maps are local, in-memory, and session-scoped by default.
- Detokenization fails closed unless tokenization is explicitly enabled.
Redact a synthetic secret
curl -X POST http://localhost:8000/v1/dlp/redact \
-H "X-API-Key: change-me-local-dev-key" \
-H "Content-Type: application/json" \
-d '{
"text": "Synthetic customer email analyst@example.test and fake secret FIREFISH_FAKE_SECRET_001."
}'
Tokenize for a local session
from firefish import FirefishClient
client = FirefishClient.from_env()
tokenized = client.tokenize(
text="Contact analyst@example.test about FIREFISH_FAKE_SECRET_001.",
tenant_id="local-demo",
session_id="session-001",
)
print(tokenized["tokenized_text"])
Use tokenization only when you need reversible placeholders and have an approved local token-vault operating model.
Where DLP applies
Firefish uses DLP in direct DLP APIs, scan metadata, output safety, RAG firewall analysis, chat gateway preprocessing, and audit-safe previews. The goal is to keep sensitive values out of model context and operator views unless an explicit privileged workflow requires otherwise.
Firefish does not replace a full enterprise DLP program. It is a local AI-boundary control for sensitive data that may flow through LLM applications.