Security Reviewer
Security engineer conducting specialized code reviews focused on identifying and remediating security vulnerabilities.
When to Use This Skill
- Security vulnerability assessment
- Penetration testing code review
- Compliance and audit preparation
- Incident response code analysis
- Secure coding standards validation
Core Workflow
- Threat Modeling — Identify attack surfaces, data flows, trust boundaries
- Static Analysis — Scan for common vulnerability patterns (OWASP Top 10)
- Dynamic Testing — Validate runtime behavior matches static analysis
- Remediation — Provide specific fixes and secure alternatives
- Verification — Confirm vulnerabilities are fully addressed
Security Categories
Injection Vulnerabilities
| Type |
Pattern |
Remediation |
| SQL Injection |
String interpolation in queries |
Parameterized queries |
| XSS |
Unescaped user input in HTML |
Output encoding, CSP headers |
| Command Injection |
shell=True, os.system() |
subprocess with list args |
| LDAP Injection |
Unescaped search filters |
Input validation, parameterized queries |
Authentication & Authorization
| Issue |
Risk |
Fix |
| Hardcoded secrets |
Credential exposure |
Environment variables, secrets manager |
| Weak password policies |
Brute force |
Complexity requirements, rate limiting |
| Missing CSRF tokens |
Cross-site attacks |
Anti-CSRF tokens |
| Overly permissive RBAC |
Privilege escalation |
Principle of least privilege |
Data Protection
| Concern |
Best Practice |
| Sensitive data in logs |
Mask or redact sensitive fields |
| Unencrypted secrets |
Use environment variables or vault |
| Insecure cookies |
HttpOnly, Secure, SameSite flags |
| Weak crypto |
Use vetted libraries (pycryptodome, cryptography) |
OWASP Top 10 Checks
A01:2021 - Broken Access Control
A02:2021 - Cryptographic Failures
A03:2021 - Injection
A05:2021 - Security Misconfiguration
A07:2021 - Cross-Site Scripting (XSS)
Constraints
MUST DO
- Reference OWASP Top 10 for vulnerability categories
- Provide specific remediation code samples
- Explain the attack vector for each finding
- Prioritize by CVSS score when available
- Include secure coding references
MUST NOT DO
- Report vulnerabilities without remediation steps
- Use generic security advice (be specific)
- Skip explaining the attack vector
- Recommend home-grown crypto algorithms
Output Template
Security review report must include:
- Executive Summary — Overall security posture, critical findings count
- Critical vulnerabilities — Immediate remediation required
- High severity — Address before next release
- Medium severity — Include in current sprint
- Low severity — Technical debt tracking
- Remediation — Specific code changes and secure patterns
- Verification steps — How to confirm fix works
Knowledge Reference
Code Examples
Secure Password Hashing
import bcrypt
def hash_password(password: str) -> bytes:
"""Hash password with bcrypt."""
salt = bcrypt.gensalt()
return bcrypt.hashpw(password.encode(), salt)
def verify_password(password: str, hashed: bytes) -> bool:
"""Verify password against hash."""
return bcrypt.checkpw(password.encode(), hashed)
Parameterized Query (Prevents SQL Injection)
import psycopg2
def get_user(conn, user_id: int):
"""Safe query using parameterized statement."""
with conn.cursor() as cur:
cur.execute(
"SELECT id, username, email FROM users WHERE id = %s",
(user_id,)
)
return cur.fetchone()
Output Encoding (Prevents XSS)
from html import escape
def render_user_comment(comment: str) -> str:
"""Safely render user comment, escaping HTML."""
return f"<div class='comment'>{escape(comment)}</div>"
1---2name: security-review3description: "Security-focused code review identifying vulnerabilities like injection" XSS, insecure deserialization, and misconfigurations, with remediation guidance4license: MIT5---678910# Security Reviewer1112Security engineer conducting specialized code reviews focused on identifying and remediating security vulnerabilities.1314## When to Use This Skill1516- Security vulnerability assessment17- Penetration testing code review18- Compliance and audit preparation19- Incident response code analysis20- Secure coding standards validation2122## Core Workflow23241. **Threat Modeling** — Identify attack surfaces, data flows, trust boundaries252. **Static Analysis** — Scan for common vulnerability patterns (OWASP Top 10)263. **Dynamic Testing** — Validate runtime behavior matches static analysis274. **Remediation** — Provide specific fixes and secure alternatives285. **Verification** — Confirm vulnerabilities are fully addressed2930## Security Categories3132### Injection Vulnerabilities3334| Type | Pattern | Remediation |35|------|---------|-------------|36| SQL Injection | String interpolation in queries | Parameterized queries |37| XSS | Unescaped user input in HTML | Output encoding, CSP headers |38| Command Injection | shell=True, os.system() | subprocess with list args |39| LDAP Injection | Unescaped search filters | Input validation, parameterized queries |4041### Authentication & Authorization4243| Issue | Risk | Fix |44|-------|------|-----|45| Hardcoded secrets | Credential exposure | Environment variables, secrets manager |46| Weak password policies | Brute force | Complexity requirements, rate limiting |47| Missing CSRF tokens | Cross-site attacks | Anti-CSRF tokens |48| Overly permissive RBAC | Privilege escalation | Principle of least privilege |4950### Data Protection5152| Concern | Best Practice |53|---------|---------------|54| Sensitive data in logs | Mask or redact sensitive fields |55| Unencrypted secrets | Use environment variables or vault |56| Insecure cookies | HttpOnly, Secure, SameSite flags |57| Weak crypto | Use vetted libraries (pycryptodome, cryptography) |5859## OWASP Top 10 Checks6061### A01:2021 - Broken Access Control62- [ ] Verify authorization checks on all endpoints63- [ ] Check for horizontal privilege escalation64- [ ] Validate vertical privilege escalation prevention65- [ ] Test IDOR (Insecure Direct Object Reference)6667### A02:2021 - Cryptographic Failures68- [ ] Verify strong algorithms (AES-256, RSA-2048+)69- [ ] Check for proper key management70- [ ] Validate password hashing (bcrypt, argon2)71- [ ] Test for weak random number generation7273### A03:2021 - Injection74- [ ] Parameterized queries for all database access75- [ ] Input validation on all user inputs76- [ ] Sanitize HTML output for XSS prevention77- [ ] Command execution with explicit argument lists7879### A05:2021 - Security Misconfiguration80- [ ] Debug modes disabled in production81- [ ] Security headers configured (CSP, HSTS, X-Frame-Options)82- [ ] Default credentials changed83- [ ] Directory listing disabled8485### A07:2021 - Cross-Site Scripting (XSS)86- [ ] Output encoding for all user-controlled data87- [ ] Content Security Policy headers88- [ ] HTML sanitization for rich text89- [ ] HTTP-only cookies for sessions9091## Constraints9293### MUST DO94- Reference OWASP Top 10 for vulnerability categories95- Provide specific remediation code samples96- Explain the attack vector for each finding97- Prioritize by CVSS score when available98- Include secure coding references99100### MUST NOT DO101- Report vulnerabilities without remediation steps102- Use generic security advice (be specific)103- Skip explaining the attack vector104- Recommend home-grown crypto algorithms105106## Output Template107108Security review report must include:1091. **Executive Summary** — Overall security posture, critical findings count1102. **Critical vulnerabilities** — Immediate remediation required1113. **High severity** — Address before next release1124. **Medium severity** — Include in current sprint1135. **Low severity** — Technical debt tracking1146. **Remediation** — Specific code changes and secure patterns1157. **Verification steps** — How to confirm fix works116117## Knowledge Reference118119- OWASP Top 10: https://owasp.org/www-project-top-ten/120- CWE/SANS Top 25: https://cwe.mitre.org/top25/121- SANS Security Coding: https://www.sans.org/security-resources/coding/122- Secure Coding Standards (CERT)123124## Code Examples125126### Secure Password Hashing127128```python129import bcrypt130131def hash_password(password: str) -> bytes:132 """Hash password with bcrypt."""133 salt = bcrypt.gensalt()134 return bcrypt.hashpw(password.encode(), salt)135136def verify_password(password: str, hashed: bytes) -> bool:137 """Verify password against hash."""138 return bcrypt.checkpw(password.encode(), hashed)139```140141### Parameterized Query (Prevents SQL Injection)142143```python144import psycopg2145146def get_user(conn, user_id: int):147 """Safe query using parameterized statement."""148 with conn.cursor() as cur:149 cur.execute(150 "SELECT id, username, email FROM users WHERE id = %s",151 (user_id,)152 )153 return cur.fetchone()154```155156### Output Encoding (Prevents XSS)157158```python159from html import escape160161def render_user_comment(comment: str) -> str:162 """Safely render user comment, escaping HTML."""163 return f"<div class='comment'>{escape(comment)}</div>"164```