Skip to main content
ESLint Interlace
Plugin: node-security

Overview

Node.js security rules for fs, child_process, vm, and crypto modules

Live from GitHub

This content is fetched directly from README.md on GitHub and cached for 1 hour.

AI-Optimized Security

Every rule includes CWE, OWASP, and CVSS metadata for AI assistants to provide precise, context-aware fixes.


Live README from GitHubfrom eslint-plugin-node-security/README.md, cached for 1 hour.Edit on GitHub
ESLint Interlace Logo

Security-focused ESLint plugin for Node.js built-in modules (fs, child_process, vm, crypto, Buffer).

NPM VersionNPM DownloadsPackage LicenseCodecovSince Dec 2025

โญ If this plugin caught a real bug for you, star the repo โ€” it's the signal that keeps these rules maintained.

Description

This plugin provides Security rules for Node.js core modules (fs, child_process, crypto, etc).

Philosophy

Interlace fosters strength through integration. Instead of stacking isolated rules, we interlace security directly into your workflow to create a resilient fabric of code. We believe tools should guide rather than gatekeep, providing educational feedback that strengthens the developer with every interaction.

Getting Started

npm install eslint-plugin-node-security --save-dev

โš™๏ธ Configuration Presets

PresetDescription
recommendedBalanced security for most Node.js projects
strictMaximum security enforcement (all rules as errors)
fs-securityFocus on file system vulnerabilities (CWE-22, CWE-73)
cryptoCryptographic security rules only

๐Ÿ’ก What You Get

  • 31 security rules covering Node.js core module vulnerabilities
  • Command Injection Detection for child_process.exec, spawn, and execFile
  • Path Traversal Prevention for fs module operations
  • TOCTOU Race Condition Detection for file system operations
  • Cryptographic Security for weak algorithms and key management
  • LLM-optimized messages with CWE references and fix guidance

๐Ÿ“ฆ Compatibility

PackageVersion
ESLint^8.0.0 || ^9.0.0 || ^10.0.0
Node.js>=18.0.0

See the ESLint Version Support Policy โ€” current ecosystem share data, the 20% gate, and the forward-looking exception that covers v10.

Rules

Legend

IconDescription
๐Ÿ’ผRecommended: Included in the recommended preset.
โš ๏ธWarns: Set to warn in recommended preset.
๐Ÿ”งAuto-fixable: Automatically fixable by the --fix CLI option.
๐Ÿ’กSuggestions: Providing code suggestions in IDE.
๐ŸšซDeprecated: This rule is deprecated.
๐ŸŸขType-unaware: AST-only, runs in oxlint JS-plugin tier.
๐ŸŸกType-aware (refining): pure-AST primary path; types refine precision.
๐ŸŸ Type-aware (graceful): requires TS program; silent without it.
RuleCWEOWASPCVSSDescription๐Ÿง ๐Ÿ’ผโš ๏ธ๐Ÿ”ง๐Ÿ’ก๐Ÿšซ
detect-child-processCWE-78Detects instances of childprocess & non-literal exec() calls that may allow command injection๐ŸŸข
detect-eval-with-expressionCWE-95A03:2021Detects eval(variable) which can allow an attacker to run arbitrary code inside your process๐ŸŸข
detect-non-literal-fs-filenameCWE-22Detects variable in filename argument of fs calls, which might allow an attacker to access anything on yourโ€ฆ๐ŸŸข
detect-suspicious-dependenciesCWE-506This rule detects package imports that look like typosquatting attempts on popular npm packages๐ŸŸข
lock-fileCWE-829CWE: CWE-829๐ŸŸข
no-arbitrary-file-accessCWE-22A01:2021Prevents file system access with unsanitized user input to protect against path traversal attacks.๐ŸŸข
no-buffer-overreadCWE-126Detects buffer access beyond bounds๐ŸŸข
no-cryptojsCWE-1104A06:2021Disallow deprecated crypto-js library (use native crypto instead)๐ŸŸข
no-cryptojs-weak-randomCWE-338A02:2021Disallow crypto-js WordArray.random() (CVE-2020-36732)๐ŸŸข
no-data-in-temp-storageCWE-312Temporary directories (/tmp, /var/tmp, temp/) are often world-readable or persist longer than expected๐ŸŸข
no-deprecated-bufferCWE-676Disallow the deprecated new Buffer() constructor and Buffer() factory call.๐ŸŸข๐Ÿ’ก
no-deprecated-cipher-methodCWE-327A02:2021Disallow deprecated crypto.createCipher/createDecipher methods๐ŸŸข
no-dynamic-dependency-loadingCWE-1104This rule detects dynamically constructed paths in require() and import() statements๐ŸŸข
no-dynamic-requireForbid require() calls with non-literal arguments๐ŸŸข
no-ecb-modeCWE-327A02:2021Disallow ECB encryption mode (use GCM or CBC instead)๐ŸŸข
no-insecure-key-derivationCWE-916A02:2021Disallow PBKDF2 with insufficient iterations (< 100,000)๐ŸŸข
no-insecure-rsa-paddingCWE-327A02:2021Disallow RSA PKCS#1 v1.5 padding (CVE-2023-46809 Marvin Attack)๐ŸŸข
no-math-random-cryptoCWE-338A02:2021Disallow Math.random() for cryptographic purposes (tokens, keys, secrets, salts, IVs)๐ŸŸข
no-self-signed-certsCWE-295A07:2021Disallow rejectUnauthorized false in TLS options๐ŸŸข
no-sha1-hashCWE-327A02:2021Disallow sha1() from crypto-hash package (use sha256 or sha512)๐ŸŸข
no-ssrfCWE-918A10:2021Detect HTTP requests with user-controlled URLs (server-side request forgery).๐ŸŸข๐Ÿ’ก
no-static-ivCWE-329A02:2021Disallow static or hardcoded initialization vectors (IVs)๐ŸŸข
no-timing-unsafe-compareCWE-208A02:2021Disallow timing-unsafe comparison of secrets๐ŸŸข
no-toctou-vulnerabilityCWE-367A01:2021Detects Time-of-Check-Time-of-Use (TOCTOU) race condition vulnerabilities in file system operations.๐ŸŸข
no-unsafe-dynamic-requireCWE-494Disallows dynamic require() calls with non-literal arguments that could lead to security vulnerabilities๐ŸŸข
no-weak-cipher-algorithmCWE-327A02:2021Disallow weak cipher algorithms (DES, 3DES, RC4, Blowfish, RC2, IDEA)๐ŸŸข
no-weak-hash-algorithmCWE-327A02:2021Disallow weak hash algorithms (MD5, MD4, SHA-1, RIPEMD)๐ŸŸข
no-zip-slipCWE-22Detects zip slip/archive extraction vulnerabilities๐ŸŸข
prefer-native-cryptoCWE-1104A06:2021Prefer native crypto over third-party libraries๐ŸŸข
require-dependency-integrityCWE-494CWE: CWE-494๐ŸŸข
require-secure-credential-storageCWE-312This rule detects when credentials are stored using localStorage.setItem() or fs.writeFile() without encrypโ€ฆ๐ŸŸข
require-secure-deletionCWE-459CWE: CWE-459๐ŸŸข
require-storage-encryptionCWE-312CWE: CWE-312๐ŸŸข

Part of the Interlace ESLint Ecosystem โ€” AI-native security plugins with LLM-optimized error messages:

PluginDownloadsDescription
eslint-plugin-secure-codingdownloadsGeneral security rules & OWASP guidelines.
eslint-plugin-pgdownloadsPostgreSQL security & best practices.
eslint-plugin-node-securitydownloadsNode.js core-module security (fs, child_process, vm, crypto, Buffer).
eslint-plugin-jwtdownloadsJWT security & best practices.
eslint-plugin-browser-securitydownloadsBrowser-specific security & XSS prevention.
eslint-plugin-express-securitydownloadsExpress.js security hardening rules.
eslint-plugin-lambda-securitydownloadsAWS Lambda security best practices.
eslint-plugin-nestjs-securitydownloadsNestJS security rules & patterns.
eslint-plugin-mongodb-securitydownloadsMongoDB security best practices.
eslint-plugin-vercel-ai-securitydownloadsVercel AI SDK security hardening.
eslint-plugin-import-nextdownloadsNext-gen import sorting & architecture.

โญ Support & follow

If this plugin caught a real bug for you, star the repo โ€” stars are the signal that keeps the Interlace ESLint ecosystem maintained โ€” and follow the writeups on Dev.to for the benchmarks and security research behind these rules.

GitHub stars

๐Ÿ“„ License

MIT ยฉ Ofri Peretz

ESLint Interlace Plugin

View README.md on GitHub โ†’

On this page

No Headings