
Api Security Hardening
This is a solid Express.js security middleware stack that layers Helmet, rate limiting, input validation, and XSS protection into your REST APIs. You get practical code for the usual suspects: sanitizing MongoDB queries, validating passwords with regex rules, and setting security headers like CSP and HSTS. The rate limiting examples are smart, with stricter limits on auth endpoints than general API routes. There's also a Python/FastAPI version and Nginx config tucked in the references. It won't catch everything, but it handles the OWASP basics you should already have in production and gives you a reasonable checklist to work from.
- skills.sh installs
- 506
- GitHub stars
- 248
- last updated
- Aug 21, 2026
Install
$ npx -y skills add secondsky/claude-skills --skill api-security-hardening --agent claude-codeInstalls into .claude/skills of the current project.
Files
API Security Hardening
Protect REST APIs against common vulnerabilities with multiple security layers.
Security Middleware Stack (Express)
const helmet = require('helmet');
const rateLimit = require('express-rate-limit');
const mongoSanitize = require('express-mongo-sanitize');
app.use(helmet());
app.use(mongoSanitize());
// For input sanitization, see the `xss-prevention` skill — do NOT use the
// deprecated `xss-clean` package (unmaintained since 2018; its own README
// recommends migrating off it).
app.use('/api/', rateLimit({
windowMs: 15 * 60 * 1000,
max: 100
}));
app.use('/api/auth/', rateLimit({
windowMs: 15 * 60 * 1000,
max: 5
}));
Input Validation
const { body, validationResult } = require('express-validator');
const escapeHtml = require('escape-html');
Sponsors
Details
- Repository
- github.com/secondsky/claude-skills
- Categories
- Backend & APIs, Security
- First seen
- Jun 3, 2026
More from secondsky/claude-skills
All 146- Better Auth502
- Design System Creation500
- React Composition Patterns494
- Api Contract Testing491
- React Native Skills490
- Technical Specification489
- Mobile App Testing480
- Api Design Principles479
- Frontend Design479
- Threejs477
- Csrf Protection474
- Ml Model Training474
- Payment Gateway Integration469
- Test Quality Analysis469
- Api Reference Documentation465
- Tanstack Router461
- Systematic Debugging457
- Interaction Design456
- Mutation Testing456
- Api Error Handling455
- Internationalization I18n455
- Security Headers Configuration454
- Seo Optimizer453
- Sequential Thinking448