eslint-plugin-secure-coding 3.4.0 → 3.4.2
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/README.md +4 -2
- package/package.json +5 -18
- package/src/index.d.ts +17 -23
- package/src/index.js +2 -131
- package/src/oxlint.d.ts +17 -20
- package/src/oxlint.js +0 -18
- package/src/rules/detect-non-literal-regexp/index.js +5 -79
- package/src/rules/detect-object-injection/index.js +2 -221
- package/src/rules/detect-weak-password-validation/index.js +0 -12
- package/src/rules/no-directive-injection/index.js +0 -33
- package/src/rules/no-electron-security-issues/index.js +0 -41
- package/src/rules/no-format-string-injection/index.js +0 -82
- package/src/rules/no-graphql-injection/index.js +8 -133
- package/src/rules/no-hardcoded-credentials/index.js +3 -297
- package/src/rules/no-hardcoded-session-tokens/index.js +0 -11
- package/src/rules/no-improper-sanitization/index.js +0 -44
- package/src/rules/no-improper-type-validation/index.js +1 -51
- package/src/rules/no-insecure-comparison/index.js +8 -47
- package/src/rules/no-ldap-injection/index.js +8 -61
- package/src/rules/no-missing-authentication/index.js +2 -56
- package/src/rules/no-pii-in-logs/index.js +0 -13
- package/src/rules/no-privilege-escalation/index.js +2 -49
- package/src/rules/no-redos-vulnerable-regex/index.js +3 -49
- package/src/rules/no-sensitive-data-exposure/index.js +5 -29
- package/src/rules/no-template-injection/index.js +0 -6
- package/src/rules/no-unchecked-loop-condition/index.js +3 -99
- package/src/rules/no-unlimited-resource-allocation/index.js +2 -75
- package/src/rules/no-unsafe-deserialization/index.js +1 -111
- package/src/rules/no-unsafe-regex-construction/index.js +22 -62
- package/src/rules/no-weak-password-recovery/index.js +0 -43
- package/src/rules/no-xpath-injection/index.js +13 -75
- package/src/rules/no-xxe-injection/index.js +1 -47
- package/src/rules/require-backend-authorization/index.js +0 -10
- package/src/rules/require-secure-defaults/index.js +0 -10
- package/src/types/index.js +0 -5
- package/AGENTS.md +0 -131
- package/CHANGELOG.md +0 -379
- package/src/rules/detect-non-literal-regexp/index.d.ts +0 -28
- package/src/rules/detect-object-injection/index.d.ts +0 -35
- package/src/rules/detect-weak-password-validation/index.d.ts +0 -12
- package/src/rules/no-directive-injection/index.d.ts +0 -38
- package/src/rules/no-electron-security-issues/index.d.ts +0 -36
- package/src/rules/no-format-string-injection/index.d.ts +0 -44
- package/src/rules/no-graphql-injection/index.d.ts +0 -47
- package/src/rules/no-hardcoded-credentials/index.d.ts +0 -95
- package/src/rules/no-hardcoded-session-tokens/index.d.ts +0 -12
- package/src/rules/no-improper-sanitization/index.d.ts +0 -38
- package/src/rules/no-improper-type-validation/index.d.ts +0 -36
- package/src/rules/no-insecure-comparison/index.d.ts +0 -26
- package/src/rules/no-ldap-injection/index.d.ts +0 -53
- package/src/rules/no-missing-authentication/index.d.ts +0 -32
- package/src/rules/no-pii-in-logs/index.d.ts +0 -12
- package/src/rules/no-privilege-escalation/index.d.ts +0 -32
- package/src/rules/no-redos-vulnerable-regex/index.d.ts +0 -28
- package/src/rules/no-sensitive-data-exposure/index.d.ts +0 -30
- package/src/rules/no-template-injection/index.d.ts +0 -23
- package/src/rules/no-unchecked-loop-condition/index.d.ts +0 -38
- package/src/rules/no-unlimited-resource-allocation/index.d.ts +0 -38
- package/src/rules/no-unsafe-deserialization/index.d.ts +0 -40
- package/src/rules/no-unsafe-regex-construction/index.d.ts +0 -30
- package/src/rules/no-weak-password-recovery/index.d.ts +0 -38
- package/src/rules/no-xpath-injection/index.d.ts +0 -39
- package/src/rules/no-xxe-injection/index.d.ts +0 -36
- package/src/rules/require-backend-authorization/index.d.ts +0 -12
- package/src/rules/require-secure-defaults/index.d.ts +0 -12
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<p align="center">
|
|
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/
|
|
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/logos/interlace.svg" alt="Interlace" height="90" /></a>
|
|
3
3
|
|
|
4
|
-
<a href="https://
|
|
4
|
+
<a href="https://oxc.rs" target="_blank"><img src="https://eslint.interlace.tools/logos/oxlint.svg" alt="oxlint" height="90" /></a>
|
|
5
|
+
|
|
6
|
+
<a href="https://eslint.org" target="_blank"><img src="https://eslint.interlace.tools/logos/eslint.svg" alt="ESLint" height="90" /></a>
|
|
5
7
|
</p>
|
|
6
8
|
|
|
7
9
|
<p align="center">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-secure-coding",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"description": "ESLint plugin for secure coding — detects LDAP, XPath, XXE, GraphQL and template injection, unsafe deserialization, ReDoS, missing authentication, and PII in logs.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"homepage": "https://eslint.interlace.tools/docs/security/plugin-secure-coding?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding",
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "https://github.com/ofri-peretz/eslint",
|
|
27
|
+
"url": "git+https://github.com/ofri-peretz/eslint.git",
|
|
28
28
|
"directory": "packages/eslint-plugin-secure-coding"
|
|
29
29
|
},
|
|
30
30
|
"bugs": {
|
|
@@ -35,11 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"src/",
|
|
38
|
-
"dist/",
|
|
39
38
|
"README.md",
|
|
40
|
-
"LICENSE"
|
|
41
|
-
"CHANGELOG.md",
|
|
42
|
-
"AGENTS.md"
|
|
39
|
+
"LICENSE"
|
|
43
40
|
],
|
|
44
41
|
"keywords": [
|
|
45
42
|
"eslint",
|
|
@@ -79,27 +76,17 @@
|
|
|
79
76
|
"engines": {
|
|
80
77
|
"node": ">=18.0.0"
|
|
81
78
|
},
|
|
82
|
-
"scripts": {
|
|
83
|
-
"build": "tsx ../../scripts/build-package.ts",
|
|
84
|
-
"test": "vitest run",
|
|
85
|
-
"test:coverage": "vitest run --coverage",
|
|
86
|
-
"typecheck": "tsc -p tsconfig.lib.json --noEmit"
|
|
87
|
-
},
|
|
88
79
|
"dependencies": {
|
|
89
80
|
"tslib": "^2.3.0",
|
|
90
|
-
"@interlace/eslint-devkit": "^1.
|
|
81
|
+
"@interlace/eslint-devkit": "^1.6.1",
|
|
91
82
|
"scslre": "^0.3.0",
|
|
92
83
|
"@eslint-community/regexpp": "^4.10.0"
|
|
93
84
|
},
|
|
94
|
-
"devDependencies": {
|
|
95
|
-
"@typescript-eslint/parser": "^8.46.2",
|
|
96
|
-
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
97
|
-
},
|
|
98
85
|
"peerDependencies": {
|
|
99
86
|
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
|
|
100
87
|
},
|
|
101
88
|
"funding": {
|
|
102
89
|
"type": "github",
|
|
103
|
-
"url": "https://github.com/ofri-peretz/eslint"
|
|
90
|
+
"url": "git+https://github.com/ofri-peretz/eslint.git"
|
|
104
91
|
}
|
|
105
92
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
export default plugin;
|
|
20
|
-
/**
|
|
21
|
-
* Re-export all types from the types barrel
|
|
22
|
-
*/
|
|
23
|
-
export type { AllSecurityRulesOptions, } from './types/index';
|
|
1
|
+
// Minimal declaration written by scripts/build-package.ts.
|
|
2
|
+
//
|
|
3
|
+
// tsc's generated entry declaration inlined every inferred rule-option type
|
|
4
|
+
// (up to 166 kB per plugin) for an API no consumer calls directly. This types
|
|
5
|
+
// what a flat config actually touches. Per-rule option types remain available
|
|
6
|
+
// from the "./types" subpath export where a plugin provides one.
|
|
7
|
+
import type { Linter, Rule } from 'eslint';
|
|
8
|
+
|
|
9
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
10
|
+
export declare const configs: Record<string, Linter.Config>;
|
|
11
|
+
export declare const plugin: {
|
|
12
|
+
meta: { name: string; version: string };
|
|
13
|
+
rules: Record<string, Rule.RuleModule>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const _default: typeof plugin;
|
|
17
|
+
export default _default;
|
package/src/index.js
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.configs = exports.plugin = exports.rules = void 0;
|
|
9
|
-
/**
|
|
10
|
-
* eslint-plugin-secure-coding
|
|
11
|
-
*
|
|
12
|
-
* A comprehensive security-focused ESLint plugin restricted to "pure coding security rules"
|
|
13
|
-
* (logic, AST patterns, and generic vulnerabilities independent of environment).
|
|
14
|
-
*
|
|
15
|
-
* Rules focus on:
|
|
16
|
-
* - Language-level logic flaws
|
|
17
|
-
* - AST pattern risks
|
|
18
|
-
* - Generic injection patterns
|
|
19
|
-
* - Cryptographic logic (logic level)
|
|
20
|
-
*
|
|
21
|
-
* @see https://github.com/ofri-peretz/eslint#readme
|
|
22
|
-
*/
|
|
23
|
-
// Security rules - Injection
|
|
24
4
|
const no_graphql_injection_1 = require("./rules/no-graphql-injection");
|
|
25
5
|
const no_xxe_injection_1 = require("./rules/no-xxe-injection");
|
|
26
6
|
const no_xpath_injection_1 = require("./rules/no-xpath-injection");
|
|
@@ -28,40 +8,28 @@ const no_ldap_injection_1 = require("./rules/no-ldap-injection");
|
|
|
28
8
|
const no_directive_injection_1 = require("./rules/no-directive-injection");
|
|
29
9
|
const no_format_string_injection_1 = require("./rules/no-format-string-injection");
|
|
30
10
|
const no_template_injection_1 = require("./rules/no-template-injection");
|
|
31
|
-
// Security rules - Regex
|
|
32
11
|
const detect_non_literal_regexp_1 = require("./rules/detect-non-literal-regexp");
|
|
33
12
|
const no_redos_vulnerable_regex_1 = require("./rules/no-redos-vulnerable-regex");
|
|
34
13
|
const no_unsafe_regex_construction_1 = require("./rules/no-unsafe-regex-construction");
|
|
35
|
-
// Security rules - Object & Prototype
|
|
36
14
|
const detect_object_injection_1 = require("./rules/detect-object-injection");
|
|
37
15
|
const no_unsafe_deserialization_1 = require("./rules/no-unsafe-deserialization");
|
|
38
|
-
// Security rules - Credentials & Crypto
|
|
39
16
|
const no_hardcoded_credentials_1 = require("./rules/no-hardcoded-credentials");
|
|
40
17
|
const no_insecure_comparison_1 = require("./rules/no-insecure-comparison");
|
|
41
|
-
// Security rules - Input Validation
|
|
42
18
|
const no_improper_sanitization_1 = require("./rules/no-improper-sanitization");
|
|
43
19
|
const no_improper_type_validation_1 = require("./rules/no-improper-type-validation");
|
|
44
|
-
// Security rules - Authentication & Authorization
|
|
45
20
|
const no_missing_authentication_1 = require("./rules/no-missing-authentication");
|
|
46
21
|
const no_privilege_escalation_1 = require("./rules/no-privilege-escalation");
|
|
47
22
|
const no_weak_password_recovery_1 = require("./rules/no-weak-password-recovery");
|
|
48
23
|
const require_backend_authorization_1 = require("./rules/require-backend-authorization");
|
|
49
|
-
// Security rules - Data Exposure
|
|
50
24
|
const no_sensitive_data_exposure_1 = require("./rules/no-sensitive-data-exposure");
|
|
51
25
|
const no_pii_in_logs_1 = require("./rules/no-pii-in-logs");
|
|
52
|
-
// Security rules - Resource & DoS
|
|
53
26
|
const no_unlimited_resource_allocation_1 = require("./rules/no-unlimited-resource-allocation");
|
|
54
27
|
const no_unchecked_loop_condition_1 = require("./rules/no-unchecked-loop-condition");
|
|
55
|
-
// Security rules - Auth & runtime hardening (wired 2026-05-09 — implementations existed but were unregistered)
|
|
56
28
|
const detect_weak_password_validation_1 = require("./rules/detect-weak-password-validation");
|
|
57
29
|
const no_electron_security_issues_1 = require("./rules/no-electron-security-issues");
|
|
58
30
|
const no_hardcoded_session_tokens_1 = require("./rules/no-hardcoded-session-tokens");
|
|
59
31
|
const require_secure_defaults_1 = require("./rules/require-secure-defaults");
|
|
60
|
-
/**
|
|
61
|
-
* Collection of all core security ESLint rules
|
|
62
|
-
*/
|
|
63
32
|
exports.rules = {
|
|
64
|
-
// Fundamental Injection (6 rules)
|
|
65
33
|
'no-graphql-injection': no_graphql_injection_1.noGraphqlInjection,
|
|
66
34
|
'no-xxe-injection': no_xxe_injection_1.noXxeInjection,
|
|
67
35
|
'no-xpath-injection': no_xpath_injection_1.noXpathInjection,
|
|
@@ -69,111 +37,55 @@ exports.rules = {
|
|
|
69
37
|
'no-directive-injection': no_directive_injection_1.noDirectiveInjection,
|
|
70
38
|
'no-format-string-injection': no_format_string_injection_1.noFormatStringInjection,
|
|
71
39
|
'no-template-injection': no_template_injection_1.noTemplateInjection,
|
|
72
|
-
// Regex Safety & Stability (3 rules)
|
|
73
40
|
'detect-non-literal-regexp': detect_non_literal_regexp_1.detectNonLiteralRegexp,
|
|
74
41
|
'no-redos-vulnerable-regex': no_redos_vulnerable_regex_1.noRedosVulnerableRegex,
|
|
75
42
|
'no-unsafe-regex-construction': no_unsafe_regex_construction_1.noUnsafeRegexConstruction,
|
|
76
|
-
// Data & Logic Integrity (5 rules)
|
|
77
43
|
'detect-object-injection': detect_object_injection_1.detectObjectInjection,
|
|
78
44
|
'no-unsafe-deserialization': no_unsafe_deserialization_1.noUnsafeDeserialization,
|
|
79
45
|
'no-insecure-comparison': no_insecure_comparison_1.noInsecureComparison,
|
|
80
46
|
'no-improper-sanitization': no_improper_sanitization_1.noImproperSanitization,
|
|
81
47
|
'no-improper-type-validation': no_improper_type_validation_1.noImproperTypeValidation,
|
|
82
|
-
// Auth/Access Logic (4 rules)
|
|
83
48
|
'no-missing-authentication': no_missing_authentication_1.noMissingAuthentication,
|
|
84
49
|
'no-privilege-escalation': no_privilege_escalation_1.noPrivilegeEscalation,
|
|
85
50
|
'no-weak-password-recovery': no_weak_password_recovery_1.noWeakPasswordRecovery,
|
|
86
51
|
'require-backend-authorization': require_backend_authorization_1.requireBackendAuthorization,
|
|
87
|
-
// Secrets & Exposure (3 rules)
|
|
88
52
|
'no-hardcoded-credentials': no_hardcoded_credentials_1.noHardcodedCredentials,
|
|
89
53
|
'no-sensitive-data-exposure': no_sensitive_data_exposure_1.noSensitiveDataExposure,
|
|
90
54
|
'no-pii-in-logs': no_pii_in_logs_1.noPiiInLogs,
|
|
91
|
-
// Resource Handling (2 rules)
|
|
92
55
|
'no-unlimited-resource-allocation': no_unlimited_resource_allocation_1.noUnlimitedResourceAllocation,
|
|
93
56
|
'no-unchecked-loop-condition': no_unchecked_loop_condition_1.noUncheckedLoopCondition,
|
|
94
|
-
// Auth & runtime hardening (4 rules — wired 2026-05-09)
|
|
95
57
|
'detect-weak-password-validation': detect_weak_password_validation_1.detectWeakPasswordValidation,
|
|
96
58
|
'no-electron-security-issues': no_electron_security_issues_1.noElectronSecurityIssues,
|
|
97
59
|
'no-hardcoded-session-tokens': no_hardcoded_session_tokens_1.noHardcodedSessionTokens,
|
|
98
60
|
'require-secure-defaults': require_secure_defaults_1.requireSecureDefaults,
|
|
99
61
|
};
|
|
100
|
-
/**
|
|
101
|
-
* ESLint Plugin object
|
|
102
|
-
*/
|
|
103
62
|
exports.plugin = {
|
|
104
63
|
meta: {
|
|
105
64
|
name: 'eslint-plugin-secure-coding',
|
|
106
|
-
version: '3.4.
|
|
65
|
+
version: '3.4.2',
|
|
107
66
|
},
|
|
108
67
|
rules: exports.rules,
|
|
109
68
|
};
|
|
110
|
-
/**
|
|
111
|
-
* Preset configurations for security rules
|
|
112
|
-
*/
|
|
113
69
|
const recommendedRules = {
|
|
114
|
-
// Critical - Injection vulnerabilities
|
|
115
|
-
// no-graphql-injection demoted to 'warn' 2026-05-09 — `npm run ilb:severity-audit`
|
|
116
|
-
// showed 61% of Wild hits on adversarial Edge code. Fails the README §1
|
|
117
|
-
// ≥ 95% precision floor for `error`-tier severity.
|
|
118
70
|
'secure-coding/no-graphql-injection': 'warn',
|
|
119
71
|
'secure-coding/no-xxe-injection': 'error',
|
|
120
72
|
'secure-coding/no-xpath-injection': 'error',
|
|
121
73
|
'secure-coding/no-ldap-injection': 'error',
|
|
122
|
-
// Critical - Deserialization
|
|
123
|
-
// Demoted 2026-05-09 — 76% Edge ratio.
|
|
124
74
|
'secure-coding/no-unsafe-deserialization': 'warn',
|
|
125
|
-
// High - Regex vulnerabilities
|
|
126
75
|
'secure-coding/detect-non-literal-regexp': 'warn',
|
|
127
|
-
// Demoted 2026-05-09 — 91% Edge ratio.
|
|
128
76
|
'secure-coding/no-redos-vulnerable-regex': 'error',
|
|
129
77
|
'secure-coding/no-unsafe-regex-construction': 'error',
|
|
130
|
-
// High - Prototype pollution
|
|
131
78
|
'secure-coding/detect-object-injection': 'warn',
|
|
132
|
-
// Critical - Credentials
|
|
133
79
|
'secure-coding/no-hardcoded-credentials': 'error',
|
|
134
|
-
// NOTE: `no-insecure-comparison` is intentionally NOT in `recommended`
|
|
135
|
-
// (removed 2026-07-31). It is `deprecated` in favour of
|
|
136
|
-
// `node-security/no-timing-unsafe-compare`, and what it actually reports on
|
|
137
|
-
// ordinary code is every `==` / `!=` — 876 findings on a 1,470-file corpus
|
|
138
|
-
// (webpack, lodash, eslint-plugin-import, two NestJS boilerplates), 100% of
|
|
139
|
-
// them already covered by core `eqeqeq`. Re-reporting another rule's
|
|
140
|
-
// findings under a CWE-697 security banner is noise, not signal, and no
|
|
141
|
-
// narrowing fixes that: the loose-equality half of this rule is a style
|
|
142
|
-
// check wearing a security hat.
|
|
143
|
-
//
|
|
144
|
-
// The timing-attack half (a secret compared with `===`) is the part worth
|
|
145
|
-
// keeping, and `node-security/no-timing-unsafe-compare` is where it lives —
|
|
146
|
-
// in that plugin's `recommended` preset since 2026-08-02, so consumers on
|
|
147
|
-
// presets keep CWE-697 coverage. It does mean the coverage now lives in a
|
|
148
|
-
// different package: a project that installs only `eslint-plugin-secure-coding`
|
|
149
|
-
// needs `eslint-plugin-node-security` as well to keep it.
|
|
150
|
-
// The rule remains exported and available via `strict` / explicit opt-in.
|
|
151
|
-
// Critical - Template injection
|
|
152
80
|
'secure-coding/no-template-injection': 'error',
|
|
153
|
-
// Critical - Data integrity
|
|
154
81
|
'secure-coding/no-improper-sanitization': 'error',
|
|
155
|
-
// High - Logic
|
|
156
|
-
// NOTE: no-missing-authentication and require-backend-authorization are deprecated in
|
|
157
|
-
// secure-coding — they assume Express route handler context and belong in express-security.
|
|
158
|
-
// Kept in the rules registry for backwards compat; removed from flagship config.
|
|
159
82
|
'secure-coding/no-privilege-escalation': 'warn',
|
|
160
|
-
'secure-coding/no-weak-password-recovery': 'warn',
|
|
161
|
-
// High - Exposure
|
|
83
|
+
'secure-coding/no-weak-password-recovery': 'warn',
|
|
162
84
|
'secure-coding/no-sensitive-data-exposure': 'warn',
|
|
163
|
-
// Medium - Resource & DoS
|
|
164
|
-
// Demoted 2026-05-09 — both rules fail the volume-error-risk gate
|
|
165
|
-
// (firing ≥ 100 times on Wild without sufficient fixture coverage to
|
|
166
|
-
// guarantee precision). Rules were also flagged for ≥ 76% Edge ratio.
|
|
167
85
|
'secure-coding/no-unlimited-resource-allocation': 'warn',
|
|
168
86
|
'secure-coding/no-unchecked-loop-condition': 'warn',
|
|
169
87
|
};
|
|
170
88
|
exports.configs = {
|
|
171
|
-
/**
|
|
172
|
-
* Flagship preset — the two rules from this plugin in the ecosystem-wide
|
|
173
|
-
* flagship list (`.agent/flagship-rules.md`). Use this when you want the
|
|
174
|
-
* highest-signal security subset shippable in CI gates without the noise
|
|
175
|
-
* of `recommended`.
|
|
176
|
-
*/
|
|
177
89
|
flagship: {
|
|
178
90
|
plugins: {
|
|
179
91
|
'secure-coding': exports.plugin,
|
|
@@ -183,81 +95,40 @@ exports.configs = {
|
|
|
183
95
|
'secure-coding/no-redos-vulnerable-regex': 'error',
|
|
184
96
|
},
|
|
185
97
|
},
|
|
186
|
-
/**
|
|
187
|
-
* Recommended security configuration
|
|
188
|
-
*
|
|
189
|
-
* Enables all core security rules with sensible severity levels.
|
|
190
|
-
*/
|
|
191
98
|
recommended: {
|
|
192
99
|
plugins: {
|
|
193
100
|
'secure-coding': exports.plugin,
|
|
194
101
|
},
|
|
195
102
|
rules: recommendedRules,
|
|
196
103
|
},
|
|
197
|
-
/**
|
|
198
|
-
* Recommended-strict configuration
|
|
199
|
-
*
|
|
200
|
-
* Same rule set as `recommended` but every rule is promoted to `'error'`.
|
|
201
|
-
* Use this when you want CI to block on all security findings rather than
|
|
202
|
-
* only warning on lower-confidence rules.
|
|
203
|
-
*
|
|
204
|
-
* This is the configuration independently chosen by production teams who
|
|
205
|
-
* audit `recommended` and decide they want zero tolerance on all 16 rules.
|
|
206
|
-
*/
|
|
207
104
|
'recommended-strict': {
|
|
208
105
|
plugins: {
|
|
209
106
|
'secure-coding': exports.plugin,
|
|
210
107
|
},
|
|
211
108
|
rules: Object.fromEntries(Object.keys(recommendedRules).map((rule) => [rule, 'error'])),
|
|
212
109
|
},
|
|
213
|
-
/**
|
|
214
|
-
* Strict security configuration
|
|
215
|
-
*
|
|
216
|
-
* ALL rules (including experimental and opinionated ones) set to 'error'.
|
|
217
|
-
* Prefer `recommended-strict` unless you specifically need full coverage.
|
|
218
|
-
*/
|
|
219
110
|
strict: {
|
|
220
111
|
plugins: {
|
|
221
112
|
'secure-coding': exports.plugin,
|
|
222
113
|
},
|
|
223
114
|
rules: Object.fromEntries(Object.keys(exports.rules).map(ruleName => [`secure-coding/${ruleName}`, 'error'])),
|
|
224
115
|
},
|
|
225
|
-
/**
|
|
226
|
-
* OWASP Top 10 focused configuration
|
|
227
|
-
*
|
|
228
|
-
* Rules mapped to OWASP Top 10 2021 categories.
|
|
229
|
-
*/
|
|
230
116
|
'owasp-top-10': {
|
|
231
117
|
plugins: {
|
|
232
118
|
'secure-coding': exports.plugin,
|
|
233
119
|
},
|
|
234
120
|
rules: {
|
|
235
|
-
// A01:2021 – Broken Access Control
|
|
236
|
-
// no-missing-authentication removed: Express-specific, use express-security plugin instead
|
|
237
121
|
'secure-coding/no-privilege-escalation': 'warn',
|
|
238
|
-
// A02:2021 – Cryptographic Failures
|
|
239
122
|
'secure-coding/no-hardcoded-credentials': 'error',
|
|
240
|
-
// Demoted from 'error': naming-heuristic detection (fires on variable names
|
|
241
|
-
// that sound sensitive). Cannot be enforcement-grade per I3 invariant.
|
|
242
123
|
'secure-coding/no-sensitive-data-exposure': 'warn',
|
|
243
|
-
// A03:2021 – Injection
|
|
244
124
|
'secure-coding/no-graphql-injection': 'error',
|
|
245
125
|
'secure-coding/no-xxe-injection': 'error',
|
|
246
126
|
'secure-coding/no-xpath-injection': 'error',
|
|
247
127
|
'secure-coding/no-ldap-injection': 'error',
|
|
248
|
-
// A04:2021 – Insecure Design
|
|
249
128
|
'secure-coding/no-weak-password-recovery': 'error',
|
|
250
129
|
'secure-coding/no-improper-type-validation': 'error',
|
|
251
|
-
// A07:2021 – Identification and Authentication Failures
|
|
252
|
-
// no-insecure-comparison removed for the same reason as in
|
|
253
|
-
// `recommended`: it re-reports `eqeqeq` under a security banner. Use
|
|
254
|
-
// `node-security/no-timing-unsafe-compare` for the timing-attack half.
|
|
255
|
-
// A08:2021 – Software and Data Integrity Failures
|
|
256
130
|
'secure-coding/no-unsafe-deserialization': 'error',
|
|
257
131
|
},
|
|
258
132
|
},
|
|
259
133
|
};
|
|
260
|
-
/**
|
|
261
|
-
* Default export for ESLint plugin
|
|
262
|
-
*/
|
|
263
134
|
exports.default = exports.plugin;
|
package/src/oxlint.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
import { plugin } from './index';
|
|
20
|
-
export = plugin;
|
|
1
|
+
// Minimal declaration written by scripts/build-package.ts.
|
|
2
|
+
//
|
|
3
|
+
// tsc's generated entry declaration inlined every inferred rule-option type
|
|
4
|
+
// (up to 166 kB per plugin) for an API no consumer calls directly. This types
|
|
5
|
+
// what a flat config actually touches. Per-rule option types remain available
|
|
6
|
+
// from the "./types" subpath export where a plugin provides one.
|
|
7
|
+
import type { Linter, Rule } from 'eslint';
|
|
8
|
+
|
|
9
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
10
|
+
export declare const configs: Record<string, Linter.Config>;
|
|
11
|
+
export declare const plugin: {
|
|
12
|
+
meta: { name: string; version: string };
|
|
13
|
+
rules: Record<string, Rule.RuleModule>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const _default: typeof plugin;
|
|
17
|
+
export default _default;
|
package/src/oxlint.js
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
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-secure-coding/oxlint"] }
|
|
12
|
-
*
|
|
13
|
-
* oxlint's JS plugin loader does `require('eslint-plugin-secure-coding/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
2
|
const index_1 = require("./index");
|
|
21
3
|
module.exports = index_1.plugin;
|