| name | nodejs-security-checklist |
| description | Node.js security checklist for org-owned services: Express/Fastify/Nest defaults, validation, injection sinks, sessions/JWT cookies, secrets, dependencies, and HTTP hardening. Use when reviewing Node/Express APIs, npm risk, helmet/CORS, or release hardening โ authorized only.
|
Node.js Security Checklist
Harden Node.js HTTP services and workers you own or are authorized to
assess. Runtime and framework controls โ not a general exploit catalog.
Use When
- Reviewing Node apps (
package.json, Express/Fastify/Koa/Nest/Hono)
- Middleware: helmet, CORS, rate limits, sessions, JWT cookies
- Prototype pollution, ReDoS, path traversal, SQLi/NoSQLi, XSS, CMDi
- npm/yarn/pnpm lockfile risk;
child_process / vm / eval
- Mentions: Node.js security, Express security, helmet, npm audit, Node ๅฎๅ
จ
Do not use as primary for:
| Need | Skill instead |
|---|
| Unknown injection class deep-dive | injection-checking โ class skill |
| Secret vault/rotation only | secrets-management-hygiene |
| Code reliability/tests baseline | code-quality-standards |
| Prototype pollution deep methodology | prototype-pollution |
| Image packaging only | dockerfile-best-practices |
Repo Config First
Repo settings outrank generic defaults.
- Runtime pin:
.nvmrc / engines / Volta โ match CI and prod
- Framework layout (Express modules, Nest guards/pipes) โ do not fork auth style
- Config:
dotenv/envalid/platform secrets; .env.example placeholders only
- Validation stack already in use (Zod, Joi, class-validator, TypeBox)
- Neighbor route middleware order (auth before handler)
- Package manager + committed lockfile; private registry auth pattern
- CI:
npm audit, Socket/Snyk, ESLint security โ extend gates
- Edge TLS vs app cookies; set
trust proxy only for known hop count
Follow the repo on conflicts; surface eval, open CORS+credentials, committed prod .env.
Workflow
- Inventory โ routes, webhooks, uploads, SSR, WebSockets, workers, debug/metrics exposure.
- HTTP baseline โ
trust proxy, helmet (or edge headers), CORS allowlist, body size limits.
- AuthN/session โ cookie flags; production session store (not MemoryStore multi-instance); JWT alg allowlist; logout/revoke.
- AuthZ โ object-level checks on every id; isolate admin routers.
- Validation โ schema at boundary; strip unknown keys; cap pagination.
- Dangerous APIs โ SQL/NoSQL concat,
exec(user), path join escape, SSR XSS, eval/Function/vm, unsafe YAML โ injection-checking when class unclear.
- Prototype pollution โ deep merge of
req.body; prefer null-prototype maps / safe merge.
- Deps + verify โ lockfile, audit High/Critical; dual-account authZ retest;
code-quality-standards on fixes.
Good / Bad
Good
const data = z.object({ name: z.string().max(100) }).parse(req.body);
await pool.query("SELECT * FROM users WHERE email = $1", [email]);
app.use(helmet());
app.use(cors({ origin: ["https://app.example"], credentials: true }));
Bad
await db.user.update({ where: { id: req.params.id }, data: req.body });
Object.assign(user, req.body);
await pool.query(`SELECT * FROM users WHERE email = '${email}'`);
exec(`zip -r out.zip ${userDir}`);
app.use(cors({ origin: true, credentials: true }));
const API_KEY = "sk_live_โฆ";
eval(req.body.expr);
Routing
| Situation | Primary | Helper |
|---|
| Node/Express/Nest checklist, helmet, npm hygiene | This skill | โ |
| Implementation quality, tests on fixes | code-quality-standards | this |
API keys, .env, vault, rotation | secrets-management-hygiene | this for Node load paths |
| Unclear / multi-class injection | injection-checking | this for Node sinks |
| SQLi/XSS/SSRF/CMDi/prototype deep dive | matching class skill | this |
| JWT/API auth methodology | api-auth-and-jwt-abuse | this for cookie flags |
| Container packaging | dockerfile-best-practices | this |
| SBOM / supply-chain gates | sbom-and-supply-chain | this |
Required helpers
code-quality-standards โ every production code change.
secrets-management-hygiene โ env keys, registry tokens, session secrets.
injection-checking โ unknown or multi-type sinks.
Checklist
Rules
Authorized targets only. Prefer config/code evidence; cite versions for CVEs. Fail closed on missing secrets and authZ. Redact tokens, cookies, and PII.