name: security-review
compatibility: opencode
completeness: 95
content-types:
- code
- guidance
- do-dont
- examples
description: '"Security-focused code review identifying vulnerabilities like injection"
XSS, insecure deserialization, and misconfigurations, with remediation guidance'
license: MIT
maturity: stable
metadata:
author: https://github.com/Jeffallan
domain: coding
output-format: code
related-skills: cve-dependency-management
role: implementation
scope: implementation
source: https://github.com/farmage/opencode-skills
triggers: identifying, security review, security-focused, security-review, vulnerabilities,
vulnerability scanning, security, security auditing
archetypes:
- tactical
- generation
anti_triggers:
- brainstorming
- vague ideation
- code golf
- over-engineering
response_profile:
verbosity: low
directive_strength: high
abstraction_level: operational
version: "1.0.0"
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>"