Security vulnerability detection and review. Use when implementing authentication, handling user input, creating APIs, managing secrets, or implementing payment features.
Systematically review code for security vulnerabilities based on OWASP Top 10.
Use this skill when:
# List relevant source files
find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.py" \) \
-not -path "*/node_modules/*" -not -path "*/.git/*" | head -50
# Check for env files and gitignore
ls -la .env* 2>/dev/null || true
grep -E "(env|secret|key)" .gitignore 2>/dev/null || true
# Search for hardcoded secrets
grep -rn --include="*.ts" --include="*.js" --include="*.py" \
-E "(password|secret|token|api_key|private_key)\s*[=:]\s*['\"][^'\"]+['\"]" . \
--exclude-dir={node_modules,.git,dist,build}
# SQL string concatenation
grep -rn --include="*.ts" --include="*.js" --include="*.py" \
-E "(SELECT|INSERT|UPDATE|DELETE).*\+" . \
--exclude-dir={node_modules,.git,dist,build}
# Command injection patterns
grep -rn --include="*.ts" --include="*.js" --include="*.py" \
-E "(exec|spawn|system|eval)\(" . \
--exclude-dir={node_modules,.git,dist,build}
# Find auth-related files
find . -type f \( -name "*auth*" -o -name "*login*" -o -name "*session*" \) \
-not -path "*/node_modules/*"
# Token storage in localStorage (XSS vulnerable)
grep -rn --include="*.ts" --include="*.tsx" --include="*.js" \
-E "localStorage\.(set|get)Item.*token" . \
--exclude-dir={node_modules,.git,dist,build}
# npm/yarn
npm audit --json 2>/dev/null || yarn audit --json 2>/dev/null || true
# Python
pip-audit 2>/dev/null || safety check 2>/dev/null || true
import { z } from 'zod'
const CreateUserSchema = z.object({
email: z.string().email(),
name: z.string().min(1).max(100),
age: z.number().int().min(0).max(150),
})
const validated = CreateUserSchema.parse(input)
from pydantic import BaseModel, EmailStr, conint, constr
class CreateUserRequest(BaseModel):
email: EmailStr
name: constr(min_length=1, max_length=100)
age: conint(ge=0, le=150)
[SEVERITY] Vulnerability title
File: path/to/file.ext:line
Category: OWASP category (e.g., A03:Injection)
Issue: Description of the vulnerability
Risk: Potential impact if exploited
Fix: Remediation steps
<vulnerable code> // BAD
<secure code> // GOOD
For security standards and detection patterns, see ~/.claude/rules/security.md.