MANDATORY for security-sensitive code changes - OWASP-based security review with dedicated checklist, required before PR for auth, input handling, API, database, or credential code
Performs mandatory OWASP-based security reviews for authentication, input handling, API, database, or credential code changes before PRs. Triggered automatically when security-sensitive file patterns are modified.
/plugin marketplace add troykelly/claude-skills/plugin install issue-driven-development@troykelly-skillsThis skill is limited to using the following tools:
Dedicated security review for code handling authentication, authorization, user input, APIs, databases, or credentials.
Core principle: Security issues require specialized attention beyond general code review.
Trigger: This review is MANDATORY when changes touch security-sensitive paths.
Announce at start: "I'm performing a security review of this code."
This skill is MANDATORY when ANY of these files are modified:
| Pattern | Examples |
|---|---|
**/auth/** | src/auth/login.ts, lib/auth/session.js |
**/security/** | src/security/encryption.ts |
**/middleware/** | src/middleware/authenticate.ts |
**/api/** | src/api/endpoints.ts |
**/*password* | utils/passwordHash.ts |
**/*token* | services/tokenService.ts |
**/*secret* | config/secrets.ts |
**/*credential* | lib/credentials.js |
**/*session* | middleware/session.ts |
**/routes/** | src/routes/protected.ts |
**/*.sql | migrations/001_users.sql |
Check with:
git diff --name-only HEAD~1 | grep -E '(auth|security|middleware|api|password|token|secret|credential|session|routes|\.sql)'
Review against each category:
| Check | Verify |
|---|---|
| SQL Injection | All queries use parameterized statements |
| Command Injection | No user input in shell commands, or properly escaped |
| LDAP Injection | LDAP queries use proper escaping |
| XPath Injection | XPath queries use parameterized approach |
| Template Injection | Template engines configured safely |
// VULNERABLE
db.query(`SELECT * FROM users WHERE id = '${userId}'`);
// SECURE
db.query('SELECT * FROM users WHERE id = ?', [userId]);
| Check | Verify |
|---|---|
| Password Storage | Passwords hashed with bcrypt/argon2 (not MD5/SHA1) |
| Session Management | Secure, HttpOnly, SameSite cookies |
| Token Handling | JWTs signed, validated, short-lived |
| Brute Force Protection | Rate limiting on auth endpoints |
| Credential Exposure | No credentials in logs, errors, or responses |
| Check | Verify |
|---|---|
| Data in Transit | HTTPS enforced, TLS 1.2+ |
| Data at Rest | Sensitive data encrypted |
| Secrets in Code | No hardcoded API keys, passwords, tokens |
| Error Messages | No sensitive info in error responses |
| Logging | No sensitive data logged |
# Check for hardcoded secrets
grep -rE '(password|secret|api_key|token)\s*[:=]\s*["\047][^"\047]+["\047]' src/
| Check | Verify |
|---|---|
| XML Parsing | External entities disabled |
| DTD Processing | DTD processing disabled if not needed |
| Check | Verify |
|---|---|
| Authorization Checks | Every endpoint verifies permissions |
| Direct Object References | Object access validated against user |
| Privilege Escalation | Cannot elevate own privileges |
| CORS | Properly restricted origins |
| Method Restriction | Only allowed HTTP methods accepted |
| Check | Verify |
|---|---|
| Default Credentials | No default passwords in use |
| Error Handling | Stack traces not exposed to users |
| Security Headers | CSP, X-Frame-Options, etc. set |
| Debug Mode | Disabled in production |
| Unnecessary Features | Unused endpoints/features removed |
| Check | Verify |
|---|---|
| Output Encoding | User input encoded before display |
| DOM XSS | innerHTML not used with user input |
| Template Safety | Template engine auto-escapes |
| CSP | Content Security Policy configured |
// VULNERABLE
element.innerHTML = userInput;
// SECURE
element.textContent = userInput;
// OR
element.innerHTML = DOMPurify.sanitize(userInput);
| Check | Verify |
|---|---|
| Object Deserialization | Untrusted data not deserialized |
| JSON Parsing | Safe JSON.parse usage |
| Type Validation | Deserialized objects validated |
| Check | Verify |
|---|---|
| Dependency Audit | pnpm audit / pip audit clean |
| Outdated Packages | No critically outdated dependencies |
| CVE Check | No known CVEs in dependencies |
# Run dependency audit
pnpm audit --prod
# or
pip-audit
| Check | Verify |
|---|---|
| Auth Events | Login success/failure logged |
| Access Control | Permission denials logged |
| Input Validation | Validation failures logged |
| Sensitive Actions | Admin actions logged |
| Log Integrity | Logs protected from tampering |
# List changed files matching security patterns
git diff --name-only HEAD~1 | grep -E '(auth|security|middleware|api|password|token|secret|session)'
For each security-sensitive file:
# Audit dependencies
pnpm audit --prod
# Check for outdated
pnpm outdated
Use severity levels:
| Severity | Description | Action |
|---|---|---|
| CRITICAL | Exploitable vulnerability, data breach risk | MUST fix before merge |
| HIGH | Significant security weakness | MUST fix before merge |
| MEDIUM | Defense-in-depth issue | SHOULD fix before merge |
| LOW | Minor improvement | MAY fix in future issue |
Add to the main review artifact:
### Security Review
**Security-Sensitive:** YES
**Reviewed By:** [WORKER_ID or security-reviewer subagent]
**OWASP Categories Checked:** 10/10
#### Security Findings
| # | OWASP Category | Severity | Finding | Status |
|---|----------------|----------|---------|--------|
| 1 | A03 Injection | CRITICAL | SQL injection in findUser() | FIXED |
| 2 | A02 Sensitive Data | HIGH | API key in config.ts | DEFERRED #456 |
| 3 | A01 Access Control | MEDIUM | Missing auth on /admin | FIXED |
#### Dependency Audit
pnpm audit: 0 vulnerabilities
**Security Review Status:** [PASS|ISSUES_FIXED|ISSUES_DEFERRED]
If security review is extensive, post as separate comment:
<!-- SECURITY_REVIEW:START -->
## Security Review
| Property | Value |
|----------|-------|
| Issue | #123 |
| Reviewer | `security-reviewer` subagent |
| Reviewed | 2025-12-29T10:30:00Z |
### Files Reviewed
- src/auth/login.ts
- src/middleware/authenticate.ts
- src/api/users.ts
### OWASP Checklist Results
| # | Category | Status | Notes |
|---|----------|--------|-------|
| A01 | Broken Access Control | PASS | Auth middleware on all protected routes |
| A02 | Cryptographic Failures | PASS | bcrypt for passwords, TLS enforced |
| A03 | Injection | FIXED | Parameterized SQL queries now |
| A04 | Insecure Design | PASS | - |
| A05 | Security Misconfiguration | PASS | - |
| A06 | Vulnerable Components | PASS | pnpm audit clean |
| A07 | Auth Failures | PASS | Rate limiting, secure sessions |
| A08 | Data Integrity Failures | PASS | - |
| A09 | Logging Failures | NOTE | Consider adding auth failure logging |
| A10 | SSRF | N/A | No server-side requests |
### Dependency Audit
found 0 vulnerabilities
**Security Review Status:** PASS
<!-- SECURITY_REVIEW:END -->
Before completing security review:
This skill is triggered by:
security-reviewer subagentThis skill integrates with:
comprehensive-review - Security is criterion #4review-gate - Verifies security review for sensitive changesThis skill is enforced by:
.claude/rules/security-sensitive.md conditional rulesPreToolUse hook (PR blocked if security-sensitive without review)This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.