Skip to content

Sensitive CanarySecrets and PII guard for Claude Code

A security plugin that prevents unintended data leaks from Claude Code. Automatically detects and blocks AWS keys, tokens, email addresses, credit card numbers, and more before they are sent to the API.

Sensitive Canary

Why Sensitive Canary? ​

Claude Code is a powerful development tool, but file reads and command executions can inadvertently send secrets and personal information to the Anthropic API. API keys in .env files, tokens embedded in config files, credentials pasted into the terminal β€” once sent to the API, they leave your machine.

Sensitive Canary intercepts them before they are sent, preventing unintended data leaks.

Without Sensitive CanaryWith Sensitive Canary
cat .env β†’ full contents sent to Claude ❌Blocked by name by default before Claude reads it βœ…
Paste a live AWS key in a prompt ❌Blocked before the API call is made βœ…
Read customers.csv full of email addresses ❌PII detected before Claude sees the file βœ…
echo $API_KEY with live key ❌Env var value scanned and blocked βœ…
  • Two hooks β€” UserPromptSubmit and PreToolUse cover both directions of risk
  • 76 detection rules β€” sourced from gitleaks and TruffleHog detector definitions
  • Context gating β€” the noisiest PII rules (non-US/JP phone numbers, postal codes, public IP addresses) only fire when a relevant label is nearby; US and JP phone numbers and JP postal codes are matched without one
  • Entropy filtering β€” reduces false positives on low-entropy values
  • Luhn validation β€” credit card numbers are validated, not just pattern-matched
  • Local only β€” all scanning runs in your terminal; nothing is sent anywhere

Detection Rules ​

CategoryExamples
Cloud credentialsAWS Access Key, GCP API key
Source controlGitHub PAT, GitHub fine-grained token, GitLab PAT
AI servicesAnthropic API key, OpenAI API key / project key, Replicate, Hugging Face, Groq, OpenRouter, xAI, Perplexity
CommunicationSlack token, Slack webhook, Discord webhook, Telegram bot token
PaymentStripe secret/restricted key, Square access token, credit card numbers (Luhn-validated)
Email servicesSendGrid API key, Mailgun key, Mailchimp key
Cloud / IaaSDigitalOcean PAT, Supabase PAT
SaaS / Dev toolsMapbox, Sentry, Atlassian, Linear, Postman
Auth tokensJWT, database connection strings
PIIEmail, US SSN, phone (8 countries), national IDs (7 countries), postal codes, IP addresses

View all detection rules β†’

Released under the MIT License.