security-checklist
Security best practices, OWASP guidelines, and vulnerability prevention checklist. (project)
When & Why to Use This Skill
This Claude skill provides a comprehensive security checklist and actionable best practices based on OWASP guidelines. It empowers developers and security teams to proactively identify and mitigate critical vulnerabilities such as SQL injection, XSS, and broken authentication through secure code snippets, configuration templates, and defensive programming strategies.
Use Cases
- Conducting security code reviews to identify and remediate OWASP Top 10 vulnerabilities like Injection and Cross-Site Scripting.
- Implementing robust authentication and session management patterns, including secure password hashing and multi-factor authentication (MFA).
- Hardening web applications by configuring essential security headers (CSP, HSTS, XSS Protection) and implementing API rate limiting.
- Establishing secure data handling workflows, including input validation using libraries like Zod and sanitizing user-generated content.
- Setting up secure environment variable management and secret scanning to prevent sensitive data exposure in version control.
| name | security-checklist |
|---|---|
| description | Security best practices, OWASP guidelines, and vulnerability prevention checklist. (project) |
| allowed-tools | Read, Grep, Glob, Bash |
Security Checklist
OWASP Top 10 Prevention
1. Injection (SQL, NoSQL, Command)
// BAD - SQL Injection vulnerable
const query = `SELECT * FROM users WHERE id = ${userId}`;
// GOOD - Parameterized query
const query = 'SELECT * FROM users WHERE id = $1';
await db.query(query, [userId]);
2. Broken Authentication
- Use strong password hashing (bcrypt, argon2)
- Implement rate limiting on login
- Use secure session management
- Enforce MFA for sensitive operations
// Password hashing
const hash = await bcrypt.hash(password, 12);
const isValid = await bcrypt.compare(password, hash);
3. Sensitive Data Exposure
- Encrypt data at rest and in transit
- Use HTTPS everywhere
- Don't log sensitive data
- Mask sensitive fields in responses
4. XML External Entities (XXE)
- Disable DTD processing
- Use JSON instead of XML when possible
- Validate and sanitize XML input
5. Broken Access Control
// Always verify ownership
const resource = await Resource.findById(id);
if (resource.userId !== currentUser.id) {
throw new ForbiddenError();
}
6. Security Misconfiguration
- Remove default credentials
- Disable directory listing
- Keep dependencies updated
- Use security headers
7. Cross-Site Scripting (XSS)
// BAD - XSS vulnerable
element.innerHTML = userInput;
// GOOD - Escaped output
element.textContent = userInput;
// GOOD - Sanitized HTML
const clean = DOMPurify.sanitize(userInput);
8. Insecure Deserialization
- Don't deserialize untrusted data
- Use allowlists for class types
- Validate integrity of serialized data
9. Using Components with Known Vulnerabilities
- Run
npm auditregularly - Use Dependabot or Snyk
- Keep dependencies updated
- Remove unused dependencies
10. Insufficient Logging & Monitoring
- Log authentication events
- Log access control failures
- Set up alerts for anomalies
- Retain logs for forensics
Security Headers
// Express.js security headers
app.use(helmet());
// Or manually:
app.use((req, res, next) => {
res.setHeader('X-Content-Type-Options', 'nosniff');
res.setHeader('X-Frame-Options', 'DENY');
res.setHeader('X-XSS-Protection', '1; mode=block');
res.setHeader('Strict-Transport-Security', 'max-age=31536000');
res.setHeader('Content-Security-Policy', "default-src 'self'");
next();
});
Input Validation
// Use validation libraries
import { z } from 'zod';
const UserSchema = z.object({
email: z.string().email(),
password: z.string().min(8).max(100),
name: z.string().min(1).max(100),
});
const validated = UserSchema.parse(input);
Environment Variables
# NEVER commit these
.env
.env.local
.env.production
# Use secrets management
# - AWS Secrets Manager
# - HashiCorp Vault
# - Azure Key Vault
CORS Configuration
// Restrictive CORS
app.use(cors({
origin: ['https://myapp.com'],
methods: ['GET', 'POST', 'PUT', 'DELETE'],
credentials: true,
}));
Rate Limiting
import rateLimit from 'express-rate-limit';
const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // limit each IP to 100 requests per window
});
app.use('/api/', limiter);
Secrets Scanning
- Pre-commit hooks with git-secrets
- CI/CD secret scanning
- Never hardcode API keys or passwords