eslint-plugin-secure-coding 3.1.3 → 3.3.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.
- package/CHANGELOG.md +102 -0
- package/README.md +128 -65
- package/package.json +23 -4
- package/src/index.js +70 -12
- package/src/oxlint.d.ts +20 -0
- package/src/oxlint.js +21 -0
- package/src/rules/detect-non-literal-regexp/index.js +9 -1
- package/src/rules/detect-object-injection/index.js +344 -6
- package/src/rules/detect-weak-password-validation/index.js +4 -1
- package/src/rules/no-directive-injection/index.js +7 -4
- package/src/rules/no-electron-security-issues/index.js +6 -2
- package/src/rules/no-format-string-injection/index.js +32 -23
- package/src/rules/no-graphql-injection/index.js +8 -3
- package/src/rules/no-hardcoded-credentials/index.js +366 -52
- package/src/rules/no-hardcoded-session-tokens/index.js +3 -0
- package/src/rules/no-improper-sanitization/index.js +31 -4
- package/src/rules/no-improper-type-validation/index.js +6 -4
- package/src/rules/no-insecure-comparison/index.js +39 -3
- package/src/rules/no-ldap-injection/index.js +6 -3
- package/src/rules/no-missing-authentication/index.js +5 -2
- package/src/rules/no-pii-in-logs/index.js +4 -1
- package/src/rules/no-privilege-escalation/index.js +5 -2
- package/src/rules/no-redos-vulnerable-regex/index.js +79 -0
- package/src/rules/no-sensitive-data-exposure/index.js +4 -1
- package/src/rules/no-template-injection/index.d.ts +23 -0
- package/src/rules/no-template-injection/index.js +90 -0
- package/src/rules/no-unchecked-loop-condition/index.js +5 -3
- package/src/rules/no-unlimited-resource-allocation/index.js +46 -30
- package/src/rules/no-unsafe-deserialization/index.js +22 -5
- package/src/rules/no-unsafe-regex-construction/index.js +10 -3
- package/src/rules/no-weak-password-recovery/index.js +5 -3
- package/src/rules/no-xpath-injection/index.js +6 -3
- package/src/rules/no-xxe-injection/index.js +48 -46
- package/src/rules/require-backend-authorization/index.js +6 -3
- package/src/rules/require-secure-defaults/index.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,105 @@
|
|
|
1
|
+
## 3.3.0
|
|
2
|
+
|
|
3
|
+
### Minor Changes
|
|
4
|
+
|
|
5
|
+
- [#170](https://github.com/ofri-peretz/eslint/pull/170) [`4cbf3ed`](https://github.com/ofri-peretz/eslint/commit/4cbf3ed8aed113f6aed7cef3a2ed060601b927ce) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Add `recommended-strict` preset + quick-start in README
|
|
6
|
+
|
|
7
|
+
**New preset: `configs['recommended-strict']`**
|
|
8
|
+
Same 16-rule set as `recommended` but every rule promoted to `'error'`.
|
|
9
|
+
For teams that want CI to block on all security findings, not just
|
|
10
|
+
critical ones. The recommended preset stays unchanged.
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
// eslint.config.mjs
|
|
14
|
+
import securePlugin from 'eslint-plugin-secure-coding';
|
|
15
|
+
export default [...securePlugin.configs['recommended-strict']];
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**README: copy-paste quick-start block**
|
|
19
|
+
Added a one-line usage example immediately after `npm install` so adopters
|
|
20
|
+
don't have to discover the preset table buried further down the page.
|
|
21
|
+
Also added cross-plugin discovery links to `node-security`, `jwt`, and
|
|
22
|
+
`express-security` for teams that want broader coverage.
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#137](https://github.com/ofri-peretz/eslint/pull/137) [`a56da52`](https://github.com/ofri-peretz/eslint/commit/a56da525d90d233310c5329fdd006af5b3fd675c) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - fix(detect-object-injection): suppress ~3,470 Edge false positives via four new safe-pattern guards
|
|
27
|
+
- Test-file skip: rule is now silent on `*.test.*`, `*.spec.*`, `__tests__/`, and `*.fixture.*` paths
|
|
28
|
+
- `for...in` loop variable: keys from `for (const key in obj)` are own property names, not user input
|
|
29
|
+
- `Object.keys/entries` iteration: `for (const key of Object.keys(obj))` is safe by construction
|
|
30
|
+
- Typed-array objects (`new Float32Array/Uint8Array/Int32Array/…`): element access is numeric, not string-keyed
|
|
31
|
+
|
|
32
|
+
None of the guards widen the TP surface — dangerous properties (`__proto__`, `constructor`, `prototype`) and genuine user-input bracket access still fire. Closes the largest single source of ILB-Wild noise.
|
|
33
|
+
|
|
34
|
+
- [#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
|
|
35
|
+
|
|
36
|
+
**`no-unlimited-resource-allocation` — FP reduction (430 Edge FPs)**
|
|
37
|
+
- 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)
|
|
38
|
+
- Skip `Array.isArray`, `Array.from`, `Array.of` calls in the `alloc/Array` pattern check (these don't allocate unbounded memory)
|
|
39
|
+
|
|
40
|
+
**`no-hardcoded-credentials` — FP reduction (~280 Edge FPs)**
|
|
41
|
+
- Extended test-file skip to cover `.fixture.`, `.mock.`, `__mocks__/`, `/tests/`, `/fixtures/`, `/mocks/` paths
|
|
42
|
+
- 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
|
|
43
|
+
|
|
44
|
+
**Doc examples — 4 rules now have ❌ Incorrect examples**
|
|
45
|
+
- `lambda-security/no-missing-authorization-check`
|
|
46
|
+
- `lambda-security/no-overly-permissive-iam-policy`
|
|
47
|
+
- `node-security/prefer-native-crypto` (renamed non-standard `### ❌ Third-Party (Flagged)` to `### ❌ Incorrect`)
|
|
48
|
+
- `vercel-ai-security/require-tool-confirmation` (replaced placeholder with a real tested example)
|
|
49
|
+
|
|
50
|
+
**`ilb-doc-test-alignment` scanner fixes**
|
|
51
|
+
- Accept both `## ❌` and `### ❌` headings (docs use H3 under an H2 `## Examples` section; was only finding H2)
|
|
52
|
+
- Slice from end-of-line rather than end-of-regex-match (prevents `## ❌ Incorrect Code` from leaving a partial heading in the parsed section)
|
|
53
|
+
|
|
54
|
+
Result: `ilb:doc-test-alignment` → 206 ok, 0 doc has no ❌ examples (was 165 missing).
|
|
55
|
+
|
|
56
|
+
- [#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
|
|
57
|
+
|
|
58
|
+
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:
|
|
59
|
+
- `browser-security/no-clickjacking`
|
|
60
|
+
- `import-next/first`, `named`, `no-barrel-import`, `no-import-module-exports`, `no-namespace`
|
|
61
|
+
- `node-security/no-buffer-overread`, `no-unsafe-dynamic-require`, `no-zip-slip`
|
|
62
|
+
- `react-features/react-no-inline-functions`
|
|
63
|
+
- `reliability/no-jsdoc-terminator-in-example` (uses `suggest`, not auto-fix; corrected to `hasSuggestions: true` only)
|
|
64
|
+
- `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`
|
|
65
|
+
|
|
66
|
+
- [#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
|
|
67
|
+
|
|
68
|
+
**`no-unsafe-deserialization` FP reduction (~112 FPs)**
|
|
69
|
+
- Track `fs.readFileSync('literal')` calls in `literalPathFileVars` — a file read with a
|
|
70
|
+
hardcoded path (bundled config) is not user-controlled input for safe deserializers
|
|
71
|
+
(`JSON.parse`, schema-validating parsers). `eval()` still fires even on literal-path reads.
|
|
72
|
+
|
|
73
|
+
**`no-buffer-overread` FP reduction (~129 FPs)**
|
|
74
|
+
- Remove `b` (single-char, too broad) and `chunk` (too common for array chunks) from the
|
|
75
|
+
Buffer alias heuristic — `isBufferType` now only matches `buf` and `bytes` by name,
|
|
76
|
+
reducing false matches on non-Buffer variables.
|
|
77
|
+
|
|
78
|
+
**New rule: `modernization/prefer-template-literal`**
|
|
79
|
+
- Flags `"string " + variable` concatenation and suggests the equivalent template literal.
|
|
80
|
+
- Auto-fix produces the correct `` `string ${variable}` `` replacement.
|
|
81
|
+
- Pure string literal chains (`"a" + "b"`) and numeric addition are not flagged.
|
|
82
|
+
- Closes P2 quality FN `prob_string_concat` in the ILB-Arena-Quality bench.
|
|
83
|
+
|
|
84
|
+
**New rule: `modularity/no-mutable-exports`**
|
|
85
|
+
- Flags `export let` and `export var` — module exports should be immutable `const`
|
|
86
|
+
bindings so all importers share a stable reference.
|
|
87
|
+
- Auto-fix replaces `let`/`var` with `const`.
|
|
88
|
+
- Closes P2 quality FN `prob_mutable_export` in the ILB-Arena-Quality bench.
|
|
89
|
+
|
|
90
|
+
- Updated dependencies [[`736a5fe`](https://github.com/ofri-peretz/eslint/commit/736a5fed47e673f6157ea900b29fe2a54e4bc7df)]:
|
|
91
|
+
- @interlace/eslint-devkit@1.4.1
|
|
92
|
+
|
|
93
|
+
## 3.2.0 (Unreleased)
|
|
94
|
+
|
|
95
|
+
### Added
|
|
96
|
+
|
|
97
|
+
- New `./oxlint` sub-export for use with [oxlint](https://oxc.rs/docs/guide/usage/linter)'s JS plugin API. Wire it via `{ "jsPlugins": ["eslint-plugin-secure-coding/oxlint"] }` in `.oxlintrc.json`. Exposes the same rule set as the main entry; rules degrade gracefully when type information is unavailable (oxlint's JS plugin context does not provide `parserServices`). The default ESLint entry (`./`) is unchanged.
|
|
98
|
+
|
|
99
|
+
## 3.1.3 (2026-02-09)
|
|
100
|
+
|
|
101
|
+
This was a version bump only for eslint-plugin-secure-coding to align it with other projects, there were no code changes.
|
|
102
|
+
|
|
1
103
|
# Changelog
|
|
2
104
|
|
|
3
105
|
All notable changes to this project will be documented in this file.
|
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-secure-coding" 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,15 @@
|
|
|
10
10
|
<a href="https://www.npmjs.com/package/eslint-plugin-secure-coding" target="_blank"><img src="https://img.shields.io/npm/v/eslint-plugin-secure-coding.svg" alt="NPM Version" /></a>
|
|
11
11
|
<a href="https://www.npmjs.com/package/eslint-plugin-secure-coding" target="_blank"><img src="https://img.shields.io/npm/dm/eslint-plugin-secure-coding.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=
|
|
13
|
+
<a href="https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=secure-coding" target="_blank"><img src="https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?component=secure-coding" 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
|
+
> ⭐ 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 General secure coding practices and OWASP compliance for JavaScript/TypeScript.
|
|
20
|
-
By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.
|
|
21
22
|
|
|
22
23
|
## Philosophy
|
|
23
24
|
|
|
@@ -25,92 +26,154 @@ By using this plugin, you can proactively identify and mitigate security risks a
|
|
|
25
26
|
|
|
26
27
|
## Getting Started
|
|
27
28
|
|
|
28
|
-
- To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-secure-coding), visit [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
29
|
-
- 要查看中文 [指南](https://eslint.interlace.tools/docs/security/plugin-secure-coding), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
30
|
-
- [가이드](https://eslint.interlace.tools/docs/security/plugin-secure-coding) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools)에서 확인하실 수 있습니다. 📚
|
|
31
|
-
- [ガイド](https://eslint.interlace.tools/docs/security/plugin-secure-coding)は [eslint.interlace.tools](https://eslint.interlace.tools)でご確認ください。 📚
|
|
32
|
-
- Para ver la [guía](https://eslint.interlace.tools/docs/security/plugin-secure-coding), visita [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
33
|
-
- للاطلاع على [الدليل](https://eslint.interlace.tools/docs/security/plugin-secure-coding)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
29
|
+
- To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-secure-coding?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding). 📚
|
|
30
|
+
- 要查看中文 [指南](https://eslint.interlace.tools/docs/security/plugin-secure-coding?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding). 📚
|
|
31
|
+
- [가이드](https://eslint.interlace.tools/docs/security/plugin-secure-coding?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding)에서 확인하실 수 있습니다. 📚
|
|
32
|
+
- [ガイド](https://eslint.interlace.tools/docs/security/plugin-secure-coding?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding)は [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding)でご確認ください。 📚
|
|
33
|
+
- Para ver la [guía](https://eslint.interlace.tools/docs/security/plugin-secure-coding?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding), visita [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding). 📚
|
|
34
|
+
- للاطلاع على [الدليل](https://eslint.interlace.tools/docs/security/plugin-secure-coding?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding). 📚
|
|
34
35
|
|
|
35
36
|
```bash
|
|
36
37
|
npm install eslint-plugin-secure-coding --save-dev
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
**Add to your `eslint.config.mjs` — one line activates 16 security rules:**
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
import securePlugin from 'eslint-plugin-secure-coding';
|
|
44
|
+
|
|
45
|
+
export default [
|
|
46
|
+
// Balanced: catches critical issues as errors, lower-confidence rules as warnings
|
|
47
|
+
...securePlugin.configs.recommended,
|
|
48
|
+
|
|
49
|
+
// Zero-tolerance: same 16 rules, all promoted to error (good for CI gates)
|
|
50
|
+
// ...securePlugin.configs['recommended-strict'],
|
|
51
|
+
];
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Or if you use a legacy `.eslintrc.json`:**
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"extends": ["plugin:secure-coding/recommended"]
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> **Using `recommended` already?** Extend your coverage with domain-specific plugins:
|
|
63
|
+
> [`eslint-plugin-node-security`](https://www.npmjs.com/package/eslint-plugin-node-security) (crypto, eval, buffer) ·
|
|
64
|
+
> [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) (JWT auth) ·
|
|
65
|
+
> [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) (Express middleware)
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Benchmarks vs competitors (CWE-798 ground truth)
|
|
70
|
+
`no-hardcoded-credentials` is part of the [ILB-Flagship benchmark suite](../../benchmarks/suites/ilb-flagship). On the labeled CWE-798 fixture set (Juliet-style: 2 vulnerable + 2 safe files, ground-truthed):
|
|
40
71
|
|
|
72
|
+
| Rule | Precision | Recall | F1 |
|
|
73
|
+
| :--- | ---: | ---: | ---: |
|
|
74
|
+
| **`secure-coding/no-hardcoded-credentials`** (ours) | **100%** | **100%** | **1.00** |
|
|
75
|
+
| `eslint-plugin-no-secrets/no-secrets` | 100% | 50% | 0.67 |
|
|
76
|
+
|
|
77
|
+
The competitor's entropy-only detection catches the high-entropy API-key shape but misses the 15-character literal password assigned to `password:`. Our context-gated detection (structural patterns + credential-named-variable check + context-positive path) catches both for the right reasons.
|
|
78
|
+
|
|
79
|
+
**On real OSS (vercel/ai), the competitor reports ~380 more findings than us.** Those 380 are not catches we missed — they're entropy false-positives on TypeScript type literals (`'experimental_onLanguageModelCallStart'`), error class names (`'AI_ToolCallNotFoundForApprovalError'`), and documentation URLs. Sampling confirmed zero are actual credentials. The corpus number is the right one to weigh; the OSS finding-count is a noise metric.
|
|
80
|
+
|
|
81
|
+
## ⚙️ Configuration Presets
|
|
41
82
|
| Preset | Description |
|
|
42
83
|
| :-------------------- | :-------------------------------------------------------------- |
|
|
43
|
-
| `recommended` |
|
|
44
|
-
| `strict`
|
|
84
|
+
| `recommended` | 16 core rules — critical issues as `error`, lower-confidence as `warn` |
|
|
85
|
+
| `recommended-strict` | Same 16 rules as `recommended`, all promoted to `error` — for CI gates |
|
|
86
|
+
| `strict` | All rules as `error` — maximum coverage including experimental rules |
|
|
45
87
|
| `owasp-top-10` | OWASP Top 10 Web 2021 compliance focused |
|
|
46
88
|
| `owasp-mobile-top-10` | OWASP Mobile Top 10 2024 compliance focused |
|
|
47
89
|
|
|
48
90
|
---
|
|
49
91
|
|
|
92
|
+
## 📦 Compatibility
|
|
93
|
+
| Package | Version |
|
|
94
|
+
| :--- | :--- |
|
|
95
|
+
| ESLint | `^8.0.0 \|\| ^9.0.0 \|\| ^10.0.0` |
|
|
96
|
+
| Node.js | `>=18.0.0` |
|
|
97
|
+
|
|
98
|
+
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.
|
|
99
|
+
|
|
50
100
|
## Rules
|
|
51
101
|
|
|
52
102
|
**Legend**
|
|
53
103
|
|
|
54
|
-
| Icon | Description
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
| [
|
|
69
|
-
| [
|
|
70
|
-
| [
|
|
71
|
-
| [no-
|
|
72
|
-
| [no-
|
|
73
|
-
| [no-
|
|
74
|
-
| [no-
|
|
75
|
-
| [no-
|
|
76
|
-
| [no-
|
|
77
|
-
| [no-
|
|
78
|
-
| [no-
|
|
79
|
-
| [no-
|
|
80
|
-
| [no-
|
|
81
|
-
| [no-
|
|
82
|
-
| [no-
|
|
83
|
-
| [no-
|
|
84
|
-
| [no-
|
|
85
|
-
| [no-
|
|
86
|
-
| [no-
|
|
87
|
-
| [no-
|
|
88
|
-
| [no-
|
|
89
|
-
| [
|
|
90
|
-
| [
|
|
91
|
-
|
|
104
|
+
| Icon | Description |
|
|
105
|
+
| :---: | :--- |
|
|
106
|
+
| 💼 | **Recommended**: Included in the recommended preset. |
|
|
107
|
+
| ⚠️ | **Warns**: Set to warn in recommended preset. |
|
|
108
|
+
| 🔧 | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
|
|
109
|
+
| 💡 | **Suggestions**: Providing code suggestions in IDE. |
|
|
110
|
+
| 🚫 | **Deprecated**: This rule is deprecated. |
|
|
111
|
+
| 🟢 | **Type-unaware**: AST-only, runs in oxlint JS-plugin tier. |
|
|
112
|
+
| 🟡 | **Type-aware (refining)**: pure-AST primary path; types refine precision. |
|
|
113
|
+
| 🟠 | **Type-aware (graceful)**: requires TS program; silent without it. |
|
|
114
|
+
|
|
115
|
+
<!-- AUTO-GENERATED:RULES_TABLE:START - Do not edit manually -->
|
|
116
|
+
| Rule | CWE | OWASP | CVSS | Description | 🧠 | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
117
|
+
| :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
118
|
+
| [detect-non-literal-regexp](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/detect-non-literal-regexp?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-400 | | | Detects RegExp(variable), which might allow an attacker to DOS your server with a long-running regular expr… | 🟢 | | | | | |
|
|
119
|
+
| [detect-object-injection](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/detect-object-injection?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-915 | | | Detects variable[key] as a left- or right-hand assignment operand (prototype pollution) | 🟡 | | | | | |
|
|
120
|
+
| [detect-weak-password-validation](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/detect-weak-password-validation?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-521 | A07:2021 | | Detects weak password length requirements (less than 8 characters) in validation code. | 🟢 | | | | | |
|
|
121
|
+
| [no-directive-injection](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-directive-injection?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-94 | | | Detects directive injection vulnerabilities in template systems | 🟢 | | | | | |
|
|
122
|
+
| [no-electron-security-issues](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-electron-security-issues?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-16 | | | Detects Electron security vulnerabilities and insecure configurations | 🟢 | | | | | |
|
|
123
|
+
| [no-format-string-injection](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-format-string-injection?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-134 | | | Detects format string injection vulnerabilities | 🟢 | | | | | |
|
|
124
|
+
| [no-graphql-injection](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-graphql-injection?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-943 | | | Detects GraphQL injection vulnerabilities and DoS attacks | 🟢 | 💼 | | | | |
|
|
125
|
+
| [no-hardcoded-credentials](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-hardcoded-credentials?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-798 | | | Detects hardcoded passwords, API keys, tokens, and other sensitive credentials in source code | 🟢 | 💼 | | | | |
|
|
126
|
+
| [no-hardcoded-session-tokens](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-hardcoded-session-tokens?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-798 | | | This rule detects hardcoded JWT tokens (starting with eyJ), Bearer tokens, and session identifiers | 🟢 | | | | | |
|
|
127
|
+
| [no-improper-sanitization](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-improper-sanitization?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-116 | | | Detects improper sanitization of user input | 🟢 | | | | | |
|
|
128
|
+
| [no-improper-type-validation](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-improper-type-validation?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-1287 | | | Detects improper type validation in user input handling | 🟢 | 💼 | | | | |
|
|
129
|
+
| [no-insecure-comparison](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-insecure-comparison?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-697 | | | Detects insecure comparison operators (==, !=) that can lead to type coercion vulnerabilities | 🟢 | 💼 | | | | |
|
|
130
|
+
| [no-ldap-injection](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-ldap-injection?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-90 | | | Detects LDAP injection vulnerabilities | 🟢 | 💼 | | | | |
|
|
131
|
+
| [no-missing-authentication](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-missing-authentication?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-287 | | | CWE: [CWE-287](https://cwe.mitre.org/data/definitions/287.html) | 🟢 | 💼 | | | | |
|
|
132
|
+
| [no-pii-in-logs](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-pii-in-logs?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-359 | | | Prevent personally identifiable information (PII) — emails, SSNs, credit cards, phone numbers — from reachi… | 🟢 | | | | 💡 | |
|
|
133
|
+
| [no-privilege-escalation](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-privilege-escalation?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-269 | | | Detects potential privilege escalation vulnerabilities where user input is used to assign roles or permissi… | 🟢 | 💼 | | | | |
|
|
134
|
+
| [no-redos-vulnerable-regex](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-redos-vulnerable-regex?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-400 | | | ESLint Rule: no-redos-vulnerable-regex | 🟢 | | | | | |
|
|
135
|
+
| [no-sensitive-data-exposure](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-sensitive-data-exposure?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-532 | | | ESLint Rule: no-sensitive-data-exposure | 🟢 | 💼 | | | | |
|
|
136
|
+
| [no-unchecked-loop-condition](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-unchecked-loop-condition?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-400 | | | Detects unchecked loop conditions that could cause DoS | 🟢 | | | | | |
|
|
137
|
+
| [no-unlimited-resource-allocation](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-unlimited-resource-allocation?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-770 | | | Detects unlimited resource allocation that could cause DoS | 🟢 | | | | | |
|
|
138
|
+
| [no-unsafe-deserialization](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-unsafe-deserialization?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-502 | | | Detects unsafe deserialization of untrusted data | 🟢 | 💼 | | | | |
|
|
139
|
+
| [no-unsafe-regex-construction](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-unsafe-regex-construction?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-400 | | | ESLint Rule: no-unsafe-regex-construction with LLM-optimized suggestions and auto-fix capabilities | 🟢 | | | | | |
|
|
140
|
+
| [no-weak-password-recovery](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-weak-password-recovery?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-640 | | | ESLint Rule: no-weak-password-recovery with LLM-optimized suggestions and auto-fix capabilities | 🟢 | 💼 | | | | |
|
|
141
|
+
| [no-xpath-injection](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-xpath-injection?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-643 | | | Detects XPath injection vulnerabilities | 🟢 | 💼 | | | | |
|
|
142
|
+
| [no-xxe-injection](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/no-xxe-injection?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-611 | | | Detects XML External Entity (XXE) injection vulnerabilities | 🟢 | 💼 | | | | |
|
|
143
|
+
| [require-backend-authorization](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/require-backend-authorization?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-602 | | | CWE: [CWE-602](https://cwe.mitre.org/data/definitions/602.html) | 🟢 | | | | | |
|
|
144
|
+
| [require-secure-defaults](https://eslint.interlace.tools/docs/security/plugin-secure-coding/rules/require-secure-defaults?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding) | CWE-1188 | | | CWE: [CWE-1188](https://cwe.mitre.org/data/definitions/1188.html) | 🟢 | | | | | |
|
|
145
|
+
<!-- AUTO-GENERATED:RULES_TABLE:END -->
|
|
92
146
|
## 🔗 Related ESLint Plugins
|
|
93
147
|
|
|
94
148
|
Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
|
|
95
149
|
|
|
96
|
-
| Plugin
|
|
97
|
-
|
|
|
98
|
-
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding)
|
|
99
|
-
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg)
|
|
100
|
-
| [`eslint-plugin-
|
|
101
|
-
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt)
|
|
102
|
-
| [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security)
|
|
103
|
-
| [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security)
|
|
104
|
-
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security)
|
|
105
|
-
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security)
|
|
106
|
-
| [`eslint-plugin-mongodb-security`](https://www.npmjs.com/package/eslint-plugin-mongodb-security)
|
|
107
|
-
| [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security hardening.
|
|
108
|
-
| [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next)
|
|
150
|
+
| Plugin | Downloads | Description |
|
|
151
|
+
| :--- | :---: | :--- |
|
|
152
|
+
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [](https://www.npmjs.com/package/eslint-plugin-secure-coding) | General security rules & OWASP guidelines. |
|
|
153
|
+
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | [](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL security & best practices. |
|
|
154
|
+
| [`eslint-plugin-node-security`](https://www.npmjs.com/package/eslint-plugin-node-security) | [](https://www.npmjs.com/package/eslint-plugin-node-security) | Node.js core-module security (fs, child_process, vm, crypto, Buffer). |
|
|
155
|
+
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
|
|
156
|
+
| [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | [](https://www.npmjs.com/package/eslint-plugin-browser-security) | Browser-specific security & XSS prevention. |
|
|
157
|
+
| [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [](https://www.npmjs.com/package/eslint-plugin-express-security) | Express.js security hardening rules. |
|
|
158
|
+
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | [](https://www.npmjs.com/package/eslint-plugin-lambda-security) | AWS Lambda security best practices. |
|
|
159
|
+
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | [](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | NestJS security rules & patterns. |
|
|
160
|
+
| [`eslint-plugin-mongodb-security`](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | [](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | MongoDB security best practices. |
|
|
161
|
+
| [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security hardening. |
|
|
162
|
+
| [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [](https://www.npmjs.com/package/eslint-plugin-import-next) | Next-gen import sorting & architecture. |
|
|
163
|
+
|
|
164
|
+
<!-- INTERLACE:STAR_CTA:START -->
|
|
165
|
+
## ⭐ Support & follow
|
|
166
|
+
|
|
167
|
+
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.
|
|
168
|
+
|
|
169
|
+
[](https://github.com/ofri-peretz/eslint)
|
|
170
|
+
|
|
171
|
+
<!-- INTERLACE:STAR_CTA:END -->
|
|
109
172
|
|
|
110
173
|
## 📄 License
|
|
111
174
|
|
|
112
175
|
MIT © [Ofri Peretz](https://github.com/ofri-peretz)
|
|
113
176
|
|
|
114
177
|
<p align="center">
|
|
115
|
-
<a href="https://eslint.interlace.tools/docs/security/plugin-secure-coding"><img src="https://eslint.interlace.tools/images/og-secure-coding.png" alt="ESLint Interlace Plugin" width="100%" /></a>
|
|
116
|
-
</p>
|
|
178
|
+
<a href="https://eslint.interlace.tools/docs/security/plugin-secure-coding?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding"><img src="https://eslint.interlace.tools/images/og-secure-coding.png" alt="ESLint Interlace Plugin" width="100%" /></a>
|
|
179
|
+
</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-secure-coding",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Security-focused ESLint plugin with 89 AI-parseable rules for detecting and preventing vulnerabilities. OWASP Top 10 2021 + Mobile Top 10 2024 coverage, CWE references, and AI-assisted fix guidance.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"types": "./src/index.d.ts",
|
|
11
11
|
"default": "./src/index.js"
|
|
12
12
|
},
|
|
13
|
+
"./oxlint": {
|
|
14
|
+
"types": "./src/oxlint.d.ts",
|
|
15
|
+
"default": "./src/oxlint.js"
|
|
16
|
+
},
|
|
13
17
|
"./types": {
|
|
14
18
|
"types": "./src/types/index.d.ts",
|
|
15
19
|
"default": "./src/types/index.js"
|
|
@@ -17,7 +21,7 @@
|
|
|
17
21
|
},
|
|
18
22
|
"author": "Ofri Peretz <ofriperetzdev@gmail.com>",
|
|
19
23
|
"license": "MIT",
|
|
20
|
-
"homepage": "https://
|
|
24
|
+
"homepage": "https://eslint.interlace.tools/docs/security/plugin-secure-coding?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding",
|
|
21
25
|
"repository": {
|
|
22
26
|
"type": "git",
|
|
23
27
|
"url": "https://github.com/ofri-peretz/eslint",
|
|
@@ -69,12 +73,27 @@
|
|
|
69
73
|
"engines": {
|
|
70
74
|
"node": ">=18.0.0"
|
|
71
75
|
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "tsx ../../scripts/build-package.ts",
|
|
78
|
+
"test": "vitest run",
|
|
79
|
+
"test:coverage": "vitest run --coverage",
|
|
80
|
+
"typecheck": "tsc -p tsconfig.lib.json --noEmit"
|
|
81
|
+
},
|
|
72
82
|
"dependencies": {
|
|
73
83
|
"tslib": "^2.3.0",
|
|
74
|
-
"@interlace/eslint-devkit": "^1.
|
|
84
|
+
"@interlace/eslint-devkit": "^1.4.1",
|
|
85
|
+
"scslre": "^0.3.0",
|
|
86
|
+
"@eslint-community/regexpp": "^4.10.0"
|
|
75
87
|
},
|
|
76
88
|
"devDependencies": {
|
|
77
89
|
"@typescript-eslint/parser": "^8.46.2",
|
|
78
90
|
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
91
|
+
},
|
|
92
|
+
"peerDependencies": {
|
|
93
|
+
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
|
|
94
|
+
},
|
|
95
|
+
"funding": {
|
|
96
|
+
"type": "github",
|
|
97
|
+
"url": "https://github.com/ofri-peretz/eslint"
|
|
79
98
|
}
|
|
80
|
-
}
|
|
99
|
+
}
|