/everything-copilot-cli:secret-detectionfrom everything-copilot-cli
Scans source code and git history for hardcoded API keys, tokens, passwords, and private keys. Guides safe credential rotation and removal without breaking integrations.
Ships in everything-copilot-cli. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
# AWS Access Keys
grep -rn "AKIA[0-9A-Z]{16}" . --include="*.ts" --include="*.js" --include="*.py" --include="*.json"
# GitHub tokens
grep -rn "ghp_[a-zA-Z0-9]{36}\|github_pat_[a-zA-Z0-9_]{82}" .
# Generic API keys and secrets
grep -rni "api[_-]?key\s*[:=]\s*['\"][a-zA-Z0-9]" src/ --include="*.ts" --include="*.js"
# Private keys
grep -rn "BEGIN.*PRIVATE KEY" .
# Connection strings with credentials
grep -rni "mongodb\+srv://\|postgres://\|mysql://" . | grep -v "localhost\|example\|template"
# JWT secrets and signing keys
grep -rni "jwt[_]?secret\|signing[_]?key" src/ --include="*.ts" | grep -v "process\.env\|config\."
# Find committed secret files
git --no-pager ls-files | Select-String "\.pem$|\.key$|\.p12$|\.pfx$|id_rsa|\.env$"
# Check .gitignore covers sensitive patterns
Get-Content .gitignore 2>$null | Select-String "\.env|\.pem|\.key|secret"
Secrets removed from code may still exist in git history:
# Search recent commits for secret patterns
git --no-pager log --all -p --since="6 months ago" -S "AKIA" --oneline | Select-Object -First 20
# Search for common secret keywords in diffs
git --no-pager log --all -p -S "api_key" --oneline | Select-Object -First 20
Step 1: Rotate the credential immediately Any secret found in source code should be considered compromised.
Revoking a key that services still use causes an outage, so rotate in this order when the provider allows two valid credentials at once:
401), and
requests with the new one still succeedAn exposed credential is already compromised, so the overlap exists only to move consumers, not to keep the old key as a fallback. Keep the overlap as short as the switch takes; if a consumer fails, fix it forward with the new credential rather than pointing it back at the exposed one. Rolling back to the old credential is acceptable only in a routine rotation where nothing was exposed. If the key is being actively abused, revoke it now. If the provider allows only one valid credential, the service owner and whoever leads the incident decide — from the key's permissions, how widely it was exposed, and the cost of downtime — between immediate revocation, reducing the key's permissions first, or a short planned cutover, and record that decision.
Step 2: Replace with environment variables
// BEFORE — hardcoded secret
const apiKey = 'sk-abc123def456';
// AFTER — environment variable
const apiKey = process.env.API_KEY;
if (!apiKey) throw new Error('API_KEY environment variable is required');
Step 3: Add to .env.example (without values)
# .env.example
API_KEY=
DATABASE_URL=
JWT_SECRET=
Step 4: Update .gitignore
# Ensure .env is ignored
echo ".env" >> .gitignore
echo ".env.local" >> .gitignore
echo "*.pem" >> .gitignore
echo "*.key" >> .gitignore
# Add a pre-commit check (example with grep)
# Create a simple pre-commit hook
#!/bin/sh
# .git/hooks/pre-commit
# --text: without it, files git treats as binary (a NUL byte, a -diff attribute) show only
# "Binary files differ" and a token inside them passes unchecked. UTF-16 text still will not
# match these ASCII patterns, so keep a dedicated scanner (gitleaks, trufflehog) in CI too.
if git diff --cached --text | grep -qaiE "AKIA[0-9A-Z]{16}|ghp_[a-zA-Z0-9]{36}|BEGIN.*PRIVATE KEY"; then
echo "ERROR: Potential secret detected in staged changes. Aborting commit."
exit 1
fi
# Run all pattern checks and summarize
$patterns = @(
"AKIA[0-9A-Z]{16}",
"ghp_[a-zA-Z0-9]{36}",
"BEGIN.*PRIVATE KEY",
"password\s*=\s*['\"][^'\"]+['\"]"
)
foreach ($p in $patterns) {
$matches = grep -rn $p src/ --include="*.ts" --include="*.js" 2>$null
if ($matches) { Write-Host "FOUND: $p"; $matches }
}
# 1. Find all hardcoded values
grep -rn "const.*secret\|const.*key\|const.*password" src/ --include="*.ts" | grep -v "process.env"
# 2. For each finding, edit the file to use process.env
# 3. Add the variable to .env.example
# 4. Add the actual value to your deployment's environment config
explore agent to trace how a secret is used before replacing it with env varsgit filter-repo (destructive, requires coordination).env files on serversWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub drvoss/everything-copilot-cli --plugin everything-copilot-cli115 skills in this plugin
/actions-debuggingUse when a GitHub Actions workflow fails — diagnose the run log, identify the root cause, and apply a targeted fix/add-to-changelogUse when you've shipped a feature, fix, or breaking change and need to update CHANGELOG.md — follows Keep a Changelog format and syncs version numbers across package manifests./agent-governanceUse when designing or reviewing an AI agent system that needs policy-based access controls, intent classification, tool-level rate limiting, trust scoring for multi-agent workflows, or append-only audit trails.
Other plugins' skills for the same job