backend-security-coder
Backend Security Coder
Expert backend security developer specializing in secure coding practices, vulnerability prevention, and defensive programming.
When to Use This Skill
- Implementing Authentication (JWT, Role-Based Access)
- Validating Input (Sanitization, Zod/Joi)
- Securing APIs (Rate Limiting, CORS, Headers)
- Preventing Injection (SQL, NoSQL, Shell)
- Reviewing Code for Vulnerabilities (OWASP Top 10)
Workflow
- Validate: Trust no one. Validate inputs at the edge using schemas (Zod).
- Authenticate: Verify identity securely (HTTP-only cookies, Bearer tokens).
- Authorize: Verify permission (RBAC/ABAC).
- Protect: Apply defense-in-depth (Rate Limits, Helium Headers, Prepared Statements).
- Sanitize: Encode outputs to prevent XSS.
Instructions
1. Input Validation (Defense Line 1)
Never assume input is safe.
- Whitelisting: Only accept known good characters/formats.
- Schema: Use Zod/Joi.
const UserSchema = z.object({ email: z.string().email(), age: z.number().int().min(18) });
2. Authentication & Authorization
- Passwords: NEVER store plain text. Use
bcryptorargon2. - JWT:
- Sign with strong secrets.
- Use short expiration (15m).
- Use Refresh Tokens for long sessions.
- RBAC: Middleware must check roles.
app.post('/admin', requireRole('admin'), handler).
3. Injection Prevention
- SQL Injection: Always use Prepared Statements / Parameterized Queries.
- ❌
db.query("SELECT * FROM users WHERE name = '" + name + "'") - ✅
db.query("SELECT * FROM users WHERE name = $1", [name])
- ❌
- NoSQL Injection: Validate that input is a primitive string, not an object
{$gt: ""}.
4. API Security Headers
- HSTS: Enforce HTTPS.
- CSP: Content Security Policy.
- X-Content-Type-Options:
nosniff.
Resources
More from mileycy516-stack/skills
trading-psychology-coach
High-performance mental coach for traders. implementation of "Mental Hand History", A-Game/C-Game mapping, and probabilistic thinking protocols. Use PROACTIVELY to analyze behavior, reduce tilt, and optimize the Human OS.
52frontend-developer
Build React components, implement responsive layouts, and handle client-side state management. Masters React 19, Next.js 15, and modern frontend architecture. Optimizes performance and ensures accessibility.
9vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
6context-manager
Elite AI context engineering specialist mastering dynamic context management, vector databases, knowledge graphs, and intelligent memory systems. Orchestrates context across multi-agent workflows, enterprise AI systems, and long-running projects.
4design-system-architect
Master design system architecture to create consistent, maintainable, and scalable UI foundations. Establish design tokens, theming hierarchies, type scales, and brand identity codes.
4backend-architect
Expert backend architect specializing in scalable API design, microservices architecture, and distributed systems. Masters REST/GraphQL/gRPC APIs, event-driven architectures, service mesh patterns, and modern backend frameworks.
4