What Youβll Build
In this quick start, youβll implement a secret detection system that:- Detects ~42 known credential formats (Anthropic, OpenAI, AWS, GitHub, Slack, and more)
- Catches unknown secrets using Shannon entropy analysis
- Returns character-level spans so you can locate and redact secrets in your text
- Provides real-time detection with sub-second latency
Prerequisites
- Fiddler account with access token
- Python 3.10+ environment
Overview
Fiddlerβs Centor Secret Detection guardrail scans text for credentials before they reach your LLM or get logged, delivering deterministic, low-latency results with no GPU required.Key Capabilities
- Pattern-based detection: ~42 known credential formats covering major providers and platforms
- Entropy analysis: Catches high-entropy strings that match unknown or custom secret formats (labeled as
Possible Secret) - Character-level spans: Returns
startandendoffsets for precise redaction - Fast: Sub-millisecond detection latency, CPU-only
Example 1: API Key Detection
Detect common API keys and credentials:Expected Output:
Exact character positions (start/end) vary by input and are returned by the API. The redaction helper uses API-returned offsets, not hardcoded values.
API Reference
Endpoint
Request Format
Request Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
input | string | Text to scan for secrets | Required |
Response Format
Response Fields
| Field | Type | Description |
|---|---|---|
label | string | Secret type (e.g. "Anthropic API Key") |
start | integer | Character position where secret starts |
end | integer | Character position where secret ends |
Detected Secret Types
LLM Provider Keys
Anthropic API Key, OpenAI Project Key, OpenAI/Stripe Secret Key, Hugging Face Token, Replicate API Token
Cloud Platforms
AWS Access Key ID, AWS Secret Access Key, Google API Key, Google OAuth Client Secret, Azure Credential, DigitalOcean PAT, DigitalOcean OAuth Token, Heroku API Key, Datadog API Key
Source Control
GitHub Fine-grained PAT, GitHub Personal Access Token, GitHub OAuth Token, GitHub Server Token, GitLab Personal Access Token, GitLab Pipeline Token, Bitbucket App Password
Package Registries
npm Access Token, PyPI API Token, NuGet API Key
Communication & Messaging
Slack Bot Token, Slack User Token, Slack App Token, Slack Webhook URL, Discord Bot Token, SendGrid API Key, Twilio Account SID, Mailgun API Key
Developer Tools
Postman API Key, HashiCorp Vault Token, Terraform Cloud Token, Supabase Token, Vercel Token
Generic Formats
JWT Token, HTTP Basic Auth, HTTP Bearer Token, PEM Private Key, Database Connection String
Entropy-based Detection
High-entropy alphanumeric, hex, and base64 strings that donβt match a known prefix pattern but exceed entropy thresholds. These are labeled asPossible Secret.
Code Examples
- Python - Requests
- cURL
Next Steps
- Use the LiteLLM Guardrails integration to automatically block or redact secrets in real-time LLM proxy traffic
- Explore other Fiddler guardrails for comprehensive AI safety
- Review the Secret Detection Evaluator for use with the Fiddler Evals SDK
Summary
Youβve learned how to:- β Detect ~42 known credential formats using pattern matching
- β Catch unknown high-entropy secrets using entropy analysis
- β
Locate secrets precisely using character-level
start/endspans - β Redact secrets from text before forwarding to an LLM