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 before Claude reads it ✅
Paste AKIAIOSFODNN7EXAMPLE in prompt ❌Blocked before the API call is made ✅
Tool result contains user@email.comPII detected and blocked ✅
echo $API_KEY with live key ❌Env var value scanned and blocked ✅
  • Two hooksUserPromptSubmit and PreToolUse cover both directions of risk
  • 29 detection rules — sourced from gitleaks and TruffleHog detector definitions
  • 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

Quick Start

Install with two commands inside a Claude Code session:

bash
# 1. Register the marketplace
/plugin marketplace add coo-quack/sensitive-canary

# 2. Install the plugin
/plugin install sensitive-canary@coo-quack

After installation, restart Claude Code and the hooks are active. No additional configuration needed.

What Happens

Just use Claude Code as usual. sensitive-canary runs in the background and automatically scans at three points:

  • On prompt submission — checks your input for secrets and PII before it reaches the API
  • On file read — checks file names and contents before Claude reads them
  • On command execution — checks Bash commands and environment variable values for secrets

When sensitive data is detected, the action is blocked and the terminal shows what was found. To intentionally allow it, add [allow-secret] or [allow-all] to your prompt.

See installation guide → for manual setup options.

Detection Rules

CategoryExamples
Cloud credentialsAWS Access Key, GCP service account key
Source controlGitHub PAT, GitHub fine-grained token, GitLab PAT
AI servicesAnthropic API key, OpenAI API key / project key
CommunicationSlack token, Slack webhook, Discord webhook, Telegram bot token
PaymentStripe secret/restricted key, credit card numbers (Luhn-validated)
Email servicesSendGrid API key, Mailgun key, Mailchimp key
Auth tokensJWT, database connection strings
PIIEmail address, US SSN, US/JP phone, Japanese postal code, private IPv4

View all detection rules →

Released under the MIT License.