Skip to main content
Get your secret detection running in minutes with Fiddler’s Centor Secret Detection Guardrail. This guide walks you through detecting API keys, credentials, and tokens to prevent sensitive secrets from leaking through your LLM applications.

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 start and end offsets for precise redaction
  • Fast: Sub-millisecond detection latency, CPU-only
1

Set Up Your Environment

Configure the Secret Detection Guardrail API:
2

Define Helper Functions

Create reusable functions for interacting with the API:
3

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.
4

Example 2: Cloud & Infrastructure Credentials

Detect AWS access keys and other infrastructure secrets:
Expected Output:

API Reference

Endpoint

Request Format

Request Parameters

Response Format

Response Fields

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 as Possible Secret.

Code Examples

Next Steps

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/end spans
  • ✅ Redact secrets from text before forwarding to an LLM