Secrets Detection
Block API keys, tokens, database URLs, and credentials before they reach the LLM. Built into the OSS tier, no external API required.
Developers regularly paste credentials into prompts without noticing:
.envfile contents when debugging config- Database URLs when asking for query help
- API keys when troubleshooting auth errors
- SSH private keys when working through certificate issues
PromptShield catches these before the prompt reaches the LLM, with no external API and no data leaving your infrastructure.
What gets detected
| Secret type | Pattern |
|---|---|
| AWS Access Key | AKIA... (20 chars) |
| AWS Secret Key | 40-char base62 string in an AWS context |
| GitHub personal access token | ghp_..., github_pat_... |
| OpenAI API key | sk-... (48 chars) |
| Anthropic API key | sk-ant-api03-... |
| Stripe secret key | sk_live_..., sk_test_... |
| Slack bot/app token | xoxb-..., xoxa-... |
| Google API key | AIza... (39 chars) |
| Bearer tokens | Bearer <token> in prompt text |
| Private keys (PEM) | -----BEGIN RSA PRIVATE KEY----- |
| Database connection strings | postgres://, mysql://, mongodb+srv:// |
| JWT tokens | eyJ... header+payload+signature |
Try it
Paste a .env file into a prompt:
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.0-flash",
"messages": [{
"role": "user",
"content": "Why is this broken?\n\nOPENAI_API_KEY=sk-proj-abc123def456\nDB_URL=postgres://admin:password@prod.db:5432/app"
}]
}'{ "error": "request blocked: secret detected in prompt" }The LLM was never called. No tokens consumed. The audit log records the entity type, not the secret value.
Policy
secrets:
action: block # block | allowblock returns HTTP 403 and stops the request. allow passes it through. mask is not supported for secrets because a partially redacted key may still be usable.
warn (log and pass through) is coming soon.
See Policy for the full config reference.
Audit logs
The entities_detected field records the type name only. The actual credential never appears in logs.
{
"action": "block",
"entities_detected": ["SECRET_OPENAI_API_KEY"],
"reasons": ["blocked secret detected: SECRET_OPENAI_API_KEY"]
}Scope
Secrets detection runs on prompt text. It does not scan request headers, file attachments, or multimodal inputs. If your app summarizes user-uploaded files by passing their content into a prompt, that content will be scanned.