eslint-plugin-node-security 4.0.4 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +23 -0
  3. package/README.md +76 -55
  4. package/package.json +16 -3
  5. package/src/index.js +23 -3
  6. package/src/index.js.map +1 -1
  7. package/src/oxlint.d.ts +20 -0
  8. package/src/oxlint.js +22 -0
  9. package/src/oxlint.js.map +1 -0
  10. package/src/rules/detect-child-process/index.js +26 -6
  11. package/src/rules/detect-child-process/index.js.map +1 -1
  12. package/src/rules/detect-eval-with-expression/index.js +16 -5
  13. package/src/rules/detect-eval-with-expression/index.js.map +1 -1
  14. package/src/rules/detect-non-literal-fs-filename/index.js +14 -7
  15. package/src/rules/detect-non-literal-fs-filename/index.js.map +1 -1
  16. package/src/rules/detect-suspicious-dependencies/index.js +4 -0
  17. package/src/rules/detect-suspicious-dependencies/index.js.map +1 -1
  18. package/src/rules/lock-file/index.js +25 -9
  19. package/src/rules/lock-file/index.js.map +1 -1
  20. package/src/rules/no-arbitrary-file-access/index.js +5 -2
  21. package/src/rules/no-arbitrary-file-access/index.js.map +1 -1
  22. package/src/rules/no-buffer-overread/index.js +35 -3
  23. package/src/rules/no-buffer-overread/index.js.map +1 -1
  24. package/src/rules/no-cryptojs/index.js +3 -0
  25. package/src/rules/no-cryptojs/index.js.map +1 -1
  26. package/src/rules/no-cryptojs-weak-random/index.js +3 -0
  27. package/src/rules/no-cryptojs-weak-random/index.js.map +1 -1
  28. package/src/rules/no-data-in-temp-storage/index.js +3 -0
  29. package/src/rules/no-data-in-temp-storage/index.js.map +1 -1
  30. package/src/rules/no-deprecated-buffer/index.d.ts +23 -0
  31. package/src/rules/no-deprecated-buffer/index.js +73 -0
  32. package/src/rules/no-deprecated-buffer/index.js.map +1 -0
  33. package/src/rules/no-deprecated-cipher-method/index.js +3 -0
  34. package/src/rules/no-deprecated-cipher-method/index.js.map +1 -1
  35. package/src/rules/no-dynamic-dependency-loading/index.js +3 -0
  36. package/src/rules/no-dynamic-dependency-loading/index.js.map +1 -1
  37. package/src/rules/no-dynamic-require/index.js +6 -1
  38. package/src/rules/no-dynamic-require/index.js.map +1 -1
  39. package/src/rules/no-ecb-mode/index.js +3 -0
  40. package/src/rules/no-ecb-mode/index.js.map +1 -1
  41. package/src/rules/no-insecure-key-derivation/index.js +3 -0
  42. package/src/rules/no-insecure-key-derivation/index.js.map +1 -1
  43. package/src/rules/no-insecure-rsa-padding/index.js +3 -0
  44. package/src/rules/no-insecure-rsa-padding/index.js.map +1 -1
  45. package/src/rules/no-math-random-crypto/index.d.ts +30 -0
  46. package/src/rules/no-math-random-crypto/index.js +210 -0
  47. package/src/rules/no-math-random-crypto/index.js.map +1 -0
  48. package/src/rules/no-pii-in-logs/index.js +3 -0
  49. package/src/rules/no-pii-in-logs/index.js.map +1 -1
  50. package/src/rules/no-self-signed-certs/index.js +3 -0
  51. package/src/rules/no-self-signed-certs/index.js.map +1 -1
  52. package/src/rules/no-sha1-hash/index.js +3 -0
  53. package/src/rules/no-sha1-hash/index.js.map +1 -1
  54. package/src/rules/no-ssrf/index.js +4 -1
  55. package/src/rules/no-ssrf/index.js.map +1 -1
  56. package/src/rules/no-static-iv/index.js +3 -0
  57. package/src/rules/no-static-iv/index.js.map +1 -1
  58. package/src/rules/no-timing-unsafe-compare/index.js +3 -0
  59. package/src/rules/no-timing-unsafe-compare/index.js.map +1 -1
  60. package/src/rules/no-toctou-vulnerability/index.js +5 -2
  61. package/src/rules/no-toctou-vulnerability/index.js.map +1 -1
  62. package/src/rules/no-unsafe-dynamic-require/index.js +4 -1
  63. package/src/rules/no-unsafe-dynamic-require/index.js.map +1 -1
  64. package/src/rules/no-weak-cipher-algorithm/index.js +3 -0
  65. package/src/rules/no-weak-cipher-algorithm/index.js.map +1 -1
  66. package/src/rules/no-weak-hash-algorithm/index.js +3 -0
  67. package/src/rules/no-weak-hash-algorithm/index.js.map +1 -1
  68. package/src/rules/no-zip-slip/index.js +40 -63
  69. package/src/rules/no-zip-slip/index.js.map +1 -1
  70. package/src/rules/prefer-native-crypto/index.js +3 -0
  71. package/src/rules/prefer-native-crypto/index.js.map +1 -1
  72. package/src/rules/require-dependency-integrity/index.js +3 -0
  73. package/src/rules/require-dependency-integrity/index.js.map +1 -1
  74. package/src/rules/require-secure-credential-storage/index.js +3 -0
  75. package/src/rules/require-secure-credential-storage/index.js.map +1 -1
  76. package/src/rules/require-secure-deletion/index.js +3 -0
  77. package/src/rules/require-secure-deletion/index.js.map +1 -1
  78. package/src/rules/require-storage-encryption/index.js +3 -0
  79. package/src/rules/require-storage-encryption/index.js.map +1 -1
  80. package/src/types/index.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## [4.1.0] - 2026-05-03
2
+
3
+ ### Added
4
+
5
+ - New rule `no-deprecated-buffer` — flags use of the deprecated `Buffer()` constructor (Node.js security advisory; `Buffer.from`/`Buffer.alloc` should be used instead). Enabled in the `recommended` preset at `warn` to avoid breaking adopters with legacy `Buffer()` calls; will be promoted to `error` in the next major.
6
+
7
+ ### Bug Fixes
8
+
9
+ - `no-zip-slip`: removed redundant dangerous-destination check from the literal handler. Extraction-call handler already reports `dangerousArchiveDestination`; the literal-side check was producing duplicate errors and (separately) firing on unrelated calls like `fs.readFileSync('/etc/app/config')`.
10
+ - `lock-file`, `detect-child-process`: minor refinements (see source diff).
11
+
12
+ ## [4.0.4] - 2026-02-08
13
+
14
+ ### Bug Fixes
15
+
16
+ - align codecov component IDs with full package names ([2831b968](https://github.com/ofri-peretz/eslint/commit/2831b968))
17
+ - resolve all benchmark FN/FP across security rules ([45ffb791](https://github.com/ofri-peretz/eslint/commit/45ffb791))
18
+ - **rules:** reduce false positives across security rules ([c192233c](https://github.com/ofri-peretz/eslint/commit/c192233c))
19
+
20
+ ### Documentation
21
+
22
+ - fix changelog header format across all packages ([c3a15082](https://github.com/ofri-peretz/eslint/commit/c3a15082))
23
+
24
+ ### ❤️ Thank You
25
+
26
+ - Ofri Peretz
27
+
1
28
  ## [4.0.3] - 2026-02-06
2
29
 
3
30
  ### Bug Fixes
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ofri Peretz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <a href="https://eslint.interlace.tools" target="blank"><img src="https://eslint.interlace.tools/eslint-interlace-logo-light.svg" alt="ESLint Interlace Logo" width="120" /></a>
2
+ <a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security" target="blank"><img src="https://eslint.interlace.tools/eslint-interlace-logo-light.svg" alt="ESLint Interlace Logo" width="120" /></a>
3
3
  </p>
4
4
 
5
5
  <p align="center">
@@ -10,14 +10,13 @@
10
10
  <a href="https://www.npmjs.com/package/eslint-plugin-node-security" target="_blank"><img src="https://img.shields.io/npm/v/eslint-plugin-node-security.svg" alt="NPM Version" /></a>
11
11
  <a href="https://www.npmjs.com/package/eslint-plugin-node-security" target="_blank"><img src="https://img.shields.io/npm/dm/eslint-plugin-node-security.svg" alt="NPM Downloads" /></a>
12
12
  <a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="Package License" /></a>
13
- <a href="https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=node-security" target="_blank"><img src="https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?component=eslint-plugin-node-security" alt="Codecov" /></a>
13
+ <a href="https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=node-security" target="_blank"><img src="https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?component=node-security" alt="Codecov" /></a>
14
14
  <a href="https://github.com/ofri-peretz/eslint" target="_blank"><img src="https://img.shields.io/badge/Since-Dec_2025-blue?logo=rocket&logoColor=white" alt="Since Dec 2025" /></a>
15
15
  </p>
16
16
 
17
17
  ## Description
18
18
 
19
19
  This plugin provides Security rules for Node.js core modules (fs, child_process, crypto, etc).
20
- By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.
21
20
 
22
21
  ## Philosophy
23
22
 
@@ -25,17 +24,25 @@ By using this plugin, you can proactively identify and mitigate security risks a
25
24
 
26
25
  ## Getting Started
27
26
 
28
- - To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-node-security), visit [eslint.interlace.tools](https://eslint.interlace.tools). 📚
29
- - 要查看中文 [指南](https://eslint.interlace.tools/docs/security/plugin-node-security), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools). 📚
30
- - [가이드](https://eslint.interlace.tools/docs/security/plugin-node-security) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools)에서 확인하실 수 있습니다. 📚
31
- - [ガイド](https://eslint.interlace.tools/docs/security/plugin-node-security)は [eslint.interlace.tools](https://eslint.interlace.tools)でご確認ください。 📚
32
- - Para ver la [guía](https://eslint.interlace.tools/docs/security/plugin-node-security), visita [eslint.interlace.tools](https://eslint.interlace.tools). 📚
33
- - للاطلاع على [الدليل](https://eslint.interlace.tools/docs/security/plugin-node-security)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools). 📚
27
+ - To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-node-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security). 📚
28
+ - 要查看中文 [指南](https://eslint.interlace.tools/docs/security/plugin-node-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security). 📚
29
+ - [가이드](https://eslint.interlace.tools/docs/security/plugin-node-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security)에서 확인하실 수 있습니다. 📚
30
+ - [ガイド](https://eslint.interlace.tools/docs/security/plugin-node-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security)は [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security)でご確認ください。 📚
31
+ - Para ver la [guía](https://eslint.interlace.tools/docs/security/plugin-node-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security), visita [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security). 📚
32
+ - للاطلاع على [الدليل](https://eslint.interlace.tools/docs/security/plugin-node-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security). 📚
34
33
 
35
34
  ```bash
36
35
  npm install eslint-plugin-node-security --save-dev
37
36
  ```
38
37
 
38
+ ## ⚙️ Configuration Presets
39
+ | Preset | Description |
40
+ | :------------ | :---------------------------------------------------- |
41
+ | `recommended` | Balanced security for most Node.js projects |
42
+ | `strict` | Maximum security enforcement (all rules as errors) |
43
+ | `fs-security` | Focus on file system vulnerabilities (CWE-22, CWE-73) |
44
+ | `crypto` | Cryptographic security rules only |
45
+
39
46
  ## 💡 What You Get
40
47
  - **31 security rules** covering Node.js core module vulnerabilities
41
48
  - **Command Injection Detection** for `child_process.exec`, `spawn`, and `execFile`
@@ -44,15 +51,13 @@ npm install eslint-plugin-node-security --save-dev
44
51
  - **Cryptographic Security** for weak algorithms and key management
45
52
  - **LLM-optimized messages** with CWE references and fix guidance
46
53
 
47
- ## ⚙️ Configuration Presets
48
- | Preset | Description |
49
- | :------------ | :---------------------------------------------------- |
50
- | `recommended` | Balanced security for most Node.js projects |
51
- | `strict` | Maximum security enforcement (all rules as errors) |
52
- | `fs-security` | Focus on file system vulnerabilities (CWE-22, CWE-73) |
53
- | `crypto` | Cryptographic security rules only |
54
+ ## 📦 Compatibility
55
+ | Package | Version |
56
+ | :--- | :--- |
57
+ | ESLint | `^8.0.0 \|\| ^9.0.0 \|\| ^10.0.0` |
58
+ | Node.js | `>=18.0.0` |
54
59
 
55
- ---
60
+ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md) — current ecosystem share data, the 20% gate, and the forward-looking exception that covers v10.
56
61
 
57
62
  ## Rules
58
63
 
@@ -61,45 +66,52 @@ npm install eslint-plugin-node-security --save-dev
61
66
  | Icon | Description |
62
67
  | :---: | :--- |
63
68
  | 💼 | **Recommended**: Included in the recommended preset. |
64
- | ⚠️ | **Warns**: Set towarn in recommended preset. |
69
+ | ⚠️ | **Warns**: Set to warn in recommended preset. |
65
70
  | 🔧 | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
66
71
  | 💡 | **Suggestions**: Providing code suggestions in IDE. |
67
72
  | 🚫 | **Deprecated**: This rule is deprecated. |
68
-
69
- | Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
70
- | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
71
- | [detect-child-process](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/detect-child-process) | CWE-78 | | 9.8 | ESLint rule documentation for detect-child-process | 💼 | | | 💡 | |
72
- | [detect-eval-with-expression](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/detect-eval-with-expression) | CWE-95 | | 9.8 | ESLint rule documentation for detect-eval-with-expression | 💼 | | | | |
73
- | [detect-non-literal-fs-filename](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/detect-non-literal-fs-filename) | CWE-22 | | 7.5 | ESLint rule documentation for detect-non-literal-fs-filename | 💼 | | | 💡 | |
74
- | [detect-suspicious-dependencies](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/detect-suspicious-dependencies) | CWE-829 | | 8.2 | ESLint rule documentation for detect-suspicious-dependencies | 💼 | | | | |
75
- | [lock-file](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/lock-file) | CWE-829 | | 7.5 | ESLint rule documentation for lock-file | 💼 | | | | |
76
- | [no-arbitrary-file-access](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-arbitrary-file-access) | CWE-22 | | 7.5 | ESLint rule documentation for no-arbitrary-file-access | 💼 | | | | |
77
- | [no-buffer-overread](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-buffer-overread) | CWE-126 | | 7.5 | ESLint rule documentation for no-buffer-overread | 💼 | | | | |
78
- | [no-cryptojs](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-cryptojs) | CWE-327 | | 5.0 | ESLint rule documentation for no-cryptojs | 💼 | ⚠️ | | 💡 | |
79
- | [no-cryptojs-weak-random](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-cryptojs-weak-random) | CWE-338 | | 5.3 | ESLint rule documentation for no-cryptojs-weak-random | 💼 | | | 💡 | |
80
- | [no-data-in-temp-storage](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-data-in-temp-storage) | CWE-312 | | 7.5 | ESLint rule documentation for no-data-in-temp-storage | | ⚠️ | | | |
81
- | [no-deprecated-cipher-method](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-deprecated-cipher-method) | CWE-327 | | 5.0 | ESLint rule documentation for no-deprecated-cipher-method | 💼 | | | 💡 | |
82
- | [no-dynamic-dependency-loading](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-dynamic-dependency-loading) | CWE-829 | | 7.5 | ESLint rule documentation for no-dynamic-dependency-loading | | ⚠️ | | | |
83
- | [no-dynamic-require](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-dynamic-require) | CWE-706 | | 7.5 | ESLint rule documentation for no-dynamic-require | | ⚠️ | | | |
84
- | [no-ecb-mode](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-ecb-mode) | CWE-327 | | 7.5 | ESLint rule documentation for no-ecb-mode | 💼 | | | 💡 | |
85
- | [no-insecure-key-derivation](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-insecure-key-derivation) | CWE-916 | | 7.5 | ESLint rule documentation for no-insecure-key-derivation | 💼 | | | 💡 | |
86
- | [no-insecure-rsa-padding](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-insecure-rsa-padding) | CWE-327 | | 7.4 | ESLint rule documentation for no-insecure-rsa-padding | 💼 | | | 💡 | |
87
- | [no-pii-in-logs](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-pii-in-logs) | CWE-532 | | 7.5 | ESLint rule documentation for no-pii-in-logs | | ⚠️ | | | |
88
- | [no-self-signed-certs](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-self-signed-certs) | CWE-295 | | 7.5 | ESLint rule documentation for no-self-signed-certs | 💼 | | | 💡 | |
89
- | [no-sha1-hash](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-sha1-hash) | CWE-327 | | 7.5 | ESLint rule documentation for no-sha1-hash | 💼 | | | 💡 | |
90
- | [no-static-iv](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-static-iv) | CWE-329 | | 7.5 | ESLint rule documentation for no-static-iv | 💼 | | | 💡 | |
91
- | [no-timing-unsafe-compare](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-timing-unsafe-compare) | CWE-208 | | 5.9 | ESLint rule documentation for no-timing-unsafe-compare | 💼 | ⚠️ | | 💡 | |
92
- | [no-toctou-vulnerability](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-toctou-vulnerability) | CWE-367 | | 7.0 | ESLint rule documentation for no-toctou-vulnerability | 💼 | | | 💡 | |
93
- | [no-unsafe-dynamic-require](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-unsafe-dynamic-require) | CWE-706 | | 7.5 | ESLint rule documentation for no-unsafe-dynamic-require | 💼 | | | 💡 | |
94
- | [no-weak-cipher-algorithm](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-weak-cipher-algorithm) | CWE-327 | | 7.5 | ESLint rule documentation for no-weak-cipher-algorithm | 💼 | | | 💡 | |
95
- | [no-weak-hash-algorithm](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-weak-hash-algorithm) | CWE-327 | | 7.5 | ESLint rule documentation for no-weak-hash-algorithm | 💼 | | | 💡 | |
96
- | [no-zip-slip](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-zip-slip) | CWE-22 | | 8.1 | ESLint rule documentation for no-zip-slip | 💼 | | | | |
97
- | [prefer-native-crypto](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/prefer-native-crypto) | CWE-327 | | 5.0 | ESLint rule documentation for prefer-native-crypto | 💼 | ⚠️ | | 💡 | |
98
- | [require-dependency-integrity](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/require-dependency-integrity) | CWE-494 | | 7.5 | ESLint rule documentation for require-dependency-integrity | | | | | |
99
- | [require-secure-credential-storage](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/require-secure-credential-storage) | CWE-522 | | 7.5 | ESLint rule documentation for require-secure-credential-storage | | | | | |
100
- | [require-secure-deletion](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/require-secure-deletion) | CWE-459 | | 7.5 | ESLint rule documentation for require-secure-deletion | | | | | |
101
- | [require-storage-encryption](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/require-storage-encryption) | CWE-311 | | 7.5 | ESLint rule documentation for require-storage-encryption | | | | | |
102
-
73
+ | 🟢 | **Type-unaware**: AST-only, runs in oxlint JS-plugin tier. |
74
+ | 🟡 | **Type-aware (refining)**: pure-AST primary path; types refine precision. |
75
+ | 🟠 | **Type-aware (graceful)**: requires TS program; silent without it. |
76
+
77
+ <!-- AUTO-GENERATED:RULES_TABLE:START - Do not edit manually -->
78
+ | Rule | CWE | OWASP | CVSS | Description | 🧠 | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
79
+ | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
80
+ | [detect-child-process](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/detect-child-process?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-78 | | | Detects instances of childprocess & non-literal exec() calls that may allow command injection | 🟢 | | | | | |
81
+ | [detect-eval-with-expression](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/detect-eval-with-expression?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-95 | A03:2021 | | Detects eval(variable) which can allow an attacker to run arbitrary code inside your process | 🟢 | | | | | |
82
+ | [detect-non-literal-fs-filename](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/detect-non-literal-fs-filename?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-22 | | | Detects variable in filename argument of fs calls, which might allow an attacker to access anything on your… | 🟢 | | | | | |
83
+ | [detect-suspicious-dependencies](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/detect-suspicious-dependencies?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-506 | | | This rule detects package imports that look like typosquatting attempts on popular npm packages | 🟢 | | | | | |
84
+ | [lock-file](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/lock-file?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-829 | | | CWE: [CWE-829](https://cwe.mitre.org/data/definitions/829.html) | 🟢 | | | | | |
85
+ | [no-arbitrary-file-access](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-arbitrary-file-access?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-22 | A01:2021 | | Prevents file system access with unsanitized user input to protect against path traversal attacks. | 🟢 | | | | | |
86
+ | [no-buffer-overread](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-buffer-overread?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-126 | | | Detects buffer access beyond bounds | 🟢 | | | | | |
87
+ | [no-cryptojs](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-cryptojs?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-1104 | A06:2021 | | Disallow deprecated crypto-js library (use native crypto instead) | 🟢 | | | | | |
88
+ | [no-cryptojs-weak-random](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-cryptojs-weak-random?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-338 | A02:2021 | | Disallow crypto-js WordArray.random() (CVE-2020-36732) | 🟢 | | | | | |
89
+ | [no-data-in-temp-storage](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-data-in-temp-storage?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-312 | | | Temporary directories (/tmp, /var/tmp, temp/) are often world-readable or persist longer than expected | 🟢 | | | | | |
90
+ | [no-deprecated-buffer](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-deprecated-buffer?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-676 | | | Disallow the deprecated `new Buffer()` constructor and `Buffer()` factory call. | 🟢 | | | | 💡 | |
91
+ | [no-deprecated-cipher-method](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-deprecated-cipher-method?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-327 | A02:2021 | | Disallow deprecated crypto.createCipher/createDecipher methods | 🟢 | | | | | |
92
+ | [no-dynamic-dependency-loading](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-dynamic-dependency-loading?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-1104 | | | This rule detects dynamically constructed paths in require() and import() statements | 🟢 | | | | | |
93
+ | [no-dynamic-require](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-dynamic-require?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | | | | Forbid require() calls with non-literal arguments | 🟢 | | | | | |
94
+ | [no-ecb-mode](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-ecb-mode?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-327 | A02:2021 | | Disallow ECB encryption mode (use GCM or CBC instead) | 🟢 | | | | | |
95
+ | [no-insecure-key-derivation](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-insecure-key-derivation?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-916 | A02:2021 | | Disallow PBKDF2 with insufficient iterations (< 100,000) | 🟢 | | | | | |
96
+ | [no-insecure-rsa-padding](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-insecure-rsa-padding?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-327 | A02:2021 | | Disallow RSA PKCS#1 v1.5 padding (CVE-2023-46809 Marvin Attack) | 🟢 | | | | | |
97
+ | [no-math-random-crypto](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-math-random-crypto?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-338 | A02:2021 | | Disallow Math.random() for cryptographic purposes (tokens, keys, secrets) | 🟢 | | ⚠️ | | 💡 | |
98
+ | [no-pii-in-logs](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-pii-in-logs?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-532 | | | CWE: [CWE-532](https://cwe.mitre.org/data/definitions/532.html) | 🟢 | | | | | |
99
+ | [no-self-signed-certs](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-self-signed-certs?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-295 | A07:2021 | | Disallow rejectUnauthorized false in TLS options | 🟢 | | | | | |
100
+ | [no-sha1-hash](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-sha1-hash?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-327 | A02:2021 | | Disallow sha1() from crypto-hash package (use sha256 or sha512) | 🟢 | | | | | |
101
+ | [no-ssrf](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-ssrf?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-918 | A10:2021 | | Detect HTTP requests with user-controlled URLs (server-side request forgery). | 🟢 | | | | 💡 | |
102
+ | [no-static-iv](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-static-iv?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-329 | A02:2021 | | Disallow static or hardcoded initialization vectors (IVs) | 🟢 | | | | | |
103
+ | [no-timing-unsafe-compare](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-timing-unsafe-compare?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-208 | A02:2021 | | Disallow timing-unsafe comparison of secrets | 🟢 | | | | | |
104
+ | [no-toctou-vulnerability](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-toctou-vulnerability?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-367 | A01:2021 | | Detects Time-of-Check-Time-of-Use (TOCTOU) race condition vulnerabilities in file system operations. | 🟢 | | | | | |
105
+ | [no-unsafe-dynamic-require](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-unsafe-dynamic-require?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-494 | | | Disallows dynamic require() calls with non-literal arguments that could lead to security vulnerabilities | 🟢 | | | | | |
106
+ | [no-weak-cipher-algorithm](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-weak-cipher-algorithm?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-327 | A02:2021 | | Disallow weak cipher algorithms (DES, 3DES, RC4, Blowfish, RC2, IDEA) | 🟢 | | | | | |
107
+ | [no-weak-hash-algorithm](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-weak-hash-algorithm?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-327 | A02:2021 | | Disallow weak hash algorithms (MD5, MD4, SHA-1, RIPEMD) | 🟢 | | | | | |
108
+ | [no-zip-slip](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/no-zip-slip?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-22 | | | Detects zip slip/archive extraction vulnerabilities | 🟢 | | | | | |
109
+ | [prefer-native-crypto](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/prefer-native-crypto?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-1104 | A06:2021 | | Prefer native crypto over third-party libraries | 🟢 | | | | | |
110
+ | [require-dependency-integrity](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/require-dependency-integrity?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-494 | | | CWE: [CWE-494](https://cwe.mitre.org/data/definitions/494.html) | 🟢 | | | | | |
111
+ | [require-secure-credential-storage](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/require-secure-credential-storage?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-312 | | | This rule detects when credentials are stored using localStorage.setItem() or fs.writeFile() without encryp… | 🟢 | | | | | |
112
+ | [require-secure-deletion](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/require-secure-deletion?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-459 | | | CWE: [CWE-459](https://cwe.mitre.org/data/definitions/459.html) | 🟢 | | | | | |
113
+ | [require-storage-encryption](https://eslint.interlace.tools/docs/security/plugin-node-security/rules/require-storage-encryption?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security) | CWE-312 | | | CWE: [CWE-312](https://cwe.mitre.org/data/definitions/312.html) | 🟢 | | | | | |
114
+ <!-- AUTO-GENERATED:RULES_TABLE:END -->
103
115
  ## 🔗 Related ESLint Plugins
104
116
 
105
117
  Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
@@ -108,7 +120,7 @@ Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with L
108
120
  | :--- | :---: | :--- |
109
121
  | [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-secure-coding.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-secure-coding) | General security rules & OWASP guidelines. |
110
122
  | [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-pg.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL security & best practices. |
111
- | [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-crypto.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-crypto) | NodeJS Cryptography security rules. |
123
+ | [`eslint-plugin-node-security`](https://www.npmjs.com/package/eslint-plugin-node-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-node-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-node-security) | Node.js core-module security (fs, child_process, vm, crypto, Buffer). |
112
124
  | [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-jwt.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
113
125
  | [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-browser-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-browser-security) | Browser-specific security & XSS prevention. |
114
126
  | [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-express-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-express-security) | Express.js security hardening rules. |
@@ -118,10 +130,19 @@ Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with L
118
130
  | [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-vercel-ai-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security hardening. |
119
131
  | [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-import-next.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-import-next) | Next-gen import sorting & architecture. |
120
132
 
133
+ <!-- INTERLACE:STAR_CTA:START -->
134
+ ## ⭐ Support & follow
135
+
136
+ If this plugin caught a real bug for you, **[star the repo](https://github.com/ofri-peretz/eslint)** — stars are the signal that keeps the Interlace ESLint ecosystem maintained — and **[follow the writeups on Dev.to](https://dev.to/ofri-peretz)** for the benchmarks and security research behind these rules.
137
+
138
+ [![GitHub stars](https://img.shields.io/github/stars/ofri-peretz/eslint?style=social)](https://github.com/ofri-peretz/eslint)
139
+
140
+ <!-- INTERLACE:STAR_CTA:END -->
141
+
121
142
  ## 📄 License
122
143
 
123
144
  MIT © [Ofri Peretz](https://github.com/ofri-peretz)
124
145
 
125
146
  <p align="center">
126
- <a href="https://eslint.interlace.tools/docs/security/plugin-node-security"><img src="https://eslint.interlace.tools/images/og-node-security.png" alt="ESLint Interlace Plugin" width="100%" /></a>
147
+ <a href="https://eslint.interlace.tools/docs/security/plugin-node-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-node-security"><img src="https://eslint.interlace.tools/images/og-node-security.png" alt="ESLint Interlace Plugin" width="100%" /></a>
127
148
  </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-node-security",
3
- "version": "4.0.4",
3
+ "version": "4.2.0",
4
4
  "description": "Security-focused ESLint plugin for Node.js built-in modules (fs, child_process, vm, path, Buffer). Detects command injection, path traversal, code execution vulnerabilities with AI-parseable error messages.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -13,11 +13,15 @@
13
13
  "./types": {
14
14
  "types": "./src/types/index.d.ts",
15
15
  "default": "./src/types/index.js"
16
+ },
17
+ "./oxlint": {
18
+ "types": "./src/oxlint.d.ts",
19
+ "default": "./src/oxlint.js"
16
20
  }
17
21
  },
18
22
  "author": "Ofri Peretz <ofriperetzdev@gmail.com>",
19
23
  "license": "MIT",
20
- "homepage": "https://github.com/ofri-peretz/eslint/tree/main/packages/eslint-plugin-node-security#readme",
24
+ "homepage": "https://eslint.interlace.tools/docs/security/plugin-node-security?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-node-security",
21
25
  "repository": {
22
26
  "type": "git",
23
27
  "url": "https://github.com/ofri-peretz/eslint",
@@ -75,5 +79,14 @@
75
79
  "devDependencies": {
76
80
  "@typescript-eslint/parser": "^8.46.2",
77
81
  "@typescript-eslint/rule-tester": "^8.46.2"
82
+ },
83
+ "scripts": {
84
+ "build": "tsx ../../scripts/build-package.ts",
85
+ "test": "vitest run",
86
+ "test:coverage": "vitest run --coverage",
87
+ "typecheck": "tsc -p tsconfig.lib.json --noEmit"
88
+ },
89
+ "peerDependencies": {
90
+ "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
78
91
  }
79
- }
92
+ }
package/src/index.js CHANGED
@@ -11,10 +11,12 @@ const detect_eval_with_expression_1 = require("./rules/detect-eval-with-expressi
11
11
  const detect_non_literal_fs_filename_1 = require("./rules/detect-non-literal-fs-filename");
12
12
  const no_unsafe_dynamic_require_1 = require("./rules/no-unsafe-dynamic-require");
13
13
  const no_buffer_overread_1 = require("./rules/no-buffer-overread");
14
+ const no_deprecated_buffer_1 = require("./rules/no-deprecated-buffer");
14
15
  const no_toctou_vulnerability_1 = require("./rules/no-toctou-vulnerability");
15
16
  const no_zip_slip_1 = require("./rules/no-zip-slip");
16
17
  const no_arbitrary_file_access_1 = require("./rules/no-arbitrary-file-access");
17
18
  const no_data_in_temp_storage_1 = require("./rules/no-data-in-temp-storage");
19
+ const no_pii_in_logs_1 = require("./rules/no-pii-in-logs");
18
20
  const no_ssrf_1 = require("./rules/no-ssrf");
19
21
  // Migrated rules from secure-coding
20
22
  const detect_suspicious_dependencies_1 = require("./rules/detect-suspicious-dependencies");
@@ -31,6 +33,7 @@ const no_cryptojs_weak_random_1 = require("./rules/no-cryptojs-weak-random");
31
33
  const no_deprecated_cipher_method_1 = require("./rules/no-deprecated-cipher-method");
32
34
  const no_ecb_mode_1 = require("./rules/no-ecb-mode");
33
35
  const no_insecure_key_derivation_1 = require("./rules/no-insecure-key-derivation");
36
+ const no_math_random_crypto_1 = require("./rules/no-math-random-crypto");
34
37
  const no_insecure_rsa_padding_1 = require("./rules/no-insecure-rsa-padding");
35
38
  const no_self_signed_certs_1 = require("./rules/no-self-signed-certs");
36
39
  const no_sha1_hash_1 = require("./rules/no-sha1-hash");
@@ -45,10 +48,12 @@ exports.rules = {
45
48
  'detect-non-literal-fs-filename': detect_non_literal_fs_filename_1.detectNonLiteralFsFilename,
46
49
  'no-unsafe-dynamic-require': no_unsafe_dynamic_require_1.noUnsafeDynamicRequire,
47
50
  'no-buffer-overread': no_buffer_overread_1.noBufferOverread,
51
+ 'no-deprecated-buffer': no_deprecated_buffer_1.noDeprecatedBuffer,
48
52
  'no-toctou-vulnerability': no_toctou_vulnerability_1.noToctouVulnerability,
49
53
  'no-zip-slip': no_zip_slip_1.noZipSlip,
50
54
  'no-arbitrary-file-access': no_arbitrary_file_access_1.noArbitraryFileAccess,
51
55
  'no-data-in-temp-storage': no_data_in_temp_storage_1.noDataInTempStorage,
56
+ 'no-pii-in-logs': no_pii_in_logs_1.noPiiInLogs,
52
57
  'no-ssrf': no_ssrf_1.noSsrf,
53
58
  // Migrated rules
54
59
  'detect-suspicious-dependencies': detect_suspicious_dependencies_1.detectSuspiciousDependencies,
@@ -66,6 +71,7 @@ exports.rules = {
66
71
  'no-ecb-mode': no_ecb_mode_1.noEcbMode,
67
72
  'no-insecure-key-derivation': no_insecure_key_derivation_1.noInsecureKeyDerivation,
68
73
  'no-insecure-rsa-padding': no_insecure_rsa_padding_1.noInsecureRsaPadding,
74
+ 'no-math-random-crypto': no_math_random_crypto_1.noMathRandomCrypto,
69
75
  'no-self-signed-certs': no_self_signed_certs_1.noSelfSignedCerts,
70
76
  'no-sha1-hash': no_sha1_hash_1.noSha1Hash,
71
77
  'no-static-iv': no_static_iv_1.noStaticIv,
@@ -77,7 +83,7 @@ exports.rules = {
77
83
  exports.plugin = {
78
84
  meta: {
79
85
  name: 'eslint-plugin-node-security',
80
- version: '1.0.0',
86
+ version: '4.2.0',
81
87
  },
82
88
  rules: exports.rules,
83
89
  };
@@ -86,7 +92,17 @@ const recommendedRules = {
86
92
  'node-security/detect-eval-with-expression': 'error',
87
93
  'node-security/detect-non-literal-fs-filename': 'error',
88
94
  'node-security/no-unsafe-dynamic-require': 'error',
89
- 'node-security/no-buffer-overread': 'error',
95
+ // no-buffer-overread demoted 2026-05-09 — 95% of Wild hits on adversarial
96
+ // Edge corpus + insufficient fixture coverage for the README §1 promotion
97
+ // gate. Per `npm run ilb:severity-audit` it's both edge-error AND
98
+ // volume-error risk. Promote back to 'error' once Edge ratio drops to
99
+ // ≤ 50% (see `benchmarks/AUDIT_PATTERNS.md` §3.6 — needs typed-array
100
+ // detection like `detect-object-injection` got in audit iter-1).
101
+ 'node-security/no-buffer-overread': 'warn',
102
+ // Added in 4.1.0. Set to 'warn' in `recommended` to avoid breaking
103
+ // adopters who already use the preset and have legacy `Buffer()` calls.
104
+ // Promote to 'error' on the next major bump.
105
+ 'node-security/no-deprecated-buffer': 'warn',
90
106
  'node-security/no-toctou-vulnerability': 'error',
91
107
  'node-security/no-zip-slip': 'error',
92
108
  'node-security/no-arbitrary-file-access': 'error',
@@ -101,6 +117,7 @@ const recommendedRules = {
101
117
  'node-security/no-weak-cipher-algorithm': 'error',
102
118
  'node-security/no-static-iv': 'error',
103
119
  'node-security/no-ecb-mode': 'error',
120
+ 'node-security/no-math-random-crypto': 'error',
104
121
  'node-security/no-cryptojs': 'warn',
105
122
  };
106
123
  exports.configs = {
@@ -114,7 +131,10 @@ exports.configs = {
114
131
  plugins: {
115
132
  'node-security': exports.plugin,
116
133
  },
117
- rules: Object.fromEntries(Object.keys(exports.rules).map(ruleName => [`node-security/${ruleName}`, 'error'])),
134
+ rules: Object.fromEntries(Object.keys(exports.rules).map((ruleName) => [
135
+ `node-security/${ruleName}`,
136
+ 'error',
137
+ ])),
118
138
  },
119
139
  };
120
140
  exports.default = exports.plugin;
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/eslint-plugin-node-security/src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,uEAAkE;AAClE,qFAA+E;AAC/E,2FAAoF;AACpF,iFAA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A2B,EAAE,OAAO;IACpC,qCAAqC,EAAE,OAAO;IAC9C,2BAA2B,EAAE,MAAM;CACpC,CAAC;AAEW,QAAA,OAAO,GAA+C;IACjE,WAAW,EAAE;QACX,OAAO,EAAE;YACP,eAAe,EAAE,cAAM;SACxB;QACD,KAAK,EAAE,gBAAgB;KACa;IACtC,MAAM,EAAE;QACN,OAAO,EAAE;YACP,eAAe,EAAE,cAAM;SACxB;QACD,KAAK,EAAE,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,IAAI,CAAC,aAAK,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;YACnC,iBAAiB,QAAQ,EAAE;YAC3B,OAAO;SACR,CAAC,CACH;KACmC;CACvC,CAAC;AAEF,kBAAe,cAAM,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2025 Ofri Peretz
3
+ * Licensed under the MIT License. Use of this source code is governed by the
4
+ * MIT license that can be found in the LICENSE file.
5
+ */
6
+ /**
7
+ * oxlint sub-export.
8
+ *
9
+ * Consumers wire oxlint to this entry via:
10
+ * { "jsPlugins": ["eslint-plugin-node-security/oxlint"] }
11
+ *
12
+ * oxlint's JS plugin loader does `require('eslint-plugin-node-security/oxlint')` and reads
13
+ * `.rules` off the result. The compiled output of `export = plugin` is
14
+ * `module.exports = plugin`, which gives oxlint the plugin object directly
15
+ * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
16
+ *
17
+ * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
18
+ */
19
+ import { plugin } from './index';
20
+ export = plugin;
package/src/oxlint.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2025 Ofri Peretz
4
+ * Licensed under the MIT License. Use of this source code is governed by the
5
+ * MIT license that can be found in the LICENSE file.
6
+ */
7
+ /**
8
+ * oxlint sub-export.
9
+ *
10
+ * Consumers wire oxlint to this entry via:
11
+ * { "jsPlugins": ["eslint-plugin-node-security/oxlint"] }
12
+ *
13
+ * oxlint's JS plugin loader does `require('eslint-plugin-node-security/oxlint')` and reads
14
+ * `.rules` off the result. The compiled output of `export = plugin` is
15
+ * `module.exports = plugin`, which gives oxlint the plugin object directly
16
+ * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
17
+ *
18
+ * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
19
+ */
20
+ const index_1 = require("./index");
21
+ module.exports = index_1.plugin;
22
+ //# sourceMappingURL=oxlint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxlint.js","sourceRoot":"","sources":["../../src/oxlint.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH;;;;;;;;;;;;GAYG;AAEH,mCAAiC;AAEjC,iBAAS,cAAM,CAAC"}
@@ -15,6 +15,7 @@ const COMMAND_PATTERNS = [
15
15
  vulnerability: 'command-injection',
16
16
  safeAlternatives: ['execFile', 'spawn'],
17
17
  example: {
18
+ // oxlint-disable-next-line no-template-curly-in-string
18
19
  bad: 'exec(`git clone ${repoUrl}`)',
19
20
  good: [
20
21
  'execFile(\'git\', [\'clone\', repoUrl], {shell: false})',
@@ -28,7 +29,9 @@ const COMMAND_PATTERNS = [
28
29
  dangerous: true,
29
30
  vulnerability: 'command-injection',
30
31
  safeAlternatives: ['execFileSync', 'spawnSync'],
32
+ // oxlint-disable-next-line no-template-curly-in-string
31
33
  example: {
34
+ // oxlint-disable-next-line no-template-curly-in-string
32
35
  bad: 'execSync(`npm install ${packageName}`)',
33
36
  good: [
34
37
  'execFileSync(\'npm\', [\'install\', packageName], {shell: false})',
@@ -127,7 +130,11 @@ exports.detectChildProcess = (0, eslint_devkit_2.createRule)({
127
130
  meta: {
128
131
  type: 'problem',
129
132
  docs: {
133
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/detect-child-process.md',
130
134
  description: 'Detects child_process usage that may allow command injection',
135
+ cwe: 'CWE-78',
136
+ cvss: 9.5,
137
+ confidence: 'medium',
131
138
  },
132
139
  messages: {
133
140
  // 🎯 Token optimization: 44% reduction (55→31 tokens) - removes ❌/✅/📚 labels
@@ -270,6 +277,7 @@ exports.detectChildProcess = (0, eslint_devkit_2.createRule)({
270
277
  /**
271
278
  * Check if a node contains string interpolation or concatenation
272
279
  */
280
+ // oxlint-disable-next-line consistent-function-scoping
273
281
  const containsDynamicStrings = (node) => {
274
282
  if (node.type === 'TemplateLiteral') {
275
283
  return node.expressions.length > 0;
@@ -353,7 +361,7 @@ exports.detectChildProcess = (0, eslint_devkit_2.createRule)({
353
361
  return argNode.expressions.some(e => e.type === 'Identifier' && validatedVarNames.has(e.name));
354
362
  }
355
363
  if (argNode.type === eslint_devkit_1.AST_NODE_TYPES.ArrayExpression) {
356
- return argNode.elements.some(el => el != null && check(el));
364
+ return argNode.elements.some(el => el !== null && check(el));
357
365
  }
358
366
  return false;
359
367
  };
@@ -462,7 +470,7 @@ exports.detectChildProcess = (0, eslint_devkit_2.createRule)({
462
470
  else if (node.callee.type === 'Identifier') {
463
471
  method = node.callee.name;
464
472
  }
465
- const sourceCode = context.sourceCode || context.sourceCode;
473
+ const sourceCode = context.sourceCode;
466
474
  const args = node.arguments.map((arg) => sourceCode.getText(arg)).join(', ');
467
475
  const pattern = COMMAND_PATTERNS.find(p => p.method === method) || null;
468
476
  // Check if arguments contain dynamic content
@@ -472,6 +480,7 @@ exports.detectChildProcess = (0, eslint_devkit_2.createRule)({
472
480
  /**
473
481
  * Generate refactoring steps based on the pattern
474
482
  */
483
+ // oxlint-disable-next-line consistent-function-scoping
475
484
  const generateRefactoringSteps = (pattern) => {
476
485
  switch (pattern.method) {
477
486
  case 'exec':
@@ -544,6 +553,7 @@ exports.detectChildProcess = (0, eslint_devkit_2.createRule)({
544
553
  /**
545
554
  * Determine risk level based on the call pattern
546
555
  */
556
+ // oxlint-disable-next-line consistent-function-scoping
547
557
  const determineRiskLevel = (pattern, isDynamic) => {
548
558
  if (pattern?.dangerous && isDynamic) {
549
559
  return 'critical';
@@ -587,21 +597,31 @@ exports.detectChildProcess = (0, eslint_devkit_2.createRule)({
587
597
  return;
588
598
  }
589
599
  const { method, args, pattern, isDynamic } = extractCommandInfo(node);
590
- // Allow literal strings if configured
600
+ // ALWAYS safe: exec/execSync called with a single string literal that
601
+ // contains no interpolation — there is no user input to inject. The
602
+ // rule discourages exec() in general (because it's easy to add a
603
+ // template-literal later), but a fully-literal call is structurally
604
+ // safe and shouldn't be flagged. Fire-on-stylistic-discouragement is
605
+ // out of scope for a security rule.
606
+ if ((method === 'exec' || method === 'execSync') && !isDynamic && hasOnlyLiteralArgs(node.arguments)) {
607
+ return;
608
+ }
609
+ // Allow literal strings if configured (legacy option, kept for
610
+ // backward compat with existing user configs).
591
611
  if (allowLiteralStrings && method === 'exec' && !isDynamic) {
592
612
  return;
593
613
  }
594
614
  // Allow safe methods with literal args if configured
595
615
  // execFile, execFileSync, spawn, spawnSync are inherently safer than exec
596
616
  // when using literal command + literal args array
597
- const saferMethods = ['spawn', 'spawnSync', 'execFile', 'execFileSync'];
598
- if (allowLiteralSpawn && saferMethods.includes(method) && hasOnlyLiteralArgs(node.arguments)) {
617
+ const saferMethods = new Set(['spawn', 'spawnSync', 'execFile', 'execFileSync']);
618
+ if (allowLiteralSpawn && saferMethods.has(method) && hasOnlyLiteralArgs(node.arguments)) {
599
619
  return;
600
620
  }
601
621
  // ALWAYS safe: literal command + ALL literal args (no dynamic input at all).
602
622
  // For execFile/execFileSync: no shell by default, all-literal = nothing to inject.
603
623
  // For spawn/spawnSync: requires shell:false + all-literal args.
604
- if (saferMethods.includes(method) && hasOnlyLiteralArgs(node.arguments)) {
624
+ if (saferMethods.has(method) && hasOnlyLiteralArgs(node.arguments)) {
605
625
  const isExecFile = method === 'execFile' || method === 'execFileSync';
606
626
  if (isExecFile || hasShellFalseOption(node)) {
607
627
  return;