eslint-plugin-secure-coding 3.4.1 → 3.4.3
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 +2 -3
- package/src/index.js +30 -57
- package/src/rules/no-directive-injection/index.js +4 -4
- package/src/rules/no-electron-security-issues/index.js +2 -2
- package/src/rules/no-format-string-injection/index.js +4 -4
- package/src/rules/no-graphql-injection/index.js +4 -4
- package/src/rules/no-hardcoded-credentials/index.js +1 -1
- package/src/rules/no-improper-sanitization/index.js +4 -4
- package/src/rules/no-improper-type-validation/index.js +2 -2
- package/src/rules/no-insecure-comparison/index.js +6 -4
- package/src/rules/no-ldap-injection/index.js +3 -3
- package/src/rules/no-unchecked-loop-condition/index.js +4 -4
- package/src/rules/no-unlimited-resource-allocation/index.js +4 -3
- package/src/rules/no-unsafe-deserialization/index.js +3 -3
- package/src/rules/no-weak-password-recovery/index.js +4 -4
- package/src/rules/no-xpath-injection/index.js +3 -3
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.3",
|
|
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",
|
|
@@ -77,8 +77,7 @@
|
|
|
77
77
|
"node": ">=18.0.0"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"
|
|
81
|
-
"@interlace/eslint-devkit": "^1.6.1",
|
|
80
|
+
"@interlace/eslint-devkit": "^1.8.0",
|
|
82
81
|
"scslre": "^0.3.0",
|
|
83
82
|
"@eslint-community/regexpp": "^4.10.0"
|
|
84
83
|
},
|
package/src/index.js
CHANGED
|
@@ -1,68 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configs = exports.plugin = exports.rules = void 0;
|
|
4
|
-
const no_graphql_injection_1 = require("./rules/no-graphql-injection");
|
|
5
|
-
const no_xxe_injection_1 = require("./rules/no-xxe-injection");
|
|
6
|
-
const no_xpath_injection_1 = require("./rules/no-xpath-injection");
|
|
7
|
-
const no_ldap_injection_1 = require("./rules/no-ldap-injection");
|
|
8
|
-
const no_directive_injection_1 = require("./rules/no-directive-injection");
|
|
9
|
-
const no_format_string_injection_1 = require("./rules/no-format-string-injection");
|
|
10
|
-
const no_template_injection_1 = require("./rules/no-template-injection");
|
|
11
|
-
const detect_non_literal_regexp_1 = require("./rules/detect-non-literal-regexp");
|
|
12
|
-
const no_redos_vulnerable_regex_1 = require("./rules/no-redos-vulnerable-regex");
|
|
13
|
-
const no_unsafe_regex_construction_1 = require("./rules/no-unsafe-regex-construction");
|
|
14
|
-
const detect_object_injection_1 = require("./rules/detect-object-injection");
|
|
15
|
-
const no_unsafe_deserialization_1 = require("./rules/no-unsafe-deserialization");
|
|
16
|
-
const no_hardcoded_credentials_1 = require("./rules/no-hardcoded-credentials");
|
|
17
|
-
const no_insecure_comparison_1 = require("./rules/no-insecure-comparison");
|
|
18
|
-
const no_improper_sanitization_1 = require("./rules/no-improper-sanitization");
|
|
19
|
-
const no_improper_type_validation_1 = require("./rules/no-improper-type-validation");
|
|
20
|
-
const no_missing_authentication_1 = require("./rules/no-missing-authentication");
|
|
21
|
-
const no_privilege_escalation_1 = require("./rules/no-privilege-escalation");
|
|
22
|
-
const no_weak_password_recovery_1 = require("./rules/no-weak-password-recovery");
|
|
23
|
-
const require_backend_authorization_1 = require("./rules/require-backend-authorization");
|
|
24
|
-
const no_sensitive_data_exposure_1 = require("./rules/no-sensitive-data-exposure");
|
|
25
|
-
const no_pii_in_logs_1 = require("./rules/no-pii-in-logs");
|
|
26
|
-
const no_unlimited_resource_allocation_1 = require("./rules/no-unlimited-resource-allocation");
|
|
27
|
-
const no_unchecked_loop_condition_1 = require("./rules/no-unchecked-loop-condition");
|
|
28
|
-
const detect_weak_password_validation_1 = require("./rules/detect-weak-password-validation");
|
|
29
|
-
const no_electron_security_issues_1 = require("./rules/no-electron-security-issues");
|
|
30
|
-
const no_hardcoded_session_tokens_1 = require("./rules/no-hardcoded-session-tokens");
|
|
31
|
-
const require_secure_defaults_1 = require("./rules/require-secure-defaults");
|
|
32
4
|
exports.rules = {
|
|
33
|
-
'no-graphql-injection'
|
|
34
|
-
'no-xxe-injection'
|
|
35
|
-
'no-xpath-injection'
|
|
36
|
-
'no-ldap-injection'
|
|
37
|
-
'no-directive-injection'
|
|
38
|
-
'no-format-string-injection'
|
|
39
|
-
'no-template-injection'
|
|
40
|
-
'detect-non-literal-regexp'
|
|
41
|
-
'no-redos-vulnerable-regex'
|
|
42
|
-
'no-unsafe-regex-construction'
|
|
43
|
-
'detect-object-injection'
|
|
44
|
-
'no-unsafe-deserialization'
|
|
45
|
-
'no-insecure-comparison'
|
|
46
|
-
'no-improper-sanitization'
|
|
47
|
-
'no-improper-type-validation'
|
|
48
|
-
'no-missing-authentication'
|
|
49
|
-
'no-privilege-escalation'
|
|
50
|
-
'no-weak-password-recovery'
|
|
51
|
-
'require-backend-authorization'
|
|
52
|
-
'no-hardcoded-credentials'
|
|
53
|
-
'no-sensitive-data-exposure'
|
|
54
|
-
'no-pii-in-logs'
|
|
55
|
-
'no-unlimited-resource-allocation'
|
|
56
|
-
'no-unchecked-loop-condition'
|
|
57
|
-
'detect-weak-password-validation'
|
|
58
|
-
'no-electron-security-issues'
|
|
59
|
-
'no-hardcoded-session-tokens'
|
|
60
|
-
'require-secure-defaults'
|
|
5
|
+
get 'no-graphql-injection'() { return require("./rules/no-graphql-injection").noGraphqlInjection; },
|
|
6
|
+
get 'no-xxe-injection'() { return require("./rules/no-xxe-injection").noXxeInjection; },
|
|
7
|
+
get 'no-xpath-injection'() { return require("./rules/no-xpath-injection").noXpathInjection; },
|
|
8
|
+
get 'no-ldap-injection'() { return require("./rules/no-ldap-injection").noLdapInjection; },
|
|
9
|
+
get 'no-directive-injection'() { return require("./rules/no-directive-injection").noDirectiveInjection; },
|
|
10
|
+
get 'no-format-string-injection'() { return require("./rules/no-format-string-injection").noFormatStringInjection; },
|
|
11
|
+
get 'no-template-injection'() { return require("./rules/no-template-injection").noTemplateInjection; },
|
|
12
|
+
get 'detect-non-literal-regexp'() { return require("./rules/detect-non-literal-regexp").detectNonLiteralRegexp; },
|
|
13
|
+
get 'no-redos-vulnerable-regex'() { return require("./rules/no-redos-vulnerable-regex").noRedosVulnerableRegex; },
|
|
14
|
+
get 'no-unsafe-regex-construction'() { return require("./rules/no-unsafe-regex-construction").noUnsafeRegexConstruction; },
|
|
15
|
+
get 'detect-object-injection'() { return require("./rules/detect-object-injection").detectObjectInjection; },
|
|
16
|
+
get 'no-unsafe-deserialization'() { return require("./rules/no-unsafe-deserialization").noUnsafeDeserialization; },
|
|
17
|
+
get 'no-insecure-comparison'() { return require("./rules/no-insecure-comparison").noInsecureComparison; },
|
|
18
|
+
get 'no-improper-sanitization'() { return require("./rules/no-improper-sanitization").noImproperSanitization; },
|
|
19
|
+
get 'no-improper-type-validation'() { return require("./rules/no-improper-type-validation").noImproperTypeValidation; },
|
|
20
|
+
get 'no-missing-authentication'() { return require("./rules/no-missing-authentication").noMissingAuthentication; },
|
|
21
|
+
get 'no-privilege-escalation'() { return require("./rules/no-privilege-escalation").noPrivilegeEscalation; },
|
|
22
|
+
get 'no-weak-password-recovery'() { return require("./rules/no-weak-password-recovery").noWeakPasswordRecovery; },
|
|
23
|
+
get 'require-backend-authorization'() { return require("./rules/require-backend-authorization").requireBackendAuthorization; },
|
|
24
|
+
get 'no-hardcoded-credentials'() { return require("./rules/no-hardcoded-credentials").noHardcodedCredentials; },
|
|
25
|
+
get 'no-sensitive-data-exposure'() { return require("./rules/no-sensitive-data-exposure").noSensitiveDataExposure; },
|
|
26
|
+
get 'no-pii-in-logs'() { return require("./rules/no-pii-in-logs").noPiiInLogs; },
|
|
27
|
+
get 'no-unlimited-resource-allocation'() { return require("./rules/no-unlimited-resource-allocation").noUnlimitedResourceAllocation; },
|
|
28
|
+
get 'no-unchecked-loop-condition'() { return require("./rules/no-unchecked-loop-condition").noUncheckedLoopCondition; },
|
|
29
|
+
get 'detect-weak-password-validation'() { return require("./rules/detect-weak-password-validation").detectWeakPasswordValidation; },
|
|
30
|
+
get 'no-electron-security-issues'() { return require("./rules/no-electron-security-issues").noElectronSecurityIssues; },
|
|
31
|
+
get 'no-hardcoded-session-tokens'() { return require("./rules/no-hardcoded-session-tokens").noHardcodedSessionTokens; },
|
|
32
|
+
get 'require-secure-defaults'() { return require("./rules/require-secure-defaults").requireSecureDefaults; },
|
|
33
|
+
|
|
61
34
|
};
|
|
62
35
|
exports.plugin = {
|
|
63
36
|
meta: {
|
|
64
37
|
name: 'eslint-plugin-secure-coding',
|
|
65
|
-
version: '3.4.
|
|
38
|
+
version: '3.4.3',
|
|
66
39
|
},
|
|
67
40
|
rules: exports.rules,
|
|
68
41
|
};
|
|
@@ -143,21 +143,21 @@ exports.noDirectiveInjection = (0, eslint_devkit_1.createRule)({
|
|
|
143
143
|
trustedDirectives: {
|
|
144
144
|
type: 'array',
|
|
145
145
|
items: { type: 'string' },
|
|
146
|
-
default: ['ngIf', 'ngFor', 'ngClass', 'v-if', 'v-for', 'v-bind', 'v-on'],
|
|
146
|
+
default: ['ngIf', 'ngFor', 'ngClass', 'v-if', 'v-for', 'v-bind', 'v-on'], description: 'Template directives treated as safe'
|
|
147
147
|
},
|
|
148
148
|
userInputVariables: {
|
|
149
149
|
type: 'array',
|
|
150
150
|
items: { type: 'string' },
|
|
151
|
-
default: ['req', 'request', 'body', 'query', 'params', 'input', 'data', 'userInput'],
|
|
151
|
+
default: ['req', 'request', 'body', 'query', 'params', 'input', 'data', 'userInput'], description: 'Variable names treated as user-controlled input'
|
|
152
152
|
},
|
|
153
153
|
frameworks: {
|
|
154
154
|
type: 'array',
|
|
155
155
|
items: { type: 'string' },
|
|
156
|
-
default: ['angular', 'vue', 'react', 'svelte'],
|
|
156
|
+
default: ['angular', 'vue', 'react', 'svelte'], description: 'Template frameworks to analyse'
|
|
157
157
|
},
|
|
158
158
|
allowDynamicInComponents: {
|
|
159
159
|
type: 'boolean',
|
|
160
|
-
default: false,
|
|
160
|
+
default: false, description: 'Allow dynamic directives inside component code'
|
|
161
161
|
},
|
|
162
162
|
trustedSanitizers: {
|
|
163
163
|
type: 'array',
|
|
@@ -157,12 +157,12 @@ exports.noElectronSecurityIssues = (0, eslint_devkit_1.createRule)({
|
|
|
157
157
|
safePreloadPatterns: {
|
|
158
158
|
type: 'array',
|
|
159
159
|
items: { type: 'string' },
|
|
160
|
-
default: ['contextBridge', 'ipcRenderer'],
|
|
160
|
+
default: ['contextBridge', 'ipcRenderer'], description: 'Preload-script APIs treated as safe'
|
|
161
161
|
},
|
|
162
162
|
allowedIpcChannels: {
|
|
163
163
|
type: 'array',
|
|
164
164
|
items: { type: 'string' },
|
|
165
|
-
default: [],
|
|
165
|
+
default: [], description: 'IPC channel names allowed without validation'
|
|
166
166
|
},
|
|
167
167
|
trustedSanitizers: {
|
|
168
168
|
type: 'array',
|
|
@@ -75,22 +75,22 @@ exports.noFormatStringInjection = (0, eslint_devkit_1.createRule)({
|
|
|
75
75
|
formatFunctions: {
|
|
76
76
|
type: 'array',
|
|
77
77
|
items: { type: 'string' },
|
|
78
|
-
default: ['util.format', 'console.log', 'console.error', 'console.warn', 'sprintf', 'printf', 'vsprintf'],
|
|
78
|
+
default: ['util.format', 'console.log', 'console.error', 'console.warn', 'sprintf', 'printf', 'vsprintf'], description: 'Functions whose first argument is a format string'
|
|
79
79
|
},
|
|
80
80
|
formatSpecifiers: {
|
|
81
81
|
type: 'array',
|
|
82
82
|
items: { type: 'string' },
|
|
83
|
-
default: ['%s', '%d', '%i', '%f', '%j', '%o', '%O', '%c', '%%'],
|
|
83
|
+
default: ['%s', '%d', '%i', '%f', '%j', '%o', '%O', '%c', '%%'], description: 'Format specifiers recognised in a format string'
|
|
84
84
|
},
|
|
85
85
|
userInputVariables: {
|
|
86
86
|
type: 'array',
|
|
87
87
|
items: { type: 'string' },
|
|
88
|
-
default: ['req', 'request', 'body', 'query', 'params', 'input', 'data', 'userInput'],
|
|
88
|
+
default: ['req', 'request', 'body', 'query', 'params', 'input', 'data', 'userInput'], description: 'Variable names treated as user-controlled input'
|
|
89
89
|
},
|
|
90
90
|
safeFormatLibraries: {
|
|
91
91
|
type: 'array',
|
|
92
92
|
items: { type: 'string' },
|
|
93
|
-
default: ['mustache', 'handlebars', 'ejs', 'pug'],
|
|
93
|
+
default: ['mustache', 'handlebars', 'ejs', 'pug'], description: 'Templating libraries that escape their own input'
|
|
94
94
|
},
|
|
95
95
|
trustedSanitizers: {
|
|
96
96
|
type: 'array',
|
|
@@ -115,22 +115,22 @@ exports.noGraphqlInjection = (0, eslint_devkit_1.createRule)({
|
|
|
115
115
|
properties: {
|
|
116
116
|
allowIntrospection: {
|
|
117
117
|
type: 'boolean',
|
|
118
|
-
default: false,
|
|
118
|
+
default: false, description: 'Allow introspection queries'
|
|
119
119
|
},
|
|
120
120
|
maxQueryDepth: {
|
|
121
121
|
type: 'number',
|
|
122
122
|
minimum: 1,
|
|
123
|
-
default: 10,
|
|
123
|
+
default: 10, description: 'Maximum query nesting depth before reporting a DoS risk'
|
|
124
124
|
},
|
|
125
125
|
trustedGraphqlLibraries: {
|
|
126
126
|
type: 'array',
|
|
127
127
|
items: { type: 'string' },
|
|
128
|
-
default: ['graphql', 'apollo-server', 'graphql-tools', 'graphql-tag'],
|
|
128
|
+
default: ['graphql', 'apollo-server', 'graphql-tools', 'graphql-tag'], description: 'GraphQL libraries recognised as query builders'
|
|
129
129
|
},
|
|
130
130
|
validationFunctions: {
|
|
131
131
|
type: 'array',
|
|
132
132
|
items: { type: 'string' },
|
|
133
|
-
default: ['validate', 'sanitize', 'isValid', 'assertValid'],
|
|
133
|
+
default: ['validate', 'sanitize', 'isValid', 'assertValid'], description: 'Function names that count as query validation'
|
|
134
134
|
},
|
|
135
135
|
safeTemplateLiteralCallers: {
|
|
136
136
|
type: 'array',
|
|
@@ -318,7 +318,7 @@ exports.noHardcodedCredentials = (0, eslint_devkit_2.createRule)({
|
|
|
318
318
|
allowPlaceholders: {
|
|
319
319
|
type: 'boolean',
|
|
320
320
|
default: true,
|
|
321
|
-
description: 'Skip self-evident placeholder values (
|
|
321
|
+
description: 'Skip self-evident placeholder values (`<your-secret-here>`, `changeme`, `xxxxxxxx`)',
|
|
322
322
|
},
|
|
323
323
|
},
|
|
324
324
|
additionalProperties: false,
|
|
@@ -143,22 +143,22 @@ exports.noImproperSanitization = (0, eslint_devkit_1.createRule)({
|
|
|
143
143
|
safeSanitizers: {
|
|
144
144
|
type: 'array',
|
|
145
145
|
items: { type: 'string' },
|
|
146
|
-
default: ['DOMPurify.sanitize', 'he.encode', 'encodeURIComponent', 'encodeURI', 'escape'],
|
|
146
|
+
default: ['DOMPurify.sanitize', 'he.encode', 'encodeURIComponent', 'encodeURI', 'escape'], description: 'Sanitizer calls treated as sufficient'
|
|
147
147
|
},
|
|
148
148
|
dangerousChars: {
|
|
149
149
|
type: 'array',
|
|
150
150
|
items: { type: 'string' },
|
|
151
|
-
default: ['<', '>', '"', "'", '&', '`', '$', '{', '}', '|', ';', '(', ')'],
|
|
151
|
+
default: ['<', '>', '"', "'", '&', '`', '$', '{', '}', '|', ';', '(', ')'], description: 'Characters a sanitizer is expected to handle'
|
|
152
152
|
},
|
|
153
153
|
contexts: {
|
|
154
154
|
type: 'array',
|
|
155
155
|
items: { type: 'string' },
|
|
156
|
-
default: ['html', 'url', 'sql', 'command', 'javascript', 'css'],
|
|
156
|
+
default: ['html', 'url', 'sql', 'command', 'javascript', 'css'], description: 'Output contexts checked for a context-appropriate sanitizer'
|
|
157
157
|
},
|
|
158
158
|
trustedLibraries: {
|
|
159
159
|
type: 'array',
|
|
160
160
|
items: { type: 'string' },
|
|
161
|
-
default: ['DOMPurify', 'he', 'validator', 'express-validator'],
|
|
161
|
+
default: ['DOMPurify', 'he', 'validator', 'express-validator'], description: 'Libraries whose sanitizers are trusted'
|
|
162
162
|
},
|
|
163
163
|
trustedSanitizers: {
|
|
164
164
|
type: 'array',
|
|
@@ -134,12 +134,12 @@ exports.noImproperTypeValidation = (0, eslint_devkit_1.createRule)({
|
|
|
134
134
|
userInputVariables: {
|
|
135
135
|
type: 'array',
|
|
136
136
|
items: { type: 'string' },
|
|
137
|
-
default: ['req', 'request', 'body', 'query', 'params', 'input', 'data', 'userInput'],
|
|
137
|
+
default: ['req', 'request', 'body', 'query', 'params', 'input', 'data', 'userInput'], description: 'Variable names treated as user-controlled input'
|
|
138
138
|
},
|
|
139
139
|
safeTypeCheckFunctions: {
|
|
140
140
|
type: 'array',
|
|
141
141
|
items: { type: 'string' },
|
|
142
|
-
default: ['isArray', 'isString', 'isNumber', 'isObject', 'validateType', 'checkType'],
|
|
142
|
+
default: ['isArray', 'isString', 'isNumber', 'isObject', 'validateType', 'checkType'], description: 'Function names that count as a type check'
|
|
143
143
|
},
|
|
144
144
|
allowInstanceofSameRealm: {
|
|
145
145
|
type: 'boolean',
|
|
@@ -15,7 +15,6 @@ exports.noInsecureComparison = (0, eslint_devkit_2.createRule)({
|
|
|
15
15
|
cwe: 'CWE-697',
|
|
16
16
|
cvss: 5.3,
|
|
17
17
|
},
|
|
18
|
-
fixable: 'code',
|
|
19
18
|
hasSuggestions: true,
|
|
20
19
|
messages: {
|
|
21
20
|
insecureComparison: (0, eslint_devkit_1.formatLLMMessage)({
|
|
@@ -109,6 +108,9 @@ exports.noInsecureComparison = (0, eslint_devkit_2.createRule)({
|
|
|
109
108
|
}
|
|
110
109
|
});
|
|
111
110
|
}
|
|
111
|
+
function isNullLiteral(node) {
|
|
112
|
+
return node.type === 'Literal' && node.raw === 'null';
|
|
113
|
+
}
|
|
112
114
|
function checkBinaryExpression(node) {
|
|
113
115
|
if (isTestFile) {
|
|
114
116
|
return;
|
|
@@ -214,6 +216,9 @@ exports.noInsecureComparison = (0, eslint_devkit_2.createRule)({
|
|
|
214
216
|
if (matchesIgnorePattern(text, ignorePatterns)) {
|
|
215
217
|
return;
|
|
216
218
|
}
|
|
219
|
+
if (isNullLiteral(node.left) || isNullLiteral(node.right)) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
217
222
|
const strictOperator = node.operator === '==' ? '===' : '!==';
|
|
218
223
|
const leftText = sourceCode.getText(node.left);
|
|
219
224
|
const rightText = sourceCode.getText(node.right);
|
|
@@ -226,9 +231,6 @@ exports.noInsecureComparison = (0, eslint_devkit_2.createRule)({
|
|
|
226
231
|
strictOperator,
|
|
227
232
|
example,
|
|
228
233
|
},
|
|
229
|
-
fix: (fixer) => {
|
|
230
|
-
return fixer.replaceText(node, example);
|
|
231
|
-
},
|
|
232
234
|
suggest: [
|
|
233
235
|
{
|
|
234
236
|
messageId: 'useStrictEquality',
|
|
@@ -124,17 +124,17 @@ exports.noLdapInjection = (0, eslint_devkit_1.createRule)({
|
|
|
124
124
|
ldapFunctions: {
|
|
125
125
|
type: 'array',
|
|
126
126
|
items: { type: 'string' },
|
|
127
|
-
default: ['search', 'bind', 'modify', 'add', 'delete', 'compare', 'searchAsync'],
|
|
127
|
+
default: ['search', 'bind', 'modify', 'add', 'delete', 'compare', 'searchAsync'], description: 'LDAP client methods treated as query sinks'
|
|
128
128
|
},
|
|
129
129
|
ldapEscapeFunctions: {
|
|
130
130
|
type: 'array',
|
|
131
131
|
items: { type: 'string' },
|
|
132
|
-
default: ['escape.filterValue', 'escape.dnValue', 'filterEscape', 'dnEscape'],
|
|
132
|
+
default: ['escape.filterValue', 'escape.dnValue', 'filterEscape', 'dnEscape'], description: 'Function names that escape LDAP filter or DN values'
|
|
133
133
|
},
|
|
134
134
|
ldapValidationFunctions: {
|
|
135
135
|
type: 'array',
|
|
136
136
|
items: { type: 'string' },
|
|
137
|
-
default: ['validateLdapInput', 'sanitizeLdapFilter', 'cleanLdapValue', 'checkLdapFilter'],
|
|
137
|
+
default: ['validateLdapInput', 'sanitizeLdapFilter', 'cleanLdapValue', 'checkLdapFilter'], description: 'Function names that count as LDAP input validation'
|
|
138
138
|
},
|
|
139
139
|
trustedSanitizers: {
|
|
140
140
|
type: 'array',
|
|
@@ -85,21 +85,21 @@ exports.noUncheckedLoopCondition = (0, eslint_devkit_1.createRule)({
|
|
|
85
85
|
maxStaticIterations: {
|
|
86
86
|
type: 'number',
|
|
87
87
|
minimum: 100,
|
|
88
|
-
default: 10000,
|
|
88
|
+
default: 10000, description: 'Literal iteration count above which a loop is reported'
|
|
89
89
|
},
|
|
90
90
|
userInputVariables: {
|
|
91
91
|
type: 'array',
|
|
92
92
|
items: { type: 'string' },
|
|
93
|
-
default: ['req', 'request', 'body', 'query', 'params', 'input', 'data'],
|
|
93
|
+
default: ['req', 'request', 'body', 'query', 'params', 'input', 'data'], description: 'Variable names treated as user-controlled input'
|
|
94
94
|
},
|
|
95
95
|
allowWhileTrueWithBreak: {
|
|
96
96
|
type: 'boolean',
|
|
97
|
-
default: true,
|
|
97
|
+
default: true, description: 'Allow `while (true)` when the body contains a `break`'
|
|
98
98
|
},
|
|
99
99
|
maxRecursionDepth: {
|
|
100
100
|
type: 'number',
|
|
101
101
|
minimum: 1,
|
|
102
|
-
default: 10,
|
|
102
|
+
default: 10, description: 'Recursion depth above which a call is reported'
|
|
103
103
|
},
|
|
104
104
|
trustedSanitizers: {
|
|
105
105
|
type: 'array',
|
|
@@ -144,20 +144,21 @@ exports.noUnlimitedResourceAllocation = (0, eslint_devkit_1.createRule)({
|
|
|
144
144
|
type: 'number',
|
|
145
145
|
minimum: 1024,
|
|
146
146
|
default: 1048576,
|
|
147
|
+
description: 'Allocation size in bytes above which a call is reported',
|
|
147
148
|
},
|
|
148
149
|
userInputVariables: {
|
|
149
150
|
type: 'array',
|
|
150
151
|
items: { type: 'string' },
|
|
151
|
-
default: ['req', 'request', 'body', 'query', 'params', 'input', 'data'],
|
|
152
|
+
default: ['req', 'request', 'body', 'query', 'params', 'input', 'data'], description: 'Variable names treated as user-controlled input'
|
|
152
153
|
},
|
|
153
154
|
safeResourceFunctions: {
|
|
154
155
|
type: 'array',
|
|
155
156
|
items: { type: 'string' },
|
|
156
|
-
default: ['validateSize', 'checkLimits', 'limitResource', 'safeAlloc'],
|
|
157
|
+
default: ['validateSize', 'checkLimits', 'limitResource', 'safeAlloc'], description: 'Function names that bound an allocation'
|
|
157
158
|
},
|
|
158
159
|
requireResourceValidation: {
|
|
159
160
|
type: 'boolean',
|
|
160
|
-
default: true,
|
|
161
|
+
default: true, description: 'Require an explicit size check before allocating'
|
|
161
162
|
},
|
|
162
163
|
trustedSanitizers: {
|
|
163
164
|
type: 'array',
|
|
@@ -130,17 +130,17 @@ exports.noUnsafeDeserialization = (0, eslint_devkit_1.createRule)({
|
|
|
130
130
|
dangerousFunctions: {
|
|
131
131
|
type: 'array',
|
|
132
132
|
items: { type: 'string' },
|
|
133
|
-
default: ['eval', 'Function', 'setTimeout', 'setInterval', 'unserialize', 'deserialize', 'parseUnsafe'],
|
|
133
|
+
default: ['eval', 'Function', 'setTimeout', 'setInterval', 'unserialize', 'deserialize', 'parseUnsafe'], description: 'Functions that execute or deserialize untrusted input'
|
|
134
134
|
},
|
|
135
135
|
safeLibraries: {
|
|
136
136
|
type: 'array',
|
|
137
137
|
items: { type: 'string' },
|
|
138
|
-
default: ['JSON', 'safe-json-parse', 'js-yaml.safeLoad', 'protobuf', 'msgpack'],
|
|
138
|
+
default: ['JSON', 'safe-json-parse', 'js-yaml.safeLoad', 'protobuf', 'msgpack'], description: 'Parsers that do not execute their input'
|
|
139
139
|
},
|
|
140
140
|
validationFunctions: {
|
|
141
141
|
type: 'array',
|
|
142
142
|
items: { type: 'string' },
|
|
143
|
-
default: ['validateInput', 'sanitizeData', 'checkSchema', 'validateSchema'],
|
|
143
|
+
default: ['validateInput', 'sanitizeData', 'checkSchema', 'validateSchema'], description: 'Function names that count as input validation'
|
|
144
144
|
},
|
|
145
145
|
trustedSanitizers: {
|
|
146
146
|
type: 'array',
|
|
@@ -160,22 +160,22 @@ exports.noWeakPasswordRecovery = (0, eslint_devkit_1.createRule)({
|
|
|
160
160
|
minTokenEntropy: {
|
|
161
161
|
type: 'number',
|
|
162
162
|
minimum: 64,
|
|
163
|
-
default: 128,
|
|
163
|
+
default: 128, description: 'Minimum recovery-token entropy in bits'
|
|
164
164
|
},
|
|
165
165
|
maxTokenLifetimeHours: {
|
|
166
166
|
type: 'number',
|
|
167
167
|
minimum: 0.25,
|
|
168
|
-
default: 1,
|
|
168
|
+
default: 1, description: 'Maximum recovery-token lifetime in hours'
|
|
169
169
|
},
|
|
170
170
|
recoveryKeywords: {
|
|
171
171
|
type: 'array',
|
|
172
172
|
items: { type: 'string' },
|
|
173
|
-
default: ['reset', 'password', 'recovery', 'forgot', 'token', 'resetToken'],
|
|
173
|
+
default: ['reset', 'password', 'recovery', 'forgot', 'token', 'resetToken'], description: 'Identifier keywords that mark password-recovery code'
|
|
174
174
|
},
|
|
175
175
|
secureTokenFunctions: {
|
|
176
176
|
type: 'array',
|
|
177
177
|
items: { type: 'string' },
|
|
178
|
-
default: ['crypto.randomBytes', 'crypto.randomUUID', 'randomBytes', 'generateSecureToken'],
|
|
178
|
+
default: ['crypto.randomBytes', 'crypto.randomUUID', 'randomBytes', 'generateSecureToken'], description: 'Functions that generate cryptographically secure tokens'
|
|
179
179
|
},
|
|
180
180
|
trustedSanitizers: {
|
|
181
181
|
type: 'array',
|
|
@@ -107,17 +107,17 @@ exports.noXpathInjection = (0, eslint_devkit_1.createRule)({
|
|
|
107
107
|
xpathFunctions: {
|
|
108
108
|
type: 'array',
|
|
109
109
|
items: { type: 'string' },
|
|
110
|
-
default: ['evaluate', 'selectSingleNode', 'selectNodes', 'xpath', 'select'],
|
|
110
|
+
default: ['evaluate', 'selectSingleNode', 'selectNodes', 'xpath', 'select'], description: 'XPath evaluation methods treated as query sinks'
|
|
111
111
|
},
|
|
112
112
|
safeXpathConstructors: {
|
|
113
113
|
type: 'array',
|
|
114
114
|
items: { type: 'string' },
|
|
115
|
-
default: ['buildXPath', 'createXPath', 'safeXPath', 'xpathBuilder'],
|
|
115
|
+
default: ['buildXPath', 'createXPath', 'safeXPath', 'xpathBuilder'], description: 'Builders that produce a parameterized XPath expression'
|
|
116
116
|
},
|
|
117
117
|
xpathValidationFunctions: {
|
|
118
118
|
type: 'array',
|
|
119
119
|
items: { type: 'string' },
|
|
120
|
-
default: ['validateXPath', 'escapeXPath', 'sanitizeXPath', 'cleanXPath'],
|
|
120
|
+
default: ['validateXPath', 'escapeXPath', 'sanitizeXPath', 'cleanXPath'], description: 'Function names that escape or validate XPath input'
|
|
121
121
|
},
|
|
122
122
|
trustedSanitizers: {
|
|
123
123
|
type: 'array',
|