Rules
All ESLint security rules provided by eslint-plugin-node-security
31 Security Rules
Comprehensive coverage of Node.js built-in module security including fs, child_process, vm, and crypto.
All Rules
| Rule | 🧠 | 💼 | 🔧 | 💡 | ⚠️ | Docs |
|---|---|---|---|---|---|---|
| detect-child-process Detects child_process usage that may allow command injection | 🟢 | |||||
| detect-eval-with-expression Detects strings turned into running code — eval(variable), the Function constructor, and the vm / vm2 sinks that are mistaken for sandboxes | 🟢 | |||||
| detect-non-literal-fs-filename Detects variable in filename argument of fs calls, which might allow an attacker to access anything on your system | 🟢 | |||||
| detect-suspicious-dependencies Detect typosquatting in package names | 🟢 | |||||
| lock-file Ensure package lock file exists for the configured package manager | 🟢 | |||||
| no-arbitrary-file-access Prevent file access from user input | 🟢 | |||||
| no-buffer-overread Detects buffer access beyond bounds | 🟢 | |||||
| no-cryptojs Disallow deprecated crypto-js library (use native crypto instead) | 🟢 | |||||
| no-cryptojs-weak-random Disallow crypto-js WordArray.random() (CVE-2020-36732) | 🟢 | |||||
| no-data-in-temp-storage Prevent sensitive data in temp directories | 🟢 | |||||
| no-deprecated-buffer Disallow the deprecated `new Buffer()` constructor and `Buffer()` factory call. | 🟢 | |||||
| no-deprecated-cipher-method Disallow deprecated crypto.createCipher/createDecipher methods (use createCipheriv/createDecipheriv instead) | 🟢 | |||||
| no-dynamic-algorithm-selection Disallow dynamic algorithm names in Node.js crypto functions (CWE-327) | 🟢 | |||||
| no-dynamic-command-string Disallow dynamically assembled command strings passed to a shell flag or to a command-runner that does not escape (CWE-77) | 🟢 | |||||
| no-dynamic-dependency-loading Prevent runtime dependency injection with dynamic paths | 🟢 | |||||
| no-dynamic-require Forbid `require()` calls with expressions | 🟢 | |||||
| no-ecb-mode Disallow ECB encryption mode (use GCM or CBC instead) | 🟢 | |||||
| no-env-injection Disallow writing process.env under a key the caller controls, which can overwrite PATH, NODE_OPTIONS or LD_PRELOAD (CWE-99) | 🟢 | |||||
| no-insecure-http-parser Disallow insecureHTTPParser: true on Node HTTP servers and clients | 🟢 | |||||
| no-insecure-key-derivation Disallow PBKDF2 with insufficient iterations (< 100,000) | 🟢 | |||||
| no-insecure-rsa-padding Disallow RSA PKCS#1 v1.5 padding (CVE-2023-46809 Marvin Attack) | 🟢 | |||||
| no-math-random-crypto Disallow Math.random() for cryptographic purposes | 🟢 | |||||
| no-self-signed-certs Disallow rejectUnauthorized: false in TLS options | 🟢 | |||||
| no-sha1-hash Disallow sha1() from crypto-hash package (use sha256 or sha512) | 🟢 | |||||
| no-shell-injection Disallow string concatenation or template expressions in shell command arguments (CWE-78) | 🟢 | |||||
| no-ssrf Flags HTTP calls whose URL argument is a user-input-named identifier or reads off a request object — a heuristic prompt for code review, not a proof of SSRF | 🟢 | |||||
| no-static-iv Disallow static or hardcoded initialization vectors (IVs) | 🟢 | |||||
| no-timing-unsafe-compare Disallow timing-unsafe comparison of secrets | 🟢 | |||||
| no-toctou-vulnerability Detects Time-of-Check-Time-of-Use vulnerabilities | 🟢 | |||||
| no-unbounded-decompression Require a maxOutputLength ceiling on zlib one-shot decompression | 🟢 | |||||
| no-unsafe-buffer-alloc Disallow `Buffer.allocUnsafe()` and `Buffer.allocUnsafeSlow()`, which return uninitialized memory | 🟢 | |||||
| no-unsafe-dynamic-require Prevent unsafe dynamic require() calls that could enable code injection | 🟢 | |||||
| no-weak-cipher-algorithm Disallow weak cipher algorithms (DES, 3DES, RC4, Blowfish) | 🟢 | |||||
| no-weak-dh-parameters Disallow Diffie-Hellman and ECDH parameters below a safe strength | 🟢 | |||||
| no-weak-hash-algorithm Disallow weak hash algorithms (MD5, SHA1, MD4) | 🟢 | |||||
| no-zip-slip Detects zip slip/archive extraction vulnerabilities | 🟢 | |||||
| prefer-native-crypto Prefer native crypto over third-party libraries | 🟢 | |||||
| require-aead-tag-verification Require AEAD decryption to verify the authentication tag (setAuthTag + final) | 🟢 | |||||
| require-dependency-integrity Require SRI (Subresource Integrity) for CDN resources | 🟢 | |||||
| require-secure-credential-storage Enforce secure storage patterns for credentials | 🟢 | |||||
| require-secure-deletion Require secure data deletion patterns | 🟢 | |||||
| require-storage-encryption Require encryption for persistent storage | 🟢 | |||||
| require-stream-error-handler Require an 'error' listener on streams passed to .pipe(), which does not forward errors | 🟢 |
Rule Categories
Command Injection
Rules detecting child_process vulnerabilities and unsafe command execution.
File System Security
Rules preventing path traversal, TOCTOU vulnerabilities, and unsafe file operations.
Cryptographic Security
Rules enforcing secure crypto implementations and preventing weak algorithms.
Module Security
Rules detecting unsafe require patterns and dependency vulnerabilities.
Data Protection
Rules preventing PII exposure in logs and requiring secure storage.
Building secure JavaScript with Interlace? Star the repo to get new rules and CWE coverage as we ship them — or follow the AI-code-security benchmarks behind them.