Hub rules-javascript

rules-javascript

v5 public Verified

JavaScript

JavaScript is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. These rules govern modern JavaScript development, ecosystem usage, and asynchronous patterns for AI agents.

@sigmashakeinc 3 pulls 23 rules published Apr 8, 2026 synced Oct 11, 2026 sigmashakeinc/rules/rulesets/rules-javascript →
Severity
19 error 4 warn 0 info
demo.cast
JavaScript is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. These rules govern modern JavaScript development, ecosystem usage, and asynchronous patterns for AI agents.

Rules index

23 governance rules

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

js

no-child-process-exec-concat error block

String interpolation/concatenation in exec() creates a command injection vulnerability. Use execFile() with an arguments array, or spawn() with shell: false.

Rule source requires an active Pro or Enterprise subscription.
no-console-log-in-src-js warning log

console.log() in source code — use a structured logging library (pino, winston) that can be controlled in production.

Rule source requires an active Pro or Enterprise subscription.
no-cors-wildcard-with-credentials error block

CORS wildcard origin combined with credentials: true is rejected by browsers and indicates a broken auth model. Reflect a validated allowlisted origin instead.

Rule source requires an active Pro or Enterprise subscription.
no-dangerously-set-inner-html error log

dangerouslySetInnerHTML bypasses React's XSS protection. Render as text, or sanitize with DOMPurify.sanitize() before injecting HTML.

Rule source requires an active Pro or Enterprise subscription.
no-empty-catch-js warning log

Empty catch blocks silently swallow errors, hiding bugs in production. Log the error or re-throw it: catch (err) { console.error(err); throw err; }

Rule source requires an active Pro or Enterprise subscription.
no-eval error block

eval() executes arbitrary strings as code — a critical injection vector. Refactor to use a JSON.parse(), a lookup table, or a proper parser.

Rule source requires an active Pro or Enterprise subscription.
no-hardcoded-secrets-js error log

Hardcoded credential detected. Store secrets in environment variables and access via process.env.SECRET_NAME — never embed them in source code.

Rule source requires an active Pro or Enterprise subscription.
no-innerhtml-assignment error log

innerHTML and document.write() with unsanitized input enable XSS attacks. Use textContent for plain text, or sanitize with DOMPurify before setting innerHTML.

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

JWT 'none' algorithm lets attackers forge unsigned tokens (classic jsonwebtoken bypass). Use RS256/ES256/HS256 and pass { algorithms: ['RS256'] } to verify().

Rule source requires an active Pro or Enterprise subscription.
no-loose-equality warning log

Loose equality (==, !=) performs type coercion with surprising results (e.g., '' == 0). Use strict equality (===, !==) instead.

Rule source requires an active Pro or Enterprise subscription.
no-math-random-crypto error block

Math.random() is not cryptographically secure. Use crypto.randomBytes() or crypto.getRandomValues() for security-sensitive random values like tokens, keys, and passwords.

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

new Function() constructs and executes arbitrary code at runtime — equivalent to eval(). Use a safer dispatch pattern instead.

Rule source requires an active Pro or Enterprise subscription.
no-nextjs-middleware-subrequest-bypass error block

Setting or trusting the 'x-middleware-subrequest' header enables the Next.js middleware auth bypass (CVE-2025-29927). Upgrade Next.js to 15.2.3/14.2.25 and never forward this header from clients.

Rule source requires an active Pro or Enterprise subscription.
no-node-vm-as-sandbox error block

vm2 is deprecated and has unpatched sandbox-escape CVEs (CVE-2023-37466, 2023-37903); node:vm is explicitly not a security sandbox. Use isolated-vm or a separate process/container for untrusted code.

Rule source requires an active Pro or Enterprise subscription.
no-path-traversal-js error log

File system operations with user-controlled paths enable path traversal attacks (e.g., ../../etc/passwd). Sanitize paths with path.resolve() and validate they stay within the intended directory.

Rule source requires an active Pro or Enterprise subscription.
no-polyfill-io-cdn error block

polyfill.io was compromised in June 2024 and served malware to 100k+ sites (Sansec/Cloudflare advisory). Remove the script or switch to cdnjs.cloudflare.com/polyfill or self-host.

Rule source requires an active Pro or Enterprise subscription.
no-postmessage-wildcard error log

postMessage with targetOrigin '*' leaks data to any origin and enables cross-origin attacks. Pass the explicit target origin string.

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

__proto__ mutation enables prototype pollution attacks that can compromise all objects in the runtime. Use Object.create(null) for safe dictionaries or validate keys before assignment.

Rule source requires an active Pro or Enterprise subscription.
no-require-user-input error block

require() with user-supplied input enables path traversal and arbitrary module loading. Validate and whitelist module names before dynamic require.

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

Passing a string to setTimeout()/setInterval() invokes eval() internally — the string is parsed and executed as code. Pass a function reference instead: setTimeout(() => doThing(), delay).

Rule source requires an active Pro or Enterprise subscription.
no-sql-template-literal error block

Template literals or string concatenation in SQL queries allow SQL injection. Use parameterized queries: db.query('SELECT * FROM t WHERE id = ?', [id])

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

Disabling TLS certificate verification allows trivial MITM attacks. Trust the system CA store, or load the internal CA via tls.createSecureContext({ ca }) instead of disabling verification.

Rule source requires an active Pro or Enterprise subscription.
no-var-declaration warning log

var has function scope and hoisting behavior that causes subtle bugs. Use const for values that don't change, or let for values that do.

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
v5
Published
Apr 8, 2026
Source commits
0
Synced
Oct 11, 2026
Hash
aae1cb552f63a24b429ea2a8354c3a6921112dbe8e1b5fa9b53e1c86ae3979ea
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

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

No commit history available.