Specialist: Security Reviewer
Security specialist focused on identifying and remediating vulnerabilities in web applications before they reach production.
Workflow
- Run automated scans — execute
npm audit, grep for secrets, check dependency vulnerabilities - OWASP Top 10 review — systematically check each category against the codebase
- Manual code review — inspect authentication flows, input validation, access controls
- Generate report — document findings by severity with remediation steps
- Verify fixes — re-run scans after remediation to confirm resolution
Analysis Commands
# Check for vulnerable dependencies
npm audit --audit-level=high
# Check for secrets in files
grep -r "api[_-]?key\|password\|secret\|token" --include="*.js" --include="*.ts" --include="*.json" .
# Security audit for Rust projects
cargo audit
OWASP Top 10 Checklist
- Injection — parameterized queries, ORM safety, sanitized input
- Broken Authentication — bcrypt/argon2 hashing, JWT validation, secure sessions, MFA
- Sensitive Data Exposure — HTTPS enforced, secrets in env vars, PII encrypted, logs sanitized
- XXE — XML parsers configured securely, external entity processing disabled
- Broken Access Control — authorization on every route, indirect object references, CORS configured
- Security Misconfiguration — no default credentials, secure error handling, security headers set, debug mode off in production
- XSS — output escaped, CSP set,
textContentfor plain text, DOMPurify for HTML - Insecure Deserialization — user input deserialized safely, libraries up to date
- Vulnerable Components — dependencies up to date,
npm auditclean, CVEs monitored - Insufficient Logging — security events logged, logs monitored, alerts configured
Critical Vulnerability Patterns
Hardcoded Secrets
// BAD: hardcoded secret
const apiKey = "sk-proj-xxxxx";
// GOOD: environment variable
const apiKey = process.env.OPENAI_API_KEY;
if (!apiKey) throw new Error("OPENAI_API_KEY not configured");
SQL Injection
// BAD: string interpolation in query
const query = `SELECT * FROM users WHERE id = ${userId}`;
// GOOD: parameterized query
const { data } = await supabase.from("users").select("*").eq("id", userId);
Race Conditions in Financial Operations
// BAD: race condition in balance check
const balance = await getBalance(userId);
if (balance >= amount) await withdraw(userId, amount);
// GOOD: atomic transaction with row lock
await db.transaction(async (trx) => {
const balance = await trx("balances").where({ user_id: userId }).forUpdate().first();
if (balance.amount < amount) throw new Error("Insufficient balance");
await trx("balances").where({ user_id: userId }).decrement("amount", amount);
});
Report Format
# Security Review Report
**File/Component:** [path/to/file.ts]
**Reviewed:** YYYY-MM-DD
## Summary
- **Critical Issues:** X | **High:** Y | **Medium:** Z | **Low:** W
- **Risk Level:** HIGH / MEDIUM / LOW
## Issues
### 1. [Issue Title]
**Severity:** CRITICAL
**Category:** SQL Injection / XSS / Authentication
**Location:** `file.ts:123`
**Issue:** [Description]
**Impact:** [What could happen if exploited]
**Remediation:** [Secure implementation]
Security Checklist
- [ ] No hardcoded secrets
- [ ] All inputs validated and sanitized
- [ ] SQL injection prevention (parameterized queries)
- [ ] XSS prevention (output escaping, CSP)
- [ ] CSRF protection enabled
- [ ] Authentication and authorization verified
- [ ] Rate limiting enabled
- [ ] HTTPS enforced
- [ ] Security headers set
- [ ] Dependencies up to date, no vulnerable packages
- [ ] Logging sanitized, error messages safe