Jeffallan/claude-skills / skills/security-reviewer
security-reviewer
FlaggedIdentifies security vulnerabilities, generates structured audit reports with severity ratings, and provides actionable remediation guidance. Use when conducting security audits, reviewing code for vulnerabilities, or analyzing infrastructure security. Invoke for SAST scans, penetration testing, DevSecOps practices, cloud security reviews, dependency audits, secrets scanning, or compliance checks. Produces vulnerability reports, prioritized recommendations, and compliance checklists.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.9 KB |
| references/infrastructure-security.md | markdown | 5.8 KB |
| references/penetration-testing.md | markdown | 5.8 KB |
| references/report-template.md | markdown | 3.7 KB |
| references/sast-tools.md | markdown | 2.4 KB |
| references/secret-scanning.md | markdown | 2.9 KB |
| references/vulnerability-patterns.md | markdown | 3.8 KB |
references/vulnerability-patterns.md
View on GitHub# Vulnerability Patterns
## SQL Injection
```typescript
// VULNERABLE
const query = `SELECT * FROM users WHERE id = ${userId}`;
const query = `SELECT * FROM users WHERE name = '${name}'`;
// SECURE - Parameterized queries
const query = 'SELECT * FROM users WHERE id = $1';
db.query(query, [userId]);
// SECURE - ORM
const user = await User.findOne({ where: { id: userId } });
```
## XSS (Cross-Site Scripting)
```typescript
// VULNERABLE - Direct HTML injection
element.innerHTML = userInput;
document.write(userInput);
// SECURE - Text content
element.textContent = userInput;
// SECURE - Sanitization
import DOMPurify from 'dompurify';
element.innerHTML = DOMPurify.sanitize(userInput);
// SECURE - React (auto-escaped)
return <div>{userInput}</div>;
// VULNERABLE - React dangerouslySetInnerHTML
return <div dangerouslySetInnerHTML={{ __html: userInput }} />;
```
## Path Traversal
```typescript
// VULNERABLE
const file = path.join(uploadDir, req.query.filename);
res.sendFile(file);
// SECURE - Validate and normalize
const filename = path.basename(req.query.filename);
const file = path.resolve(uploadDir, filename);
if (!file.startsWith(path.resolve(uploadDir))) {
throw new Error('Invalid path');
}
res.sendFile(file);
```
## Command Injection
```typescript
// VULNERABLE
exec(`ls ${userInput}`);
exec('git clone ' + repoUrl);
// SECURE - Use arrays, avoid shell
execFile('ls', [userInput]);
spawn('git', ['clone', repoUrl]);
// SECURE - Validation
const allowedCommands = ['status', 'log'];
if (!allowedCommands.includes(cmd)) throw new Error('Invalid');
```
## IDOR (Insecure Direct Object Reference)
```typescript
// VULNERABLE - No authorization check
app.get('/documents/:id', async (req, res) => {
const doc = await Document.findById(req.params.id);
res.json(doc);
});
// SECURE - Verify ownership
app.get('/documents/:id', async (req, res) => {
const doc = await Document.findOne({
_id: req.params.id,
userId: req.user.id // Ensure user owns document
});
if (!doc) return res.status(404).json({ error: 'Not found' });
res.json(doc);
});
```
## Insecure Deserialization
```typescript
// VULNERABLE - Python pickle
import pickle
data = pickle.loads(user_input)
// SECURE - Use JSON
import json
data = json.loads(user_input)
// VULNERABLE - Node.js
const obj = eval('(' + userInput + ')');
// SECURE
const obj = JSON.parse(userInput);
```
## Sensitive Data Exposure
```typescript
// VULNERABLE - Logging sensitive data
logger.info('User login', { email, password });
console.log('Token:', authToken);
// SECURE - Redact sensitive fields
logger.info('User login', { email, password: '[REDACTED]' });
// VULNERABLE - Error response exposes internals
res.status(500).json({ error: err.stack });
// SECURE - Generic error
res.status(500).json({ error: 'Internal server error' });
```
## Quick Reference
| Vulnerability | Input Vector | Prevention |
|---------------|--------------|------------|
| SQL Injection | Query params | Parameterized queries |
| XSS | User content | Output encoding |
| Path Traversal | File paths | path.basename + validation |
| Command Injection | Shell args | execFile, no shell |
| IDOR | Resource IDs | Authorization checks |
| Deserialization | Serialized data | JSON only |
| Data Exposure | Logs, errors | Redaction, generic errors |
## OWASP Top 10 Mapping
| OWASP | Vulnerabilities |
|-------|-----------------|
| A01 Broken Access Control | IDOR, path traversal |
| A02 Cryptographic Failures | Weak encryption, plaintext |
| A03 Injection | SQL, XSS, command |
| A04 Insecure Design | Missing auth, IDOR |
| A05 Security Misconfiguration | Debug mode, default creds |
| A06 Vulnerable Components | Outdated dependencies |
| A07 Auth Failures | Weak passwords, session issues |
| A08 Data Integrity | Insecure deserialization |
| A09 Logging Failures | Missing logs, exposed data |
| A10 SSRF | Unvalidated URLs |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |