/engineering-paved-path:securityfrom engineering-paved-path
Web application security best practices based on OWASP Top 10:2025. Use when reviewing code for vulnerabilities, implementing auth/authorization, handling user input, working with file uploads, managing secrets, or building API endpoints. Covers React, Express, MongoDB, and JWT security.
Ships in engineering-paved-path. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Security guidance for React + Express + MongoDB + JWT stacks. See examples.md for unsafe/safe code pairs, checklists.md for quick checklists, references.md for all sources.
Before flagging any issue, trace the data flow and confirm the input source.
| Confidence | Criteria | Action |
|---|---|---|
| HIGH | Vulnerable pattern + attacker-controlled input confirmed | Report with file, line, exploit, and fix |
| MEDIUM | Vulnerable pattern, input source unclear | Note for manual verification |
| LOW | Theoretical / best-practice deviation | Do not report — mention only if asked |
Do NOT flag: test files, dead code, server-controlled values (env vars, config constants), framework-mitigated patterns (React JSX escaping, Mongoose parameterized queries), development-only code gated by NODE_ENV.
Golden rule:
fetch(process.env.API_URL)= safe.fetch(req.query.url)= vulnerable. Always ask: "Can an attacker control this value?"
| # | Category | Key Risk in This Stack |
|---|---|---|
| A01 | Broken Access Control | Missing auth middleware, IDOR, no ownership checks |
| A02 | Security Misconfiguration | Helmet disabled, CORS wildcard, stack traces in prod |
| A03 | Supply Chain Failures | Compromised npm packages, typosquatting |
| A04 | Cryptographic Failures | Weak JWT secret, low bcrypt cost, hardcoded secrets |
| A05 | Injection | MongoDB operator injection, XSS, command injection |
| A06 | Insecure Design | Missing rate limiting, no threat model |
| A07 | Authentication Failures | jwt.decode() instead of verify(), brute force |
| A08 | Integrity Failures | Mass assignment via req.body spread, unvalidated uploads |
| A09 | Logging Failures | Passwords in logs, missing auth event audit trail |
| A10 | Exceptional Conditions | Fail-open auth, stack trace leaks, missing async error handling |
auth middleware as a barrier (via router.use(auth)) rather than per-route to prevent omissionsresource.author.toString() === req.user.userId plus admin role escape hatchcrossOriginResourcePolicy: 'cross-origin' for uploads. If CSP disabled, implement custom CSP restricting script-src to 'self'credentials: true. Never origin: '*' or origin: true with credentialsNODE_ENV === 'development'VITE_* prefixed vars are public in the client bundle — never put secrets thereserverSelectionTimeoutMSnpm audit before every release. Commit package-lock.json always.expres vs express)process.env.JWT_SECRETalgorithm: 'HS256' and expiresIn. Never allow none algorithmjwt.verify(), never jwt.decode() (decode doesn't check signature)Strict-Transport-Security header via HelmetString(req.body.email) — neutralizes operator objects like { "$gt": "" }$where, $expr, or $function (server-side JS execution)str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))mongo-sanitize to strip $ keysdangerouslySetInnerHTML without DOMPurify sanitization (allowlist tags/attributes)href/src — reject javascript: protocol, allow only http:/https:exec() or spawn({ shell: true }) with user inputexecFile() which passes arguments directly without shell interpretationRate limiting strategy:
| Endpoint | Limit | Window |
|---|---|---|
| Login | 5 req | 15 min |
| Comments | 5 req | 1 min |
| AI generation | 3 req | 1 min |
| File upload | 10 req | 1 min |
| General API | 100 req | 1 min |
isApproved flag)isActive: true, compare with bcrypt, return generic "Invalid credentials" for both wrong email and wrong password (prevents enumeration){ userId, email, name, role } — minimum viableBearer <token> from Authorization headernext() only called on successful jwt.verify(). Missing return before error response = fail-open vulnerabilityloginLimiter on login endpoint (5 attempts / 15 min)pre('save') hook only if modified, comparePassword instance method, toJSON strips password from all responsesreq.body — never Model.create(req.body) (attacker can set role: 'admin')enum for fixed values, required on mandatory fields, minlength/maxlength, strict: true (default)script-src, frame-ancestors 'none', object-src 'none'Log these: Login success/failure, token rejection, admin actions, file uploads, rate limit hits, 5xx errors, 403 denials Never log: Passwords, JWT tokens, API keys, credit cards, SSNs
password, token, secret, authorization) before logging — replace with ***catch blocks must return error response before any next() call(err, req, res, next). Return generic message in production.asyncHandler to catch Promise rejections — eliminates need for try-catch in every controllerserverSelectionTimeoutMS: 5000, process.exit(1) on connection failureapp.use('*', ...))['image/jpeg', 'image/png', 'image/gif', 'image/webp'] — whitelist, not blacklist5 * 1024 * 1024 (5MB) via multer.limitsblog-{timestamp}-{random9digits}.{ext}) — never user-providedpath.basename() to strip directory components. Validate path.resolve() starts with upload directory before deletioncrossOriginResourcePolicy: 'cross-origin' for static files, no directory listingScan for these patterns in all code and config:
| Type | Pattern |
|---|---|
| AWS Key | AKIA[0-9A-Z]{16} |
| Google API | AIza[0-9A-Za-z_-]{35} |
| JWT/Generic | (secret|key|token|password)\s*[:=]\s*['"][^'"]{8,} |
| MongoDB URI | mongodb(\+srv)?://[^:]+:[^@]+@ |
| Private Key | -----BEGIN .* PRIVATE KEY----- |
| GitHub Token | gh[ps]_[A-Za-z0-9]{36,} |
| npm Token | npm_[A-Za-z0-9]{36} |
| Slack Token | xox[bpsa]-[0-9a-zA-Z-]+ |
Never commit: .env, .env.local, .env.production, logs/, uploads/
Relevant to AI content generation features (Gemini API):
__proto__/constructor.prototype — validate object keysJSON.parse() throws on malformed input — always wrap in try-catchRegExp(userInput) enables ReDoS — escape special characterspath.join() with user input allows traversal — use path.basename() firstsetTimeout(string) is implicit eval — always pass a function{ password: { "$gt": "" } } — cast to String()$where clause = server-side JS execution — never use with user input.limit() and .skip()strict: false accepts arbitrary fields — keep default strict: truedangerouslySetInnerHTML bypasses escaping — require DOMPurifyhref={userUrl} allows javascript: XSS — validate protocolVITE_* env vars are public — never prefix secretsrouter.use(auth) placed after unprotected routesreq.query values are always strings — validate and cast typesnext breaks error handlingtrust proxy behind reverse proxy — otherwise rate limiter gets wrong IP| Severity | Criteria | Stack Examples |
|---|---|---|
| CRITICAL | Direct exploit, no auth required | NoSQL injection auth bypass, hardcoded prod secrets, missing auth on admin endpoint, RCE |
| HIGH | Exploitable with conditions | Stored XSS in blog content, IDOR on delete, JWT with weak secret, passwords in logs |
| MEDIUM | Specific conditions, limited impact | Missing rate limiter, CORS misconfiguration, verbose prod errors, missing input validation |
| LOW | Defense-in-depth | Low bcrypt cost, missing security event logging, sequential ObjectId exposure |
Level 1 (All Apps): 12+ char passwords, breached list check, login rate limiting, 128+ bit session entropy, HTTPS, server-side validation, generic error messages
Level 2 (Sensitive): + MFA for sensitive ops, crypto key management, comprehensive security logging, schema-based input validation, CSRF protection
Level 3 (Critical): + HSM key storage, documented threat model, anomaly detection, penetration testing, supply chain verification
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub syukpublic/dev-digest-ai-marketplace --plugin engineering-paved-path8 skills in this plugin
/fastify-best-practicesGuides development of Fastify Node.js backend servers and REST APIs using TypeScript or JavaScript. Use when building, configuring, or debugging a Fastify application — including defining routes, implementing plugins, setting up JSON Schema validation, handling errors, optimising performance, managing authentication, configuring CORS and security headers, integrating databases, working with WebSockets, and deploying to production. Covers the full Fastify request lifecycle (hooks, serialization, logging with Pino) and TypeScript integration via strip types. Trigger terms: Fastify, Node.js server, REST API, API routes, backend framework, fastify.config, server.ts, app.ts./next-best-practicesNext.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling/onion-architectureEnforces Onion Architecture (dependencies point inward) on a TypeScript backend (a Fastify + Drizzle + Zod server/ package and a pure domain core, reviewer-core in the reference layout). Use this skill whenever you add or change a backend route, service, repository, adapter, DB query, contract, or DI wiring — and whenever deciding WHERE a piece of logic, an external-tool call (LLM/OpenAI/Anthropic/OpenRouter, GitHub/octokit, git, ripgrep/ast-grep, Postgres), a type, or a validation belongs across layers. Also use when reviewing layering, an import that crosses package/layer boundaries, a leaked Drizzle query, a directly-instantiated SDK client, or business logic creeping into a route. Trigger terms: onion architecture, layer, dependency direction/rule, ports and adapters, repository, service, adapter, composition root, container, dependency inversion, where should this live, layering violation.Other plugins' skills for the same job
14 plugins ship this exact skill · first indexed Jul 20, 2026
Showing 6 of 14 plugins, one per repository first