eslint-plugin-node-security 4.2.0 → 4.4.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 (31) hide show
  1. package/CHANGELOG.md +141 -2
  2. package/README.md +3 -2
  3. package/package.json +6 -2
  4. package/src/index.js +11 -7
  5. package/src/index.js.map +1 -1
  6. package/src/rules/detect-child-process/index.js +1 -1
  7. package/src/rules/detect-eval-with-expression/index.js +1 -1
  8. package/src/rules/no-cryptojs/index.js +1 -1
  9. package/src/rules/no-cryptojs/index.js.map +1 -1
  10. package/src/rules/no-cryptojs-weak-random/index.js +1 -1
  11. package/src/rules/no-deprecated-buffer/index.js +27 -1
  12. package/src/rules/no-deprecated-buffer/index.js.map +1 -1
  13. package/src/rules/no-dynamic-algorithm-selection/index.d.ts +26 -0
  14. package/src/rules/no-dynamic-algorithm-selection/index.js +85 -0
  15. package/src/rules/no-dynamic-algorithm-selection/index.js.map +1 -0
  16. package/src/rules/no-dynamic-dependency-loading/index.js +1 -1
  17. package/src/rules/no-math-random-crypto/index.js +1 -1
  18. package/src/rules/no-shell-injection/index.d.ts +20 -0
  19. package/src/rules/no-shell-injection/index.js +88 -0
  20. package/src/rules/no-shell-injection/index.js.map +1 -0
  21. package/src/rules/no-ssrf/index.js +7 -7
  22. package/src/rules/no-ssrf/index.js.map +1 -1
  23. package/src/rules/no-unsafe-dynamic-require/index.js +1 -1
  24. package/src/rules/no-weak-cipher-algorithm/index.js +1 -1
  25. package/src/rules/no-weak-hash-algorithm/index.js +1 -1
  26. package/src/rules/prefer-native-crypto/index.js +1 -1
  27. package/src/rules/prefer-native-crypto/index.js.map +1 -1
  28. package/src/rules/require-dependency-integrity/index.js +1 -1
  29. package/src/rules/no-pii-in-logs/index.d.ts +0 -12
  30. package/src/rules/no-pii-in-logs/index.js +0 -77
  31. package/src/rules/no-pii-in-logs/index.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,144 @@
1
1
  ## [4.1.0] - 2026-05-03
2
2
 
3
+ ## 4.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#190](https://github.com/ofri-peretz/eslint/pull/190) [`6bb476d`](https://github.com/ofri-peretz/eslint/commit/6bb476d232f85da8201b08d0a199c9267c3499e5) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - feat(node-security): add `no-dynamic-algorithm-selection` (CWE-327)
8
+
9
+ Disallow dynamic (non-literal) algorithm names in Node.js crypto functions.
10
+ A runtime-selected algorithm argument can allow a downgrade to a broken or
11
+ risky cryptographic algorithm (CWE-327: Use of a Broken or Risky
12
+ Cryptographic Algorithm). AST-structural — flags non-literal algorithm
13
+ arguments to the crypto APIs.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#215](https://github.com/ofri-peretz/eslint/pull/215) [`f42ea93`](https://github.com/ofri-peretz/eslint/commit/f42ea935555a558627dd61d1b013cd8509943c89) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Align `no-dynamic-algorithm-selection`'s `meta.docs.cvss` (7.4) to the CVSS its
18
+ finding actually emits. The rule's message carries `CWE-327` and sets no
19
+ per-message `cvss`, so it inherits `CWE_MAPPING['CWE-327']` = 7.5 via
20
+ `enrichFromCWE` — docs now match the emitted value. Surfaced by the
21
+ cross-plugin `security-cvss-docs-consistency.lock.test.ts` lock (added in [#213](https://github.com/ofri-peretz/eslint/issues/213)),
22
+ which turned main red when this rule landed concurrently with the CVSS sweep.
23
+ Documentation-metadata only; no emitted finding changes.
24
+
25
+ - [#213](https://github.com/ofri-peretz/eslint/pull/213) [`391dbe6`](https://github.com/ofri-peretz/eslint/commit/391dbe6b39f78d549379218567cb959649f8c614) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Align every security rule's `meta.docs.cvss` to the CVSS its finding actually
26
+ emits. The emitted machine-readable message sources its `CVSS:x` from
27
+ `CWE_MAPPING` via `formatLLMMessage` → `enrichFromCWE`, but the static
28
+ `meta.docs.cvss` documentation field had drifted on 45 rules across these 7
29
+ plugins — e.g. `no-hardcoded-credentials` documented `9.5` while emitting
30
+ `CVSS:9.8` (the value the published article and SARIF/LLM consumers already
31
+ read).
32
+
33
+ This corrects the **documentation metadata only** — no emitted finding changes.
34
+ Locked by `security-cvss-docs-consistency.lock.test.ts` (cross-plugin: every
35
+ security rule's `meta.docs.cvss` must equal the CVSS it emits), the
36
+ `no-hardcoded-credentials` rule lock (real ESLint `Linter` emission), and a
37
+ devkit `enrichFromCWE` contract test pinning `CWE-798 → 9.8`.
38
+
39
+ Follow-up (not in scope): 50 security rules document a CVSS that never appears
40
+ in any emitted message (their messages carry no CWE), and several rules emit the
41
+ generic CWE score where a rule-specific score may be warranted — both change
42
+ emitted output and are separate decisions.
43
+
44
+ ## 4.3.0
45
+
46
+ ### Minor Changes
47
+
48
+ - [#148](https://github.com/ofri-peretz/eslint/pull/148) [`82718c2`](https://github.com/ofri-peretz/eslint/commit/82718c282895710d42c36d4679fb24d47f1c35c7) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - feat(node-security): add `no-math-random-crypto` (CWE-338)
49
+
50
+ Detects `Math.random()` used in cryptographic contexts (tokens, keys, secrets,
51
+ salts, IVs, session IDs) and steers to `crypto.randomBytes()` / `crypto.randomUUID()`.
52
+
53
+ This was the one cryptography rule that the deprecated `eslint-plugin-crypto`
54
+ shipped but had **not** been carried into `node-security` during the 2026-05
55
+ consolidation — so `eslint-plugin-crypto`'s deprecation notice ("node-security
56
+ includes all cryptography rules") was previously inaccurate. It is now true.
57
+
58
+ Added to the `recommended` preset as `error`. The detection is return/assignment
59
+ context-aware (matches `crypto`-named variables, properties, and function
60
+ returns) so benign uses like a Fisher-Yates shuffle into a non-crypto variable
61
+ do not false-positive — verified against the fn-fp benchmark (40/40 detection,
62
+ 0 false positives with the crypto-free fleet).
63
+
64
+ ### Patch Changes
65
+
66
+ - [#144](https://github.com/ofri-peretz/eslint/pull/144) [`8843ce7`](https://github.com/ofri-peretz/eslint/commit/8843ce7fbb465caad161b97032467b3a37a49319) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - fix: ILB-Wild FP reduction + doc examples + doc-test-alignment scanner fixes
67
+
68
+ **`no-unlimited-resource-allocation` — FP reduction (430 Edge FPs)**
69
+ - Skip loop-allocation reporting when the first argument is a numeric literal (e.g. `Buffer.alloc(1024)` inside a loop is statically bounded, not a risk)
70
+ - Skip `Array.isArray`, `Array.from`, `Array.of` calls in the `alloc/Array` pattern check (these don't allocate unbounded memory)
71
+
72
+ **`no-hardcoded-credentials` — FP reduction (~280 Edge FPs)**
73
+ - Extended test-file skip to cover `.fixture.`, `.mock.`, `__mocks__/`, `/tests/`, `/fixtures/`, `/mocks/` paths
74
+ - Skip string literals that are fallback values in `process.env.X || 'fallback'` expressions — the secret lives in the environment, the string is only a dev-mode default
75
+
76
+ **Doc examples — 4 rules now have ❌ Incorrect examples**
77
+ - `lambda-security/no-missing-authorization-check`
78
+ - `lambda-security/no-overly-permissive-iam-policy`
79
+ - `node-security/prefer-native-crypto` (renamed non-standard `### ❌ Third-Party (Flagged)` to `### ❌ Incorrect`)
80
+ - `vercel-ai-security/require-tool-confirmation` (replaced placeholder with a real tested example)
81
+
82
+ **`ilb-doc-test-alignment` scanner fixes**
83
+ - Accept both `## ❌` and `### ❌` headings (docs use H3 under an H2 `## Examples` section; was only finding H2)
84
+ - Slice from end-of-line rather than end-of-regex-match (prevents `## ❌ Incorrect Code` from leaving a partial heading in the parsed section)
85
+
86
+ Result: `ilb:doc-test-alignment` → 206 ok, 0 doc has no ❌ examples (was 165 missing).
87
+
88
+ - [#141](https://github.com/ofri-peretz/eslint/pull/141) [`38ab670`](https://github.com/ofri-peretz/eslint/commit/38ab670a0221684f4fd3d5dc3c05ddec7458ca2b) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - fix: remove false `meta.fixable: 'code'` declarations from 21 rules that had no `fix()` function
89
+
90
+ Rules that declared `fixable: 'code'` in their ESLint meta without an actual `fix()` implementation would show the ⚡ auto-fix icon in editors and CI formatters but apply no change when `--fix` was run. This patch removes the misleading declaration from:
91
+ - `browser-security/no-clickjacking`
92
+ - `import-next/first`, `named`, `no-barrel-import`, `no-import-module-exports`, `no-namespace`
93
+ - `node-security/no-buffer-overread`, `no-unsafe-dynamic-require`, `no-zip-slip`
94
+ - `react-features/react-no-inline-functions`
95
+ - `reliability/no-jsdoc-terminator-in-example` (uses `suggest`, not auto-fix; corrected to `hasSuggestions: true` only)
96
+ - `secure-coding/no-directive-injection`, `no-electron-security-issues`, `no-graphql-injection`, `no-improper-sanitization`, `no-improper-type-validation`, `no-ldap-injection`, `no-unchecked-loop-condition`, `no-unlimited-resource-allocation`, `no-weak-password-recovery`, `no-xpath-injection`
97
+
98
+ - [#186](https://github.com/ofri-peretz/eslint/pull/186) [`edf208d`](https://github.com/ofri-peretz/eslint/commit/edf208d67ac2357312c97d8964fcf6a462e407eb) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Consolidation cleanup — no rule behavior change:
99
+ - **react-features**: the README rules table now lists the 8 `componentApi`
100
+ preset rules. The README generator (`sync-readme-rules.ts`) and the
101
+ `plugin-rule-source-drift` validator now recurse into nested
102
+ `docs/rules/<category>/` subfolders, so every documented rule is advertised
103
+ consistently (previously the nested componentApi docs were silently dropped,
104
+ which an earlier `readme` exception had papered over — that exception is now
105
+ removed in favour of the real fix).
106
+ - **node-security**: remove the orphaned `no-pii-in-logs` rule source — the rule
107
+ was migrated to `eslint-plugin-secure-coding` and is no longer exported here;
108
+ the dead source was still compiling into `dist`.
109
+ - **import-next**: restore the `no-cycle` unit test after [#180](https://github.com/ofri-peretz/eslint/issues/180)'s SCC refactor
110
+ (`computeSCCsFromFile` + `findShortestCyclePath` are now bridged in the mock).
111
+
112
+ Also fixes `scripts/ilb-plugin-scope-audit.ts` to stop mis-reading config-preset
113
+ keys (`'recommended-strict': {`) as rules.
114
+
115
+ - [#148](https://github.com/ofri-peretz/eslint/pull/148) [`82718c2`](https://github.com/ofri-peretz/eslint/commit/82718c282895710d42c36d4679fb24d47f1c35c7) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - feat+fix: ILB-Wild FP reduction + two new quality rules
116
+
117
+ **`no-unsafe-deserialization` FP reduction (~112 FPs)**
118
+ - Track `fs.readFileSync('literal')` calls in `literalPathFileVars` — a file read with a
119
+ hardcoded path (bundled config) is not user-controlled input for safe deserializers
120
+ (`JSON.parse`, schema-validating parsers). `eval()` still fires even on literal-path reads.
121
+
122
+ **`no-buffer-overread` FP reduction (~129 FPs)**
123
+ - Remove `b` (single-char, too broad) and `chunk` (too common for array chunks) from the
124
+ Buffer alias heuristic — `isBufferType` now only matches `buf` and `bytes` by name,
125
+ reducing false matches on non-Buffer variables.
126
+
127
+ **New rule: `modernization/prefer-template-literal`**
128
+ - Flags `"string " + variable` concatenation and suggests the equivalent template literal.
129
+ - Auto-fix produces the correct `` `string ${variable}` `` replacement.
130
+ - Pure string literal chains (`"a" + "b"`) and numeric addition are not flagged.
131
+ - Closes P2 quality FN `prob_string_concat` in the ILB-Arena-Quality bench.
132
+
133
+ **New rule: `modularity/no-mutable-exports`**
134
+ - Flags `export let` and `export var` — module exports should be immutable `const`
135
+ bindings so all importers share a stable reference.
136
+ - Auto-fix replaces `let`/`var` with `const`.
137
+ - Closes P2 quality FN `prob_mutable_export` in the ILB-Arena-Quality bench.
138
+
139
+ - Updated dependencies [[`736a5fe`](https://github.com/ofri-peretz/eslint/commit/736a5fed47e673f6157ea900b29fe2a54e4bc7df)]:
140
+ - @interlace/eslint-devkit@1.4.1
141
+
3
142
  ### Added
4
143
 
5
144
  - 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.
@@ -29,10 +168,10 @@
29
168
 
30
169
  ### Bug Fixes
31
170
 
32
- - ⚠️ **rules:** reduce false positives across security rules ([af4ca0e7](https://github.com/ofri-peretz/eslint/commit/af4ca0e7))
171
+ - ⚠️ **rules:** reduce false positives across security rules ([af4ca0e7](https://github.com/ofri-peretz/eslint/commit/af4ca0e7))
33
172
  - align codecov component names and update docs components ([0a59a86c](https://github.com/ofri-peretz/eslint/commit/0a59a86c))
34
173
 
35
- ### ⚠️ Breaking Changes
174
+ ### ⚠️ Breaking Changes
36
175
 
37
176
  - **rules:** Some previously flagged patterns are now correctly allowed ([af4ca0e7](https://github.com/ofri-peretz/eslint/commit/af4ca0e7))
38
177
 
package/README.md CHANGED
@@ -14,6 +14,8 @@
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
+ > ⭐ If this plugin caught a real bug for you, [**star the repo**](https://github.com/ofri-peretz/eslint) — it's the signal that keeps these rules maintained.
18
+
17
19
  ## Description
18
20
 
19
21
  This plugin provides Security rules for Node.js core modules (fs, child_process, crypto, etc).
@@ -94,8 +96,7 @@ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md)
94
96
  | [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
97
  | [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
98
  | [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-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, salts, IVs) | 🟢 | | | | | |
99
100
  | [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
101
  | [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
102
  | [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). | 🟢 | | | | 💡 | |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-node-security",
3
- "version": "4.2.0",
3
+ "version": "4.4.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",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "tslib": "^2.3.0",
77
- "@interlace/eslint-devkit": "^1.2.1"
77
+ "@interlace/eslint-devkit": "^1.4.1"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@typescript-eslint/parser": "^8.46.2",
@@ -88,5 +88,9 @@
88
88
  },
89
89
  "peerDependencies": {
90
90
  "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
91
+ },
92
+ "funding": {
93
+ "type": "github",
94
+ "url": "https://github.com/ofri-peretz/eslint"
91
95
  }
92
96
  }
package/src/index.js CHANGED
@@ -16,8 +16,9 @@ const no_toctou_vulnerability_1 = require("./rules/no-toctou-vulnerability");
16
16
  const no_zip_slip_1 = require("./rules/no-zip-slip");
17
17
  const no_arbitrary_file_access_1 = require("./rules/no-arbitrary-file-access");
18
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");
20
19
  const no_ssrf_1 = require("./rules/no-ssrf");
20
+ const no_shell_injection_1 = require("./rules/no-shell-injection");
21
+ const no_dynamic_algorithm_selection_1 = require("./rules/no-dynamic-algorithm-selection");
21
22
  // Migrated rules from secure-coding
22
23
  const detect_suspicious_dependencies_1 = require("./rules/detect-suspicious-dependencies");
23
24
  const lock_file_1 = require("./rules/lock-file");
@@ -53,8 +54,9 @@ exports.rules = {
53
54
  'no-zip-slip': no_zip_slip_1.noZipSlip,
54
55
  'no-arbitrary-file-access': no_arbitrary_file_access_1.noArbitraryFileAccess,
55
56
  'no-data-in-temp-storage': no_data_in_temp_storage_1.noDataInTempStorage,
56
- 'no-pii-in-logs': no_pii_in_logs_1.noPiiInLogs,
57
57
  'no-ssrf': no_ssrf_1.noSsrf,
58
+ 'no-shell-injection': no_shell_injection_1.noShellInjection,
59
+ 'no-dynamic-algorithm-selection': no_dynamic_algorithm_selection_1.noDynamicAlgorithmSelection,
58
60
  // Migrated rules
59
61
  'detect-suspicious-dependencies': detect_suspicious_dependencies_1.detectSuspiciousDependencies,
60
62
  'lock-file': lock_file_1.lockFile,
@@ -83,7 +85,7 @@ exports.rules = {
83
85
  exports.plugin = {
84
86
  meta: {
85
87
  name: 'eslint-plugin-node-security',
86
- version: '4.2.0',
88
+ version: '4.4.0',
87
89
  },
88
90
  rules: exports.rules,
89
91
  };
@@ -102,15 +104,17 @@ const recommendedRules = {
102
104
  // Added in 4.1.0. Set to 'warn' in `recommended` to avoid breaking
103
105
  // adopters who already use the preset and have legacy `Buffer()` calls.
104
106
  // Promote to 'error' on the next major bump.
105
- 'node-security/no-deprecated-buffer': 'warn',
107
+ 'node-security/no-deprecated-buffer': 'error',
106
108
  'node-security/no-toctou-vulnerability': 'error',
107
109
  'node-security/no-zip-slip': 'error',
108
110
  'node-security/no-arbitrary-file-access': 'error',
109
111
  'node-security/no-data-in-temp-storage': 'error',
110
- 'node-security/no-ssrf': 'error',
112
+ 'node-security/no-ssrf': 'warn',
113
+ 'node-security/no-shell-injection': 'error',
114
+ 'node-security/no-dynamic-algorithm-selection': 'error',
111
115
  // Migrated Rules
112
116
  'node-security/detect-suspicious-dependencies': 'warn',
113
- 'node-security/lock-file': 'error',
117
+ 'node-security/lock-file': 'warn', // filesystem check — not pure AST; CI enforces this better
114
118
  'node-security/require-dependency-integrity': 'error',
115
119
  // Crypto rules in recommended
116
120
  'node-security/no-weak-hash-algorithm': 'error',
@@ -118,7 +122,7 @@ const recommendedRules = {
118
122
  'node-security/no-static-iv': 'error',
119
123
  'node-security/no-ecb-mode': 'error',
120
124
  'node-security/no-math-random-crypto': 'error',
121
- 'node-security/no-cryptojs': 'warn',
125
+ 'node-security/no-cryptojs': 'error',
122
126
  };
123
127
  exports.configs = {
124
128
  recommended: {
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sour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;IAClE,sEAAsE;IACtE,qEAAqE;IACrE,iEAAiE;IACjE,kCAAkC,EAAE,MAAM;IAC1C,mEAAmE;IACnE,wEAAwE;IACxE,6CAA6C;IAC7C,oCAAoC,EAAE,OAAO;IAC7C,uCAAuC,EAAE,OAAO;IAChD,2BAA2B,EAAE,OAAO;IACpC,wCAAwC,EAAE,OAAO;IACjD,uCAAuC,EAAE,OAAO;IAChD,uBAAuB,EAAE,MAAM;IAC/B,kCAAkC,EAAE,OAAO;IAC3C,8CAA8C,EAAE,OAAO;IAEvD,iBAAiB;IACjB,8CAA8C,EAAE,MAAM;IACtD,yBAAyB,EAAE,MAAM,EAAE,2DAA2D;IAC9F,4CAA4C,EAAE,OAAO;IAErD,8BAA8B;IAC9B,sCAAsC,EAAE,OAAO;IAC/C,wCAAwC,EAAE,OAAO;IACjD,4BAA4B,EAAE,OAAO;IACrC,2BAA2B,EAAE,OAAO;IACpC,qCAAqC,EAAE,OAAO;IAC9C,2BAA2B,EAAE,OAAO;CACrC,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"}
@@ -133,7 +133,7 @@ exports.detectChildProcess = (0, eslint_devkit_2.createRule)({
133
133
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/detect-child-process.md',
134
134
  description: 'Detects child_process usage that may allow command injection',
135
135
  cwe: 'CWE-78',
136
- cvss: 9.5,
136
+ cvss: 9.8,
137
137
  confidence: 'medium',
138
138
  },
139
139
  messages: {
@@ -59,7 +59,7 @@ exports.detectEvalWithExpression = (0, eslint_devkit_2.createRule)({
59
59
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/detect-eval-with-expression.md',
60
60
  description: 'Detects eval(variable) which can allow an attacker to run arbitrary code',
61
61
  cwe: 'CWE-95',
62
- cvss: 9.5,
62
+ cvss: 9.8,
63
63
  confidence: 'high',
64
64
  },
65
65
  messages: {
@@ -15,7 +15,7 @@ exports.noCryptojs = (0, eslint_devkit_1.createRule)({
15
15
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-cryptojs.md',
16
16
  description: 'Disallow deprecated crypto-js library (use native crypto instead)',
17
17
  cwe: 'CWE-1104',
18
- cvss: 5,
18
+ cvss: 5.3,
19
19
  },
20
20
  hasSuggestions: true,
21
21
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rules/no-cryptojs/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAWH,4DAAsG;AAczF,QAAA,UAAU,GAAG,IAAA,0BAAU,EAA0B;IAC5D,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,GAAG,EAAE,gHAAgH;YACrH,WAAW,EAAE,mEAAmE;YAChF,GAAG,EAAE,UAAU;YACf,IAAI,EAAE,CAAC;SACR;QACD,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE;YACR,kBAAkB,EAAE,IAAA,gCAAgB,EAAC;gBACnC,IAAI,EAAE,4BAAY,CAAC,OAAO;gBAC1B,SAAS,EAAE,8BAA8B;gBACzC,GAAG,EAAE,UAAU;gBACf,WAAW,EAAE,oGAAoG;gBACjH,QAAQ,EAAE,QAAQ;gBAClB,GAAG,EAAE,2DAA2D;gBAChE,iBAA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@@ -15,7 +15,7 @@ exports.noCryptojsWeakRandom = (0, eslint_devkit_1.createRule)({
15
15
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-cryptojs-weak-random.md',
16
16
  description: 'Disallow crypto-js WordArray.random() (CVE-2020-36732)',
17
17
  cwe: 'CWE-338',
18
- cvss: 9.5,
18
+ cvss: 5.3,
19
19
  },
20
20
  hasSuggestions: true,
21
21
  messages: {
@@ -17,7 +17,7 @@ exports.noDeprecatedBuffer = (0, eslint_devkit_1.createRule)({
17
17
  cwe: 'CWE-676',
18
18
  cvss: 7.5,
19
19
  },
20
- hasSuggestions: true,
20
+ fixable: 'code',
21
21
  messages: {
22
22
  deprecatedBufferConstructor: (0, eslint_devkit_1.formatLLMMessage)({
23
23
  icon: eslint_devkit_1.MessageIcons.SECURITY,
@@ -48,23 +48,49 @@ exports.noDeprecatedBuffer = (0, eslint_devkit_1.createRule)({
48
48
  return (node.type === eslint_devkit_1.AST_NODE_TYPES.Identifier &&
49
49
  node.name === 'Buffer');
50
50
  }
51
+ /**
52
+ * Returns the safe replacement for new Buffer(args):
53
+ * new Buffer(number) → Buffer.alloc(number)
54
+ * new Buffer(...) → Buffer.from(...)
55
+ */
56
+ function getBufferReplacement(args) {
57
+ if (args.length === 1 &&
58
+ args[0].type === eslint_devkit_1.AST_NODE_TYPES.Literal &&
59
+ typeof args[0].value === 'number') {
60
+ return 'Buffer.alloc';
61
+ }
62
+ return 'Buffer.from';
63
+ }
51
64
  return {
52
65
  // Catches `new Buffer(size)` / `new Buffer(arr)` / `new Buffer('str')`
53
66
  NewExpression(node) {
54
67
  if (!isBufferIdentifier(node.callee))
55
68
  return;
69
+ const replacement = getBufferReplacement(node.arguments);
56
70
  context.report({
57
71
  node,
58
72
  messageId: 'deprecatedBufferConstructor',
73
+ fix(fixer) {
74
+ // Replace `new Buffer` with `Buffer.from` or `Buffer.alloc`,
75
+ // removing the `new` keyword in the process.
76
+ const sourceCode = context.sourceCode;
77
+ const newToken = sourceCode.getFirstToken(node);
78
+ const calleeEnd = node.callee.range[1];
79
+ return fixer.replaceTextRange([newToken.range[0], calleeEnd], replacement);
80
+ },
59
81
  });
60
82
  },
61
83
  // Catches `Buffer(size)` (factory call without `new`)
62
84
  CallExpression(node) {
63
85
  if (!isBufferIdentifier(node.callee))
64
86
  return;
87
+ const replacement = getBufferReplacement(node.arguments);
65
88
  context.report({
66
89
  node,
67
90
  messageId: 'deprecatedBufferCall',
91
+ fix(fixer) {
92
+ return fixer.replaceText(node.callee, replacement);
93
+ },
68
94
  });
69
95
  },
70
96
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rules/no-deprecated-buffer/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAkBH,4DAKkC;AAIrB,QAAA,kBAAkB,GAAwC,IAAA,0BAAU,EAAiB;IAChG,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,GAAG,EAAE,yHAAyH;YAC9H,WAAW,EAAE,iFAAiF;YAC9F,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,GAAG;SACV;QACD,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE;YACR,2BAA2B,EAAE,IAAA,gCAAgB,EAAC;gBAC5C,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,+BAA+B;gBAC1C,GAAG,EAAE,SAAS;gBACd,IAAI,EAAE,GAAG;gBACT,WAAW,EACT,oIAAoI;gBACtI,QAAQ,EAAE,MAAM;gBAChB,GAAG,EAAE,4KAA4K;gBACjL,iBAAiB,EAAE,sDAAsD;aAC1E,CAAC;YACF,oBAAoB,EAAE,IAAA,gCAAgB,EAAC;gBACrC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,kCAAkC;gBAC7C,GAAG,EAAE,SAAS;gBACd,IAAI,EAAE,GAAG;gBACT,WAAW,EACT,gIAAgI;gBAClI,QAAQ,EAAE,MAAM;gBAChB,GAAG,EAAE,gFAAgF;gBACrF,iBAAiB,EAAE,sDAAsD;aAC1E,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,SAAS,kBAAkB,CAAC,IAAmB;YAC7C,OAAO,CACL,IAAI,CAAC,IAAI,KAAK,8BAAc,CAAC,UAAU;gBACtC,IAA4B,CAAC,IAAI,KAAK,QAAQ,CAChD,CAAC;QACJ,CAAC;QAED,OAAO;YACL,uEAAuE;YACvE,aAAa,CAAC,IAAI;gBAChB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC;oBAAE,OAAO;gBAC7C,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,6BAA6B;iBACzC,CAAC,CAAC;YACL,CAAC;YAED,sDAAsD;YACtD,cAAc,CAAC,IAAI;gBACjB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC;oBAAE,OAAO;gBAC7C,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,sBAAsB;iBAClC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rules/no-deprecated-buffer/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAkBH,4DAKkC;AAIrB,QAAA,kBAAkB,GAAwC,IAAA,0BAAU,EAAiB;IAChG,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,GAAG,EAAE,yHAAyH;YAC9H,WAAW,EAAE,iFAAiF;YAC9F,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,GAAG;SACV;QACD,OAAO,EAAE,MAAM;QACf,QAAQ,EAA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C7C,MAAM,WAAW,GAAG,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACzD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,6BAA6B;oBACxC,GAAG,CAAC,KAAK;wBACP,6DAA6D;wBAC7D,6CAA6C;wBAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;wBACtC,MAAM,QAAQ,GAAG,UAAU,CAAC,aAAa,CAAC,IAAI,CAAE,CAAC;wBACjD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,KAAM,CAAC,CAAC,CAAC,CAAC;wBACxC,OAAO,KAAK,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;oBAC7E,CAAC;iBACF,CAAC,CAAC;YACL,CAAC;YAED,sDAAsD;YACtD,cAAc,CAAC,IAAI;gBACjB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC;oBAAE,OAAO;gBAC7C,MAAM,WAAW,GAAG,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACzD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,sBAAsB;oBACjC,GAAG,CAAC,KAAK;wBACP,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;oBACrD,CAAC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) 2025 Ofri Peretz
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * ESLint Rule: no-dynamic-algorithm-selection
7
+ * CWE-327: Use of a Broken or Risky Cryptographic Algorithm
8
+ *
9
+ * Detects crypto.createHash(), crypto.createCipheriv(), crypto.createSign(),
10
+ * and similar Node crypto APIs where the algorithm name comes from a dynamic
11
+ * value (variable, request param, config value) rather than a literal string.
12
+ *
13
+ * An attacker who controls the algorithm parameter can:
14
+ * - Downgrade to a weak algorithm (MD5, SHA1, RC4)
15
+ * - Cause a crash with an unsupported algorithm name
16
+ * - Bypass security controls that assume a strong algorithm is in use
17
+ *
18
+ * Detection: structural-api.
19
+ * crypto.createHash(req.query.algo) → fires (dynamic first arg)
20
+ * crypto.createHash('sha256') → silent (literal, checked separately)
21
+ * crypto.createHash(`sha256`) → silent (static template)
22
+ */
23
+ import type { TSESLint } from '@interlace/eslint-devkit';
24
+ export declare const noDynamicAlgorithmSelection: TSESLint.RuleModule<"dynamicAlgorithm", [], unknown, TSESLint.RuleListener> & {
25
+ name: string;
26
+ };
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2025 Ofri Peretz
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.noDynamicAlgorithmSelection = void 0;
8
+ const eslint_devkit_1 = require("@interlace/eslint-devkit");
9
+ /** Node crypto functions whose first argument is the algorithm name. */
10
+ const CRYPTO_ALGORITHM_FUNCTIONS = new Set([
11
+ 'createHash',
12
+ 'createHmac',
13
+ 'createSign',
14
+ 'createVerify',
15
+ 'createCipher',
16
+ 'createCipheriv',
17
+ 'createDecipher',
18
+ 'createDecipheriv',
19
+ ]);
20
+ exports.noDynamicAlgorithmSelection = (0, eslint_devkit_1.createRule)({
21
+ name: 'no-dynamic-algorithm-selection',
22
+ meta: {
23
+ type: 'problem',
24
+ docs: {
25
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-dynamic-algorithm-selection.md',
26
+ description: 'Disallow dynamic algorithm names in Node.js crypto functions (CWE-327)',
27
+ cwe: 'CWE-327',
28
+ // Match the CVSS the finding emits: the message sets no per-message
29
+ // cvss, so it inherits CWE_MAPPING['CWE-327'] (7.5) via enrichFromCWE.
30
+ // Locked by security-cvss-docs-consistency.lock.test.ts.
31
+ cvss: 7.5,
32
+ },
33
+ messages: {
34
+ dynamicAlgorithm: (0, eslint_devkit_1.formatLLMMessage)({
35
+ icon: eslint_devkit_1.MessageIcons.SECURITY,
36
+ issueName: 'Dynamic Cryptographic Algorithm (CWE-327)',
37
+ cwe: 'CWE-327',
38
+ description: '`crypto.{{method}}()` receives a dynamic algorithm name. An attacker who controls this value can downgrade to a weak algorithm (MD5, SHA1, RC4) or cause a crash.',
39
+ severity: 'HIGH',
40
+ fix: 'Hard-code the algorithm name as a literal string (e.g. "sha256", "aes-256-gcm"). Use an allowlist if the algorithm must vary at runtime.',
41
+ documentationLink: 'https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html',
42
+ }),
43
+ },
44
+ schema: [],
45
+ },
46
+ defaultOptions: [],
47
+ create(context) {
48
+ return {
49
+ CallExpression(node) {
50
+ const { callee, arguments: args } = node;
51
+ // Match crypto.method(algo) — MemberExpression where object is 'crypto'
52
+ if (callee.type !== eslint_devkit_1.AST_NODE_TYPES.MemberExpression)
53
+ return;
54
+ if (callee.object.type !== eslint_devkit_1.AST_NODE_TYPES.Identifier)
55
+ return;
56
+ if (callee.property.type !== eslint_devkit_1.AST_NODE_TYPES.Identifier)
57
+ return;
58
+ const objectName = callee.object.name;
59
+ const methodName = callee.property.name;
60
+ if (objectName !== 'crypto')
61
+ return;
62
+ if (!CRYPTO_ALGORITHM_FUNCTIONS.has(methodName))
63
+ return;
64
+ const firstArg = args[0];
65
+ if (!firstArg)
66
+ return;
67
+ // String literal → already handled by no-weak-hash-algorithm for weak algos;
68
+ // a literal is always an intentional, auditable choice.
69
+ if (firstArg.type === eslint_devkit_1.AST_NODE_TYPES.Literal &&
70
+ typeof firstArg.value === 'string')
71
+ return;
72
+ // Template literal without expressions → equivalent to literal, safe.
73
+ if (firstArg.type === eslint_devkit_1.AST_NODE_TYPES.TemplateLiteral &&
74
+ firstArg.expressions.length === 0)
75
+ return;
76
+ context.report({
77
+ node: firstArg,
78
+ messageId: 'dynamicAlgorithm',
79
+ data: { method: methodName },
80
+ });
81
+ },
82
+ };
83
+ },
84
+ });
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rules/no-dynamic-algorithm-selection/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,4DAKkC;AAIlC,wEAAwE;AACxE,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC;IACzC,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;CACnB,CAAC,CAAC;AAEU,QAAA,2BAA2B,GAAG,IAAA,0BAAU,EAAiB;IACpE,IAAI,EAAE,gCAAgC;IACtC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,GAAG,EAAE,mIAAmI;YACxI,WAAW,EACT,wEAAwE;YAC1E,GAAG,EAAE,SAAS;YACd,oEAAoE;YACpE,uEAAuE;YACvE,yDAAyD;YACzD,IAAI,EAAE,GAAG;SACV;QACD,QAAQ,EAAE;YACR,gBAAgB,EAAE,IAAA,gCAAgB,EAAC;gBACjC,IAAI,EAAE,4BAAY,CAAC,QAAQ;gBAC3B,SAAS,EAAE,2CAA2C;gBACtD,GAAG,EAAE,SAAS;gBACd,WAAW,EACT,mKAAmK;gBACrK,QAAQ,EAAE,MAAM;gBAChB,GAAG,EAAE,0IAA0I;gBAC/I,iBAAiB,EACf,uFAAuF;aAC1F,CAAC;SACH;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAA6C;QAClD,OAAO;YACL,cAAc,CAAC,IAA6B;gBAC1C,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;gBAEzC,wEAAwE;gBACxE,IAAI,MAAM,CAAC,IAAI,KAAK,8BAAc,CAAC,gBAAgB;oBAAE,OAAO;gBAC5D,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,8BAAc,CAAC,UAAU;oBAAE,OAAO;gBAC7D,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,8BAAc,CAAC,UAAU;oBAAE,OAAO;gBAE/D,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;gBACtC,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAExC,IAAI,UAAU,KAAK,QAAQ;oBAAE,OAAO;gBACpC,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAAC,UAAU,CAAC;oBAAE,OAAO;gBAExD,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACzB,IAAI,CAAC,QAAQ;oBAAE,OAAO;gBAEtB,6EAA6E;gBAC7E,wDAAwD;gBACxD,IACE,QAAQ,CAAC,IAAI,KAAK,8BAAc,CAAC,OAAO;oBACxC,OAAQ,QAA6B,CAAC,KAAK,KAAK,QAAQ;oBACxD,OAAO;gBAET,sEAAsE;gBACtE,IACE,QAAQ,CAAC,IAAI,KAAK,8BAAc,CAAC,eAAe;oBAC/C,QAAqC,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;oBAC/D,OAAO;gBAET,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EAAE,QAAQ;oBACd,SAAS,EAAE,kBAAkB;oBAC7B,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;iBAC7B,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -20,7 +20,7 @@ exports.noDynamicDependencyLoading = (0, eslint_devkit_1.createRule)({
20
20
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-dynamic-dependency-loading.md',
21
21
  description: 'Prevent runtime dependency injection with dynamic paths',
22
22
  cwe: 'CWE-1104',
23
- cvss: 7.5,
23
+ cvss: 5.3,
24
24
  },
25
25
  messages: {
26
26
  violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
@@ -49,7 +49,7 @@ exports.noMathRandomCrypto = (0, eslint_devkit_1.createRule)({
49
49
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-math-random-crypto.md',
50
50
  description: 'Disallow Math.random() for cryptographic purposes',
51
51
  cwe: 'CWE-338',
52
- cvss: 9.5,
52
+ cvss: 5.3,
53
53
  confidence: 'medium',
54
54
  },
55
55
  hasSuggestions: true,
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ESLint Rule: no-shell-injection
3
+ * CWE-78: OS Command Injection
4
+ *
5
+ * Fires when child_process shell-execution functions receive a first
6
+ * argument built via string concatenation or template literal expressions.
7
+ *
8
+ * Detection: structural-api. The rule checks the SHAPE of the first argument,
9
+ * not what value flows into it. exec(`git ${cmd}`) fires regardless of what
10
+ * `cmd` contains — the concatenation itself is the signal.
11
+ *
12
+ * Does NOT fire on:
13
+ * - exec('literal command') — static string, no injection surface
14
+ * - spawn('cmd', [args]) — args array is the safe parameterization form
15
+ * - exec(variable) — indirect; data-flow analysis required, out of scope
16
+ */
17
+ import type { TSESLint } from '@interlace/eslint-devkit';
18
+ export declare const noShellInjection: TSESLint.RuleModule<"shellInjection", [], unknown, TSESLint.RuleListener> & {
19
+ name: string;
20
+ };
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ /**
3
+ * ESLint Rule: no-shell-injection
4
+ * CWE-78: OS Command Injection
5
+ *
6
+ * Fires when child_process shell-execution functions receive a first
7
+ * argument built via string concatenation or template literal expressions.
8
+ *
9
+ * Detection: structural-api. The rule checks the SHAPE of the first argument,
10
+ * not what value flows into it. exec(`git ${cmd}`) fires regardless of what
11
+ * `cmd` contains — the concatenation itself is the signal.
12
+ *
13
+ * Does NOT fire on:
14
+ * - exec('literal command') — static string, no injection surface
15
+ * - spawn('cmd', [args]) — args array is the safe parameterization form
16
+ * - exec(variable) — indirect; data-flow analysis required, out of scope
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.noShellInjection = void 0;
20
+ const eslint_devkit_1 = require("@interlace/eslint-devkit");
21
+ /** Shell-execution functions from child_process that run the first arg as a shell command. */
22
+ const SHELL_EXEC_FUNCTIONS = new Set([
23
+ 'exec', 'execSync',
24
+ ]);
25
+ function isStringConcatOrTemplate(node) {
26
+ if (node.type === eslint_devkit_1.AST_NODE_TYPES.TemplateLiteral && node.expressions.length > 0)
27
+ return true;
28
+ if (node.type === eslint_devkit_1.AST_NODE_TYPES.BinaryExpression &&
29
+ node.operator === '+' &&
30
+ (node.left.type === eslint_devkit_1.AST_NODE_TYPES.Literal ||
31
+ node.left.type === eslint_devkit_1.AST_NODE_TYPES.TemplateLiteral ||
32
+ node.left.type === eslint_devkit_1.AST_NODE_TYPES.BinaryExpression ||
33
+ node.right.type === eslint_devkit_1.AST_NODE_TYPES.Literal ||
34
+ node.right.type === eslint_devkit_1.AST_NODE_TYPES.TemplateLiteral))
35
+ return true;
36
+ return false;
37
+ }
38
+ exports.noShellInjection = (0, eslint_devkit_1.createRule)({
39
+ name: 'no-shell-injection',
40
+ meta: {
41
+ type: 'problem',
42
+ docs: {
43
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-shell-injection.md',
44
+ description: 'Disallow string concatenation or template expressions in shell command arguments (CWE-78)',
45
+ cwe: 'CWE-78',
46
+ cvss: 9.8,
47
+ },
48
+ messages: {
49
+ shellInjection: (0, eslint_devkit_1.formatLLMMessage)({
50
+ icon: eslint_devkit_1.MessageIcons.SECURITY,
51
+ issueName: 'OS Command Injection (CWE-78)',
52
+ cwe: 'CWE-78',
53
+ description: 'Shell command built via string concatenation or template literal. An attacker who controls any interpolated value can execute arbitrary OS commands.',
54
+ severity: 'CRITICAL',
55
+ fix: 'Use spawn(cmd, [arg1, arg2]) with separate arguments instead of exec(cmd + args). Never build shell commands via string interpolation.',
56
+ documentationLink: 'https://cheatsheetseries.owasp.org/cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html',
57
+ }),
58
+ },
59
+ schema: [],
60
+ },
61
+ defaultOptions: [],
62
+ create(context) {
63
+ return {
64
+ CallExpression(node) {
65
+ const callee = node.callee;
66
+ let fnName = null;
67
+ // exec('cmd') / execSync('cmd') — bare call
68
+ if (callee.type === eslint_devkit_1.AST_NODE_TYPES.Identifier) {
69
+ fnName = callee.name;
70
+ }
71
+ // require('child_process').exec('cmd') — member access
72
+ else if (callee.type === eslint_devkit_1.AST_NODE_TYPES.MemberExpression &&
73
+ callee.property.type === eslint_devkit_1.AST_NODE_TYPES.Identifier) {
74
+ fnName = callee.property.name;
75
+ }
76
+ if (!fnName || !SHELL_EXEC_FUNCTIONS.has(fnName))
77
+ return;
78
+ const firstArg = node.arguments[0];
79
+ if (!firstArg || firstArg.type === eslint_devkit_1.AST_NODE_TYPES.SpreadElement)
80
+ return;
81
+ if (isStringConcatOrTemplate(firstArg)) {
82
+ context.report({ node: firstArg, messageId: 'shellInjection' });
83
+ }
84
+ },
85
+ };
86
+ },
87
+ });
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rules/no-shell-injection/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAGH,4DAAsG;AAKtG,8FAA8F;AAC9F,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,MAAM,EAAE,UAAU;CACnB,CAAC,CAAC;AAEH,SAAS,wBAAwB,CAAC,IAAmB;IACnD,IAAI,IAAI,CAAC,IAAI,KAAK,8BAAc,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7F,IACE,IAAI,CAAC,IAAI,KAAK,8BAAc,CAA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E,CAAC;oBAC9C,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;gBACvB,CAAC;gBACD,uDAAuD;qBAClD,IACH,MAAM,CAAC,IAAI,KAAK,8BAAc,CAAC,gBAAgB;oBAC/C,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,8BAAc,CAAC,UAAU,EAClD,CAAC;oBACD,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAChC,CAAC;gBAED,IAAI,CAAC,MAAM,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC;oBAAE,OAAO;gBAEzD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;gBACnC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,8BAAc,CAAC,aAAa;oBAAE,OAAO;gBAExE,IAAI,wBAAwB,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACvC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC,CAAC;gBAClE,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -136,21 +136,21 @@ function hasValidationBefore(node) {
136
136
  exports.noSsrf = (0, eslint_devkit_1.createRule)({
137
137
  name: 'no-ssrf',
138
138
  meta: {
139
- type: 'problem',
139
+ type: 'suggestion',
140
140
  docs: {
141
141
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-ssrf.md',
142
- description: 'Detects HTTP requests with user-controlled URLs (SSRF vulnerability)',
142
+ description: 'Flags HTTP calls whose URL argument is an identifier with a user-input-sounding name — a heuristic prompt for code review, not a proof of SSRF',
143
143
  cwe: 'CWE-918',
144
- cvss: 7.5,
144
+ cvss: 9.1,
145
145
  },
146
146
  messages: {
147
147
  ssrfVulnerability: (0, eslint_devkit_1.formatLLMMessage)({
148
148
  icon: eslint_devkit_1.MessageIcons.SECURITY,
149
- issueName: 'Server-Side Request Forgery (SSRF)',
149
+ issueName: 'Possible SSRF heuristic (CWE-918)',
150
150
  cwe: 'CWE-918',
151
- description: 'HTTP request with potentially user-controlled URL. An attacker could access internal services.',
152
- severity: 'HIGH',
153
- fix: 'Validate URL against an allowlist of permitted hosts before making the request.',
151
+ description: 'HTTP call whose URL argument name suggests user input. This is a naming heuristic, not data-flow analysis — review whether the URL could originate from an untrusted source at runtime.',
152
+ severity: 'LOW',
153
+ fix: 'If the URL comes from user input, validate it against an allowlist of permitted hosts before making the request.',
154
154
  documentationLink: 'https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html',
155
155
  }),
156
156
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rules/no-ssrf/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAaH,4DAKkC;AAWlC,oDAAoD;AACpD,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,OAAO,EAAQ,wBAAwB;IACvC,KAAK,EAAU,MAAM;IACrB,WAAW,EAAI,aAAa;IAC5B,QAAQ,EAAO,SAAS;CACzB,CAAC,CAAC;AAEH,2DAA2D;AAC3D,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS;CACtE,CAAC,CAAC;AAEH,8CAA8C;AAC9C,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ;CACnE,CAAC,CAAC;AAEH,8CAA8C;AAC9C,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACxC,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW;I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it_2.createRule)({
16
16
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-unsafe-dynamic-require.md',
17
17
  description: 'Prevent unsafe dynamic require() calls that could enable code injection',
18
18
  cwe: 'CWE-95',
19
- cvss: 9.5,
19
+ cvss: 9.8,
20
20
  },
21
21
  hasSuggestions: false,
22
22
  messages: {
@@ -77,7 +77,7 @@ exports.noWeakCipherAlgorithm = (0, eslint_devkit_1.createRule)({
77
77
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-weak-cipher-algorithm.md',
78
78
  description: 'Disallow weak cipher algorithms (DES, 3DES, RC4, Blowfish)',
79
79
  cwe: 'CWE-327',
80
- cvss: 9.5,
80
+ cvss: 7.5,
81
81
  },
82
82
  hasSuggestions: true,
83
83
  messages: {
@@ -65,7 +65,7 @@ exports.noWeakHashAlgorithm = (0, eslint_devkit_1.createRule)({
65
65
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-weak-hash-algorithm.md',
66
66
  description: 'Disallow weak hash algorithms (MD5, SHA1, MD4)',
67
67
  cwe: 'CWE-327',
68
- cvss: 9.5,
68
+ cvss: 7.5,
69
69
  },
70
70
  hasSuggestions: true,
71
71
  messages: {
@@ -31,7 +31,7 @@ exports.preferNativeCrypto = (0, eslint_devkit_1.createRule)({
31
31
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/prefer-native-crypto.md',
32
32
  description: 'Prefer native crypto over third-party libraries',
33
33
  cwe: 'CWE-1104',
34
- cvss: 5,
34
+ cvss: 5.3,
35
35
  },
36
36
  hasSuggestions: true,
37
37
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rules/prefer-native-crypto/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAUH,4DAAsG;AActG,mEAAmE;AACnE,MAAM,uBAAuB,GAAG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C;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -18,7 +18,7 @@ exports.requireDependencyIntegrity = (0, eslint_devkit_1.createRule)({
18
18
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/require-dependency-integrity.md',
19
19
  description: 'Require SRI (Subresource Integrity) for CDN resources',
20
20
  cwe: 'CWE-494',
21
- cvss: 7.5,
21
+ cvss: 8.1,
22
22
  },
23
23
  messages: {
24
24
  violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
@@ -1,12 +0,0 @@
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
- export interface Options {
7
- }
8
- type RuleOptions = [Options?];
9
- export declare const noPiiInLogs: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
10
- name: string;
11
- };
12
- export {};
@@ -1,77 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.noPiiInLogs = void 0;
9
- /**
10
- * @fileoverview Prevent PII (email, SSN, credit cards) in console logs
11
- * @see https://owasp.org/www-project-mobile-top-10/
12
- * @see https://cwe.mitre.org/data/definitions/532.html
13
- */
14
- const eslint_devkit_1 = require("@interlace/eslint-devkit");
15
- exports.noPiiInLogs = (0, eslint_devkit_1.createRule)({
16
- name: 'no-pii-in-logs',
17
- meta: {
18
- type: 'problem',
19
- docs: {
20
- url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-node-security/docs/rules/no-pii-in-logs.md',
21
- description: 'Prevent PII (email, SSN, credit cards) in console logs',
22
- cwe: 'CWE-359',
23
- cvss: 7.5,
24
- },
25
- messages: {
26
- violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
27
- icon: eslint_devkit_1.MessageIcons.SECURITY,
28
- issueName: 'violation Detected',
29
- cwe: 'CWE-359',
30
- description: 'Prevent PII (email, SSN, credit cards) in console logs detected - this is a security risk',
31
- severity: 'HIGH',
32
- fix: 'Review and apply secure practices',
33
- documentationLink: 'https://cwe.mitre.org/data/definitions/359.html',
34
- })
35
- },
36
- schema: [],
37
- },
38
- defaultOptions: [],
39
- create(context) {
40
- function report(node) {
41
- context.report({
42
- node,
43
- messageId: 'violationDetected',
44
- });
45
- }
46
- return {
47
- CallExpression(node) {
48
- // Check console.log/error/warn calls
49
- if (node.callee.type === eslint_devkit_1.AST_NODE_TYPES.MemberExpression &&
50
- node.callee.object.type === eslint_devkit_1.AST_NODE_TYPES.Identifier &&
51
- node.callee.object.name === 'console' &&
52
- node.callee.property.type === eslint_devkit_1.AST_NODE_TYPES.Identifier &&
53
- ['log', 'error', 'warn', 'info'].includes(node.callee.property.name)) {
54
- // Check arguments for PII-related property access
55
- for (const arg of node.arguments) {
56
- if (arg.type === eslint_devkit_1.AST_NODE_TYPES.MemberExpression &&
57
- arg.property.type === eslint_devkit_1.AST_NODE_TYPES.Identifier) {
58
- const propName = arg.property.name.toLowerCase();
59
- const piiProps = ['email', 'ssn', 'password', 'creditcard', 'phone'];
60
- if (piiProps.some(p => propName.includes(p))) {
61
- report(node);
62
- }
63
- }
64
- // Check string literals mentioning PII
65
- if (arg.type === eslint_devkit_1.AST_NODE_TYPES.Literal && typeof arg.value === 'string') {
66
- const text = arg.value.toLowerCase();
67
- if (text.includes('email:') || text.includes('ssn:') || text.includes('password:')) {
68
- report(node);
69
- }
70
- }
71
- }
72
- }
73
- },
74
- };
75
- },
76
- });
77
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rules/no-pii-in-logs/index.ts"],"names":[],"mappings":";AAA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