← ClaudeAtlas

security-best-practiceslisted

Implement security best practices for web applications and infrastructure. Use when securing APIs, preventing common vulnerabilities, or implementing security policies. Handles HTTPS, CORS, XSS, SQL Injection, CSRF, rate limiting, and OWASP Top 10.
aiskillstore/marketplace · ★ 329 · DevOps & Infrastructure · score 82
Install: claude install-skill aiskillstore/marketplace
# Security Best Practices ## When to use this skill - **New project**: consider security from the start - **Security audit**: inspect and fix vulnerabilities - **Public API**: harden APIs accessible externally - **Compliance**: comply with GDPR, PCI-DSS, etc. ## Instructions ### Step 1: Enforce HTTPS and security headers **Express.js security middleware**: ```typescript import express from 'express'; import helmet from 'helmet'; import rateLimit from 'express-rate-limit'; const app = express(); // Helmet: automatically set security headers app.use(helmet({ contentSecurityPolicy: { directives: { defaultSrc: ["'self'"], scriptSrc: ["'self'", "'unsafe-inline'", "https://trusted-cdn.com"], styleSrc: ["'self'", "'unsafe-inline'"], imgSrc: ["'self'", "data:", "https:"], connectSrc: ["'self'", "https://api.example.com"], fontSrc: ["'self'", "https:", "data:"], objectSrc: ["'none'"], mediaSrc: ["'self'"], frameSrc: ["'none'"], }, }, hsts: { maxAge: 31536000, includeSubDomains: true, preload: true } })); // Enforce HTTPS app.use((req, res, next) => { if (process.env.NODE_ENV === 'production' && !req.secure) { return res.redirect(301, `https://${req.headers.host}${req.url}`); } next(); }); // Rate limiting (DDoS prevention) const limiter = rateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes max: 100, // max 100 requests per IP message: 'Too many requests from this IP, please try