--- name: security-audit description: "Comprehensive security audit with scored posture assessment" --- # Security Audit Comprehensive security audit of your project AND Claude Code configuration. Analyzes secrets exposure, injection surfaces, dependencies, hook security, and produces a scored security posture assessment. **Time**: 2-5 minutes | **Scope**: Full project + Claude Code config > For a quick config-only check, use `/security-check` instead. ## Instructions You are a senior application security engineer. Perform a 6-phase security audit and produce a scored report with prioritized remediation plan. --- ### Phase 1: Configuration Security (via /security-check) Execute all checks from `/security-check` (the `examples/commands/security-check.md` command). This covers: - MCP server audit against CVE database - Skills & agents against known malicious entries - Hook exfiltration patterns - Memory poisoning detection - Permissions & settings review - Exposed secrets in Claude Code config Record findings — they contribute to the final score. --- ### Phase 2: Project Secrets Scan Scan the entire project for exposed secrets and credentials: ```bash # API keys and tokens grep -rn --include="*.{js,ts,py,go,java,rb,php,yaml,yml,json,toml,env,cfg,ini,conf}" \ -E '(?i)(api[_-]?key|apikey|secret|password|passwd|token|bearer|auth)\s*[=:]\s*["'\''"][^"'\'']{8,}["'\''"]\s' \ --exclude-dir={node_modules,vendor,.git,dist,build,target,__pycache__,.venv} . 2>/dev/null | head -30 # Known provider key patterns grep -rn -E 'sk-[a-zA-Z0-9]{20,}|sk-ant-[a-zA-Z0-9]{20,}|ghp_[a-zA-Z0-9]{36}|AKIA[A-Z0-9]{16}|xox[bps]-[a-zA-Z0-9\-]{20,}' \ --exclude-dir={node_modules,vendor,.git,dist,build,target} . 2>/dev/null | head -20 # Private keys grep -rn 'BEGIN.*PRIVATE KEY' --exclude-dir={node_modules,vendor,.git} . 2>/dev/null # .env files that might be committed find . -name ".env*" -not -path "*/node_modules/*" -not -path "*/.git/*" -type f 2>/dev/null # Check .gitignore coverage [ -f ".gitignore" ] && { grep -q "\.env" .gitignore && echo "✅ .env in .gitignore" || echo "⚠️ .env NOT in .gitignore" grep -q "\.pem" .gitignore && echo "✅ .pem in .gitignore" || echo "⚠️ .pem NOT in .gitignore" grep -q "\.key" .gitignore && echo "✅ .key in .gitignore" || echo "⚠️ .key NOT in .gitignore" } ``` **Scoring:** - 0 secrets found → +20 points - 1-3 secrets → +10 points - 4+ secrets → 0 points - Private key committed → -10 points --- ### Phase 3: Prompt Injection Surface Analyze markdown and config files for injection vectors: ```bash # Zero-width characters (invisible instructions) grep -rPn '[\x{200B}-\x{200D}\x{FEFF}]' --include="*.md" --include="*.yaml" --include="*.json" . 2>/dev/null # Hidden HTML comments with instructions grep -rn '