Hub rules-nodejs

rules-nodejs

v3 public Verified

Node.js

Node.js is an open-source, cross-platform, JavaScript runtime environment. These rules govern Node.js application development, preventing common vulnerabilities like command injection, insecure file system access, and improper error handling.

@sigmashakeinc 3 pulls 18 rules published Apr 8, 2026 synced Oct 11, 2026 sigmashakeinc/rules/rulesets/rules-nodejs →
Severity
7 error 11 warn 0 info
demo.cast
Node.js is an open-source, cross-platform, JavaScript runtime environment. These rules govern Node.js application development, preventing common vulnerabilities like command injection, insecure file system access, and improper error handling.

Rules index

18 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

nodejs

nodejs-block-eval error block

RISK: eval() executes arbitrary strings as code, a top RCE vector when any input is attacker-influenced. FIX: parse JSON with JSON.parse, resolve functions via a lookup table, or use a typed config loader.

Rule source requires an active Pro or Enterprise subscription.
nodejs-block-jwt-algorithm-none error block

RISK: accepting the 'none' JWT algorithm lets an attacker forge tokens without a signature (classic jsonwebtoken vuln, CVE-2015-9235 family still recurring). FIX: pin algorithms to ['RS256'] or ['HS256'] explicitly in jwt.verify and never include 'none'.

Rule source requires an active Pro or Enterprise subscription.
nodejs-block-new-function error block

RISK: 'new Function(...)' is an eval-equivalent that compiles arbitrary strings into callable code, enabling RCE if inputs are tainted. FIX: replace with real functions or a safe expression library (expr-eval, jsep) with an allow-listed grammar.

Rule source requires an active Pro or Enterprise subscription.
nodejs-block-node-serialize error block

RISK: node-serialize.unserialize() executes embedded IIFEs on deserialization — documented RCE (CVE-2017-5941) and the package is unmaintained. FIX: use JSON.parse for data, or a schema-validated format (zod, ajv) over a structured wire format.

Rule source requires an active Pro or Enterprise subscription.
nodejs-block-settimeout-string error block

RISK: setTimeout/setInterval with a string argument invokes the eval path internally (per MDN), turning any interpolated value into RCE. FIX: always pass a function reference or arrow function.

Rule source requires an active Pro or Enterprise subscription.
nodejs-block-tls-reject-unauthorized-false error block

RISK: rejectUnauthorized:false disables TLS certificate validation, exposing traffic to trivial MITM and credential theft. FIX: fix the trust store (NODE_EXTRA_CA_CERTS or ca option with the specific CA), never disable verification.

Rule source requires an active Pro or Enterprise subscription.
nodejs-block-vm-as-sandbox warning ask

RISK: the Node 'vm' module is explicitly NOT a security sandbox — attackers escape via 'this.constructor.constructor' and similar tricks (confirmed in Node docs and CVE-2023-30581). FIX: run untrusted code in a separate process with resource limits, or use isolated-vm / vm2-successors with threat modeling.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-child-process-exec warning log

RISK: child_process.exec spawns a shell, so any interpolated value can break out into arbitrary commands (classic command injection). FIX: use execFile or spawn with an argv array and never pass user input as part of the command string.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-cors-wildcard-credentials warning log

RISK: CORS origin '*' combined with credentials:true is either rejected by browsers or, via misconfig, leaks authenticated responses to arbitrary sites. FIX: reflect a strict allow-list of origins and only set credentials:true for those exact origins.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-dynamic-require warning ask

RISK: require() with a concatenated/variable path can load attacker-chosen modules (including postinstall-backdoored packages from Shai-Hulud-style attacks). FIX: use a static require or a hard-coded switch on validated identifiers.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-eol-node-engine warning log

RISK: Node.js 18 reached EOL in April 2025 and earlier majors get no security fixes — January 2026 CVEs (e.g. CVE-2025-55131) are only patched on 20.x+. FIX: set engines.node to '>=20.19' (current LTS line) and upgrade CI/runtime images.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-hardcoded-secret warning log

RISK: AWS/GitHub/OpenAI/Slack token patterns in source get scraped by bots within minutes of a push (Shai-Hulud 2025 campaign weaponized exactly this). FIX: move to env vars or a secrets manager, rotate the exposed key immediately, and add the pattern to your pre-commit scanner.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-insecure-cookie warning log

RISK: cookies without httpOnly are readable from client JS, so any XSS immediately steals the session. FIX: set { httpOnly: true, secure: true, sameSite: 'lax' } on every res.cookie call.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-jwt-verify-without-algorithms warning log

RISK: jwt.verify without an explicit algorithms option trusts the token header, enabling alg-confusion attacks (HS256 signed with the RSA public key). FIX: always pass { algorithms: ['RS256'] } (or your chosen alg) to jwt.verify.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-math-random-crypto warning ask

RISK: Math.random is a predictable PRNG — using it for tokens/secrets lets attackers recover values from a few samples. FIX: use crypto.randomBytes(n).toString('hex') or crypto.randomUUID() for any security-sensitive value.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-prototype-pollution error block

RISK: assigning to __proto__ mutates Object.prototype across the app, a documented path to auth bypass and RCE (e.g. CVE-2022-21824, Lodash CVE-2019-10744). FIX: use Object.create(null) maps, Map, or explicit property assignment with hasOwnProperty guards.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-shelljs-exec warning log

RISK: shelljs.exec runs through a real shell and has the same injection surface as child_process.exec (CVE-2022-0144 regressed this). FIX: use execFile/spawn with an argv array, or shelljs.exec only with static strings.

Rule source requires an active Pro or Enterprise subscription.
nodejs-warn-yaml-load-unsafe warning log

RISK: js-yaml v3 'load' used the DEFAULT schema which instantiates arbitrary tagged types (RCE); legacy code still calls it. FIX: pin js-yaml >=4 and pass { schema: FAILSAFE_SCHEMA } for untrusted input, or use yaml.load with explicit safe schema.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v3
Published
Apr 8, 2026
Source commits
0
Synced
Oct 11, 2026
Hash
7209df4c721507479e0426a577270f90d5de466aa49b47d1a2a82837d4c07a17
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-nodejs/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-nodejs. The published version only bumps when a maintainer resyncs.

No commit history available.