← スキル一覧に戻る

security-checklist
by hydershah
Advance Appliance - Next.js 15 + Payload CMS website with 3 design themes
⭐ 0🍴 0📅 2026年1月25日
SKILL.md
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
スコア
総合スコア
40/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です