askill
security-scrubbing

security-scrubbingSafety 100Repository

Use when discussing code security, secret management, credential leaks, API key handling, LLM provider keys, PII protection, git history cleaning, or file permissions auditing.

0 stars
1.2k downloads
Updated 1/4/2026

Package Files

Loading files...
SKILL.md

Security Scrubbing Knowledge

LLM Provider API Keys

Key Patterns by Provider

ProviderPatternEnvironment Variable
OpenAIsk-..., sk-proj-..., sk-svcacct-...OPENAI_API_KEY
Anthropicsk-ant-...ANTHROPIC_API_KEY
Google AIAIza[0-9A-Za-z-_]{35}GOOGLE_API_KEY, GEMINI_API_KEY
Cohere40-char alphanumericCOHERE_API_KEY
Mistral32-char alphanumericMISTRAL_API_KEY
Groqgsk_...GROQ_API_KEY
Perplexitypplx-...PERPLEXITY_API_KEY
Hugging Facehf_...HF_TOKEN, HUGGINGFACE_API_KEY
Replicater8_...REPLICATE_API_TOKEN
Together AI64-char hexTOGETHER_API_KEY
xAI (Grok)variesXAI_API_KEY

Secure API Key Usage

Never do this:

# BAD - hardcoded key
client = OpenAI(api_key="sk-abc123...")

Do this instead:

# GOOD - environment variable
import os
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

Or use dotenv:

from dotenv import load_dotenv
load_dotenv()  # Loads from .env file
client = OpenAI()  # Auto-reads OPENAI_API_KEY

Other Common Secret Patterns

ServicePatternExample
AWS Access KeyAKIA[0-9A-Z]{16}AKIAIOSFODNN7EXAMPLE
AWS Secret Key40 char base64wJalrXUtnFEMI/K7MDENG...
GitHub Tokenghp_[a-zA-Z0-9]{36}ghp_xxxx...
GitHub PATgithub_pat_[0-9a-zA-Z_]{82}github_pat_...
GitLab Tokenglpat-[0-9a-zA-Z-]{20}glpat-xxxx...
Stripe Livesk_live_[a-zA-Z0-9]{24}sk_live_...
Stripe Testsk_test_[a-zA-Z0-9]{24}sk_test_...
Slack Tokenxox[baprs]-...xoxb-...
Slack Webhookhttps://hooks.slack.com/...webhook URL
TwilioSK[0-9a-fA-F]{32}SK...
SendGridSG.[a-zA-Z0-9]{22}.[a-zA-Z0-9]{43}SG....
Discord Bot[MN][A-Za-z0-9]{23,}...Bot token
FirebaseAAAA[A-Za-z0-9_-]{7}:...FCM key
Supabasesbp_[a-f0-9]{40}sbp_...
JWTeyJ... (3 base64 segments)eyJhbGc...
Private Key-----BEGIN...PRIVATE KEY-----PEM format

Credential Guard

The scrub plugin includes a PreToolUse hook that blocks Claude from reading files containing credentials.

How It Works

  1. Hook intercepts Read operations
  2. Scans target file for 40+ credential patterns
  3. Blocks read if secrets detected
  4. Allows if file is in allowlist

Allowlist

Add trusted files to ~/.claude/plugins/scrub/.guard-allowlist:

# Allow test fixtures
tests/fixtures/
*.test.js
.env.example

Commands

/scrub:guard status      # Check if enabled
/scrub:guard on          # Enable guard
/scrub:guard off         # Disable guard
/scrub:guard allowlist   # Manage allowlist

Where Secrets Hide

  1. Configuration files: .env, config.js, settings.py
  2. Test files: Hardcoded test credentials
  3. Git history: Removed from HEAD but still in commits
  4. Logs: Accidentally logged tokens
  5. Comments: "Temporary" credentials
  6. CI/CD files: .github/workflows/, Jenkinsfile
  7. Notebooks: Jupyter notebooks with inline keys
  8. Docker files: Dockerfile, docker-compose.yml

PII Categories

Identifiable Data

  • Direct identifiers: Name, SSN, passport number
  • Contact info: Email, phone, address
  • Network info: IP address, MAC address
  • Financial: Credit card, bank account
  • Biometric: Fingerprints, face data

Log Sanitization

Before sharing logs:

  1. Remove IP addresses
  2. Redact email addresses
  3. Mask user IDs
  4. Strip session tokens
  5. Remove query parameters with PII

Git History Security

When to Scrub History

  • Accidentally committed credentials
  • Pushed .env file
  • Included private keys
  • Added database dumps with PII

Tools

  • git-filter-repo (recommended): Fast, safe, feature-rich
  • git filter-branch: Built-in but slower
  • BFG Repo Cleaner: Java-based, good for large repos

Post-Scrub Checklist

  1. Force push all branches
  2. Delete all tags and recreate
  3. Notify all collaborators
  4. Rotate ALL exposed credentials
  5. Clear CI/CD caches
  6. GitHub: Contact support to clear caches

File Permissions

Secure Defaults

File TypeRecommendedWhy
Private keys600Owner only
.env files600Contains secrets
Scripts755Execute for all, write for owner
Config files644Read for all, write for owner
Directories755Standard access

Dangerous Permissions

  • World-writable (o+w): Anyone can modify
  • World-readable keys: Credentials exposed
  • SetUID on scripts: Privilege escalation risk

.gitignore Security

Must-Have Entries

# Environment
.env
.env.*
.env.local

# Keys and certificates
*.pem
*.key
*.p12
*.pfx
*.keystore
id_rsa
id_ed25519

# Credentials
credentials.json
secrets.json
*secret*
*credential*

# Logs
*.log
logs/

Best Practices

  1. Never commit secrets - Use environment variables
  2. Use credential guard - Block secrets from reaching AI
  3. Pre-commit hooks - Scan before commit
  4. Least privilege - Minimal file permissions
  5. Rotate regularly - Even if not leaked
  6. Audit trails - Know who accessed what
  7. Defense in depth - Multiple protection layers
  8. .env.example - Document required vars without values

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

92/100Analyzed 2/12/2026

An exceptional security reference providing comprehensive patterns for secret detection, actionable remediation steps, and best practices for PII and git history management.

100
95
85
95
90

Metadata

Licenseunknown
Version-
Updated1/4/2026
Publisheriamfiscus

Tags

apici-cddatabasegithubgithub-actionsllmsecuritytesting