security-best-practices
Security-focused development skill covering OWASP Top 10 and secure coding. Use when implementing authentication, handling user data, or security review…
от VoDaiLocz★ 28 звёзд на GitHub
Установить security-best-practices в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
🔐 Security Best Practices Skill
Philosophy: Security is not optional. Build it in from the start.
When to Use
Use this skill when:
- Implementing authentication/authorization
- Handling user input
- Working with sensitive data
- Doing security code review
- Building user-facing features
- Setting up deployment/infrastructure
Do NOT use this skill when:
- Just formatting code
- Pure UI/styling changes
- No user data involved
Prerequisites
Before starting:
- Understand what data you're handling
- Know your threat model (who might attack)
- Have access to codebase
- Understand the tech stack
OWASP Top 10 Quick Reference
1. Broken Access Control (A01:2021)
What: Users can access data/functions they shouldn't.
Prevention:
// ❌ Bad: No authorization check
app.get('/users/:id', async (req, res) => {
const user = await db.users.findById(req.params.id);
res.json(user);
});
// ✅ Good: Check ownership
app.get('/users/:id', authorize(), async (req, res) => {
const user = await db.users.findById(req.params.id);
if (user.id !== req.user.id && req.user.role !== 'admin') {
throw new ForbiddenException();
}
res.json(user);
});
Checklist:
- Default deny (require explicit permission)
- Verify ownership of resources
- Role-based access control implemented
- Admin functions protected
- CORS configured correctly
2. Cryptographic Failures (A02:2021)
What: Weak crypto, exposed sensitive data.
Prevention:
// ❌ Bad: Weak hashing
const hash = crypto.createHash('md5').update(password).digest('hex');
// ✅ Good: Strong hashing with bcrypt
const hash = await bcrypt.hash(password, 12);
// ❌ Bad: Hardcoded secrets
const API_KEY = "sk_live_abc123";
// ✅ Good: Environment variables
const API_KEY = process.env.API_KEY;
Checklist:
- Passwords hashed with bcrypt/argon2 (cost factor ≥12)
- Sensitive data encrypted at rest
- TLS/HTTPS enforced
- No hardcoded secrets
- Secrets in environment variables
- Old/weak algorithms avoided (MD5, SHA1)
3. Injection (A03:2021)
What: Malicious data executed as code/query.
Prevention:
// ❌ Bad: SQL Injection
const query = `SELECT * FROM users WHERE email = '${email}'`;
// ✅ Good: Parameterized queries
const user = await db.query(
'SELECT * FROM users WHERE email = $1',
[email]
);
// ❌ Bad: Command injection
exec(`convert ${filename} output.png`);
// ✅ Good: Use library functions
await sharp(filename).toFile('output.png');
Types to Prevent:
- SQL Injection
- NoSQL Injection
- Command Injection
- LDAP Injection
- XPath Injection
Checklist:
- Use parameterized queries/ORM
- Validate and sanitize all input
- Escape output appropriately
- Avoid shell commands with user input
- Use allow-lists, not block-lists
4. Insecure Design (A04:2021)
What: Missing security in design phase.
Prevention:
# Security design considerations
threat_modeling:
assets:
- User credentials
- Payment information
- Personal data
threats:
- Authentication bypass
- Data theft
- Privilege escalation
mitigations:
- MFA for sensitive operations
- Encryption at rest
- Audit logging
Checklist:
- Threat model created
- Security requirements documented
- Defense in depth applied
- Fail securely (safe defaults)
- Separation of duties
5. Security Misconfiguration (A05:2021)
What: Insecure settings, missing hardening.
Prevention:
// ❌ Bad: Debugging enabled in production
app.use(express.errorHandler({ dumpExceptions: true }));
// ✅ Good: Production-safe error handling
if (process.env.NODE_ENV === 'production') {
app.use((err, req, res, next) => {
console.error(err); // Log internally
res.status(500).json({ message: 'Internal error' }); // Don't expose details
});
}
Checklist:
- Remove default credentials
- Disable debugging in production
- Remove unnecessary features/endpoints
- Security headers configured
- Error messages don't leak info
- File permissions correct
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();
});
6. Vulnerable Components (A06:2021)
What: Using libraries with known vulnerabilities.
Prevention:
# Check for vulnerabilities
npm audit
pip-audit
dotnet list package --vulnerable
# Fix vulnerabilities
npm audit fix
pip-audit --fix
Checklist:
- Dependencies up to date
- Security advisories mon
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл security-best-practices?
Security-focused development skill covering OWASP Top 10 and secure coding. Use when implementing authentication, handling user data, or security review. Keywords: security, auth, authentication, authorization, OWASP, XSS, SQL injection, CSRF, secure
Как установить скилл security-best-practices?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл security-best-practices запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…