node-security-review
Skill0 starsChanged 3 days agoMITView on GitHub
Security review of a Node.js backend (Express, Fastify, NestJS, Hono, Koa) with a static scanner for JS/TS source - eval and new Function, child_process exec with template strings, request input in file paths (path traversal), SQL built with ${} or +, jwt.verify without an algorithms allow-list or with ignoreExpiration, alg none, cookies and sessions without httpOnly/secure, hard-coded secrets (values never printed), disabled TLS verification, CORS any-origin with credentials, Math.random tokens, open redirects, mass assignment, prototype-polluting merges, stack traces in responses, and missing helmet / rate limiting. Use when the user asks to security-review, audit or harden a Node.js API, check an Express/Fastify/NestJS/Hono app before launch, review auth/JWT/cookie code, or asks "is this endpoint safe?".
- Reads credentials
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- api-performanceSkill
- background-jobsSkill
- env-configSkill
- error-handling-patternsSkill
- logging-and-tracingSkill
- node-deploySkill
- package-json-auditSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Before a launch, a pentest, or opening an API to the internet
- Distinctive: line 31
Not a substitute for a pentest, threat model or SAST like Semgrep/CodeQL on large codebases.
- Distinctive: line 65
Wait for approval before editing.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Node.js security review
Find the common, high-impact mistakes deterministically, then review auth and data flow by reading the code. Read-only: propose fixes, apply them only when the user agrees.
Paths below are relative to this skill's folder (in Claude Code: ${CLAUDE_SKILL_DIR}).
When to use
- "Security review / audit / harden my Node API", "is this route safe?"
- Before a launch, a pentest, or opening an API to the internet
- Reviewing login, JWT, session, cookie, file upload/download or shell-out code
- A pull request touches
child_process,fs, raw SQL,jwt.verify,res.cookie
When not to use
- Vulnerable dependencies and
package.jsonrisks:package-json-audit - Secrets in
.envfiles and config validation:env-config - Leaking data through logs:
logging-and-tracing - Container/systemd hardening:
node-deploy - Not a substitute for a pentest, threat model or SAST like Semgrep/CodeQL on large codebases; suggest those for regulated systems.
Workflow
- Scope. Identify the framework, entry point (
src/server.ts,main.ts), auth method (JWT, sessions, API keys) and whether a gateway/proxy adds headers or rate limits. - Run the scanner (read-only).
Exit 1 = findings at or abovepython3 scripts/scan_node_security.py . # skips node_modules, dist, build, tests python3 scripts/scan_node_security.py src --json python3 scripts/scan_node_security.py src --fail-on high --ignore app.no_rate_limit python3 scripts/scan_node_security.py src --include-tests --exclude generated--fail-on(defaultmedium), 2 = bad path. Accepted risks: add// nodeskills-ignore <rule-id>on or above the line, with a reason. - Triage high first. For each rule the meaning, false positives and the fix are in
references/rules.md. Confirm each finding by reading the code:
is the value really attacker-controlled? Is there validation upstream?
secret.hardcoded: tell the user to rotate the secret; moving it is not enough.exec.shell_injection,sql.injection,path.traversal,code.eval: exploitable on the first request; fix before anything else.
- Manual review the scanner cannot do (checklist in
references/checklist.md):
- Authorization on every route (object-level: can user A read user B's order?)
- Input validation at the edge (zod / valibot / TypeBox / class-validator) and body size limits
- Password hashing (argon2id or bcrypt), login throttling, reset-token expiry
- CSRF for cookie-authenticated, state-changing routes;
SameSitealone is not enough for subdomains - SSRF: user-supplied URLs fetched by the server (block private ranges, allow-list hosts)
- File uploads: size limit, type check by content, stored outside the web root
app.set('trust proxy', ...)set correctly so rate limits andsecurecookies work
- Propose fixes as minimal diffs per finding, framework-specific (references/framework-hardening.md has Express, Fastify, NestJS and Hono setup for headers, CORS, rate limits, cookies and JWT). Wait for approval before editing.
- Re-run the scanner and report before/after counts. Suggest adding it to CI:
python3 path/to/scan_node_security.py src --fail-on high.
Output
Security review: api (Express 5, JWT in Authorization header) - 4 high, 3 medium, 1 low
HIGH src/routes/files.ts:24 path.traversal req.params.name joined into a path
fix: res.sendFile(path.basename(name), { root: UPLOADS }) + 404 when missing
HIGH src/config.ts:9 secret.hardcoded 'JWT_SECRET' literal -> rotate, read from env
MED src/auth.ts:28 jwt.no_algorithms -> { algorithms: ['HS256'], issuer, audience }
LOW src/app.ts:8 app.no_rate_limit -> express-rate-limit on /auth/*
Manual review: GET /orders/:id has no ownership check (IDOR) - see diff below.
Not covered: dependency CVEs (run package-json-audit), infrastructure.Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

