eslint-plugin-secure-coding 1.0.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/AGENTS.md +196 -0
- package/CHANGELOG.md +105 -0
- package/LICENSE +23 -0
- package/README.md +377 -0
- package/package.json +80 -0
- package/src/index.d.ts +32 -0
- package/src/index.js +345 -0
- package/src/index.js.map +1 -0
- package/src/rules/security/database-injection.d.ts +13 -0
- package/src/rules/security/database-injection.js +407 -0
- package/src/rules/security/database-injection.js.map +1 -0
- package/src/rules/security/detect-child-process.d.ts +11 -0
- package/src/rules/security/detect-child-process.js +460 -0
- package/src/rules/security/detect-child-process.js.map +1 -0
- package/src/rules/security/detect-eval-with-expression.d.ts +9 -0
- package/src/rules/security/detect-eval-with-expression.js +393 -0
- package/src/rules/security/detect-eval-with-expression.js.map +1 -0
- package/src/rules/security/detect-non-literal-fs-filename.d.ts +7 -0
- package/src/rules/security/detect-non-literal-fs-filename.js +322 -0
- package/src/rules/security/detect-non-literal-fs-filename.js.map +1 -0
- package/src/rules/security/detect-non-literal-regexp.d.ts +9 -0
- package/src/rules/security/detect-non-literal-regexp.js +387 -0
- package/src/rules/security/detect-non-literal-regexp.js.map +1 -0
- package/src/rules/security/detect-object-injection.d.ts +11 -0
- package/src/rules/security/detect-object-injection.js +411 -0
- package/src/rules/security/detect-object-injection.js.map +1 -0
- package/src/rules/security/no-buffer-overread.d.ts +14 -0
- package/src/rules/security/no-buffer-overread.js +519 -0
- package/src/rules/security/no-buffer-overread.js.map +1 -0
- package/src/rules/security/no-clickjacking.d.ts +10 -0
- package/src/rules/security/no-clickjacking.js +381 -0
- package/src/rules/security/no-clickjacking.js.map +1 -0
- package/src/rules/security/no-directive-injection.d.ts +12 -0
- package/src/rules/security/no-directive-injection.js +446 -0
- package/src/rules/security/no-directive-injection.js.map +1 -0
- package/src/rules/security/no-document-cookie.d.ts +5 -0
- package/src/rules/security/no-document-cookie.js +90 -0
- package/src/rules/security/no-document-cookie.js.map +1 -0
- package/src/rules/security/no-electron-security-issues.d.ts +10 -0
- package/src/rules/security/no-electron-security-issues.js +421 -0
- package/src/rules/security/no-electron-security-issues.js.map +1 -0
- package/src/rules/security/no-exposed-sensitive-data.d.ts +11 -0
- package/src/rules/security/no-exposed-sensitive-data.js +341 -0
- package/src/rules/security/no-exposed-sensitive-data.js.map +1 -0
- package/src/rules/security/no-format-string-injection.d.ts +17 -0
- package/src/rules/security/no-format-string-injection.js +653 -0
- package/src/rules/security/no-format-string-injection.js.map +1 -0
- package/src/rules/security/no-graphql-injection.d.ts +12 -0
- package/src/rules/security/no-graphql-injection.js +410 -0
- package/src/rules/security/no-graphql-injection.js.map +1 -0
- package/src/rules/security/no-hardcoded-credentials.d.ts +26 -0
- package/src/rules/security/no-hardcoded-credentials.js +377 -0
- package/src/rules/security/no-hardcoded-credentials.js.map +1 -0
- package/src/rules/security/no-improper-sanitization.d.ts +12 -0
- package/src/rules/security/no-improper-sanitization.js +408 -0
- package/src/rules/security/no-improper-sanitization.js.map +1 -0
- package/src/rules/security/no-improper-type-validation.d.ts +10 -0
- package/src/rules/security/no-improper-type-validation.js +420 -0
- package/src/rules/security/no-improper-type-validation.js.map +1 -0
- package/src/rules/security/no-insecure-comparison.d.ts +7 -0
- package/src/rules/security/no-insecure-comparison.js +125 -0
- package/src/rules/security/no-insecure-comparison.js.map +1 -0
- package/src/rules/security/no-insecure-cookie-settings.d.ts +9 -0
- package/src/rules/security/no-insecure-cookie-settings.js +305 -0
- package/src/rules/security/no-insecure-cookie-settings.js.map +1 -0
- package/src/rules/security/no-insecure-jwt.d.ts +10 -0
- package/src/rules/security/no-insecure-jwt.js +338 -0
- package/src/rules/security/no-insecure-jwt.js.map +1 -0
- package/src/rules/security/no-insecure-redirects.d.ts +7 -0
- package/src/rules/security/no-insecure-redirects.js +215 -0
- package/src/rules/security/no-insecure-redirects.js.map +1 -0
- package/src/rules/security/no-insufficient-postmessage-validation.d.ts +14 -0
- package/src/rules/security/no-insufficient-postmessage-validation.js +390 -0
- package/src/rules/security/no-insufficient-postmessage-validation.js.map +1 -0
- package/src/rules/security/no-insufficient-random.d.ts +9 -0
- package/src/rules/security/no-insufficient-random.js +207 -0
- package/src/rules/security/no-insufficient-random.js.map +1 -0
- package/src/rules/security/no-ldap-injection.d.ts +10 -0
- package/src/rules/security/no-ldap-injection.js +449 -0
- package/src/rules/security/no-ldap-injection.js.map +1 -0
- package/src/rules/security/no-missing-authentication.d.ts +13 -0
- package/src/rules/security/no-missing-authentication.js +322 -0
- package/src/rules/security/no-missing-authentication.js.map +1 -0
- package/src/rules/security/no-missing-cors-check.d.ts +9 -0
- package/src/rules/security/no-missing-cors-check.js +449 -0
- package/src/rules/security/no-missing-cors-check.js.map +1 -0
- package/src/rules/security/no-missing-csrf-protection.d.ts +11 -0
- package/src/rules/security/no-missing-csrf-protection.js +183 -0
- package/src/rules/security/no-missing-csrf-protection.js.map +1 -0
- package/src/rules/security/no-missing-security-headers.d.ts +7 -0
- package/src/rules/security/no-missing-security-headers.js +217 -0
- package/src/rules/security/no-missing-security-headers.js.map +1 -0
- package/src/rules/security/no-privilege-escalation.d.ts +13 -0
- package/src/rules/security/no-privilege-escalation.js +321 -0
- package/src/rules/security/no-privilege-escalation.js.map +1 -0
- package/src/rules/security/no-redos-vulnerable-regex.d.ts +7 -0
- package/src/rules/security/no-redos-vulnerable-regex.js +307 -0
- package/src/rules/security/no-redos-vulnerable-regex.js.map +1 -0
- package/src/rules/security/no-sensitive-data-exposure.d.ts +11 -0
- package/src/rules/security/no-sensitive-data-exposure.js +251 -0
- package/src/rules/security/no-sensitive-data-exposure.js.map +1 -0
- package/src/rules/security/no-sql-injection.d.ts +10 -0
- package/src/rules/security/no-sql-injection.js +332 -0
- package/src/rules/security/no-sql-injection.js.map +1 -0
- package/src/rules/security/no-timing-attack.d.ts +10 -0
- package/src/rules/security/no-timing-attack.js +358 -0
- package/src/rules/security/no-timing-attack.js.map +1 -0
- package/src/rules/security/no-toctou-vulnerability.d.ts +7 -0
- package/src/rules/security/no-toctou-vulnerability.js +165 -0
- package/src/rules/security/no-toctou-vulnerability.js.map +1 -0
- package/src/rules/security/no-unchecked-loop-condition.d.ts +12 -0
- package/src/rules/security/no-unchecked-loop-condition.js +635 -0
- package/src/rules/security/no-unchecked-loop-condition.js.map +1 -0
- package/src/rules/security/no-unencrypted-transmission.d.ts +11 -0
- package/src/rules/security/no-unencrypted-transmission.js +237 -0
- package/src/rules/security/no-unencrypted-transmission.js.map +1 -0
- package/src/rules/security/no-unescaped-url-parameter.d.ts +9 -0
- package/src/rules/security/no-unescaped-url-parameter.js +266 -0
- package/src/rules/security/no-unescaped-url-parameter.js.map +1 -0
- package/src/rules/security/no-unlimited-resource-allocation.d.ts +12 -0
- package/src/rules/security/no-unlimited-resource-allocation.js +659 -0
- package/src/rules/security/no-unlimited-resource-allocation.js.map +1 -0
- package/src/rules/security/no-unsafe-deserialization.d.ts +10 -0
- package/src/rules/security/no-unsafe-deserialization.js +501 -0
- package/src/rules/security/no-unsafe-deserialization.js.map +1 -0
- package/src/rules/security/no-unsafe-dynamic-require.d.ts +5 -0
- package/src/rules/security/no-unsafe-dynamic-require.js +107 -0
- package/src/rules/security/no-unsafe-dynamic-require.js.map +1 -0
- package/src/rules/security/no-unsafe-regex-construction.d.ts +9 -0
- package/src/rules/security/no-unsafe-regex-construction.js +292 -0
- package/src/rules/security/no-unsafe-regex-construction.js.map +1 -0
- package/src/rules/security/no-unsanitized-html.d.ts +9 -0
- package/src/rules/security/no-unsanitized-html.js +347 -0
- package/src/rules/security/no-unsanitized-html.js.map +1 -0
- package/src/rules/security/no-unvalidated-user-input.d.ts +9 -0
- package/src/rules/security/no-unvalidated-user-input.js +418 -0
- package/src/rules/security/no-unvalidated-user-input.js.map +1 -0
- package/src/rules/security/no-weak-crypto.d.ts +11 -0
- package/src/rules/security/no-weak-crypto.js +350 -0
- package/src/rules/security/no-weak-crypto.js.map +1 -0
- package/src/rules/security/no-weak-password-recovery.d.ts +12 -0
- package/src/rules/security/no-weak-password-recovery.js +401 -0
- package/src/rules/security/no-weak-password-recovery.js.map +1 -0
- package/src/rules/security/no-xpath-injection.d.ts +10 -0
- package/src/rules/security/no-xpath-injection.js +487 -0
- package/src/rules/security/no-xpath-injection.js.map +1 -0
- package/src/rules/security/no-xxe-injection.d.ts +7 -0
- package/src/rules/security/no-xxe-injection.js +270 -0
- package/src/rules/security/no-xxe-injection.js.map +1 -0
- package/src/rules/security/no-zip-slip.d.ts +9 -0
- package/src/rules/security/no-zip-slip.js +446 -0
- package/src/rules/security/no-zip-slip.js.map +1 -0
- package/src/types/index.d.ts +131 -0
- package/src/types/index.js +18 -0
- package/src/types/index.js.map +1 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noZipSlip = void 0;
|
|
4
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
+
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
6
|
+
exports.noZipSlip = (0, eslint_devkit_1.createRule)({
|
|
7
|
+
name: 'no-zip-slip',
|
|
8
|
+
meta: {
|
|
9
|
+
type: 'problem',
|
|
10
|
+
docs: {
|
|
11
|
+
description: 'Detects zip slip/archive extraction vulnerabilities',
|
|
12
|
+
},
|
|
13
|
+
fixable: 'code',
|
|
14
|
+
hasSuggestions: true,
|
|
15
|
+
messages: {
|
|
16
|
+
zipSlipVulnerability: (0, eslint_devkit_2.formatLLMMessage)({
|
|
17
|
+
icon: eslint_devkit_2.MessageIcons.SECURITY,
|
|
18
|
+
issueName: 'Zip Slip Vulnerability',
|
|
19
|
+
cwe: 'CWE-22',
|
|
20
|
+
description: 'Archive extraction vulnerable to path traversal',
|
|
21
|
+
severity: '{{severity}}',
|
|
22
|
+
fix: '{{safeAlternative}}',
|
|
23
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/22.html',
|
|
24
|
+
}),
|
|
25
|
+
unsafeArchiveExtraction: (0, eslint_devkit_2.formatLLMMessage)({
|
|
26
|
+
icon: eslint_devkit_2.MessageIcons.SECURITY,
|
|
27
|
+
issueName: 'Unsafe Archive Extraction',
|
|
28
|
+
cwe: 'CWE-22',
|
|
29
|
+
description: 'Archive extraction without path validation',
|
|
30
|
+
severity: 'HIGH',
|
|
31
|
+
fix: 'Use safe extraction libraries or validate all paths',
|
|
32
|
+
documentationLink: 'https://snyk.io/research/zip-slip-vulnerability',
|
|
33
|
+
}),
|
|
34
|
+
pathTraversalInArchive: (0, eslint_devkit_2.formatLLMMessage)({
|
|
35
|
+
icon: eslint_devkit_2.MessageIcons.SECURITY,
|
|
36
|
+
issueName: 'Path Traversal in Archive',
|
|
37
|
+
cwe: 'CWE-22',
|
|
38
|
+
description: 'Archive contains path traversal sequences',
|
|
39
|
+
severity: 'CRITICAL',
|
|
40
|
+
fix: 'Reject archives with path traversal or sanitize paths',
|
|
41
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/22.html',
|
|
42
|
+
}),
|
|
43
|
+
unvalidatedArchivePath: (0, eslint_devkit_2.formatLLMMessage)({
|
|
44
|
+
icon: eslint_devkit_2.MessageIcons.SECURITY,
|
|
45
|
+
issueName: 'Unvalidated Archive Path',
|
|
46
|
+
cwe: 'CWE-22',
|
|
47
|
+
description: 'Archive entry path used without validation',
|
|
48
|
+
severity: 'HIGH',
|
|
49
|
+
fix: 'Validate paths before extraction',
|
|
50
|
+
documentationLink: 'https://snyk.io/research/zip-slip-vulnerability',
|
|
51
|
+
}),
|
|
52
|
+
dangerousArchiveDestination: (0, eslint_devkit_2.formatLLMMessage)({
|
|
53
|
+
icon: eslint_devkit_2.MessageIcons.SECURITY,
|
|
54
|
+
issueName: 'Dangerous Archive Destination',
|
|
55
|
+
cwe: 'CWE-22',
|
|
56
|
+
description: 'Archive extracted to sensitive location',
|
|
57
|
+
severity: 'MEDIUM',
|
|
58
|
+
fix: 'Extract to safe temporary directory',
|
|
59
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/22.html',
|
|
60
|
+
}),
|
|
61
|
+
useSafeArchiveExtraction: (0, eslint_devkit_2.formatLLMMessage)({
|
|
62
|
+
icon: eslint_devkit_2.MessageIcons.INFO,
|
|
63
|
+
issueName: 'Use Safe Archive Extraction',
|
|
64
|
+
description: 'Use libraries with built-in path validation',
|
|
65
|
+
severity: 'LOW',
|
|
66
|
+
fix: 'Use yauzl, safe-archive-extract, or similar safe libraries',
|
|
67
|
+
documentationLink: 'https://www.npmjs.com/package/yauzl',
|
|
68
|
+
}),
|
|
69
|
+
validateArchivePaths: (0, eslint_devkit_2.formatLLMMessage)({
|
|
70
|
+
icon: eslint_devkit_2.MessageIcons.INFO,
|
|
71
|
+
issueName: 'Validate Archive Paths',
|
|
72
|
+
description: 'Validate all archive entry paths',
|
|
73
|
+
severity: 'LOW',
|
|
74
|
+
fix: 'Check paths don\'t contain ../ and are within destination directory',
|
|
75
|
+
documentationLink: 'https://snyk.io/research/zip-slip-vulnerability',
|
|
76
|
+
}),
|
|
77
|
+
sanitizeArchiveNames: (0, eslint_devkit_2.formatLLMMessage)({
|
|
78
|
+
icon: eslint_devkit_2.MessageIcons.INFO,
|
|
79
|
+
issueName: 'Sanitize Archive Names',
|
|
80
|
+
description: 'Sanitize archive entry names',
|
|
81
|
+
severity: 'LOW',
|
|
82
|
+
fix: 'Use path.basename() or custom sanitization',
|
|
83
|
+
documentationLink: 'https://nodejs.org/api/path.html#pathbasenamepath-ext',
|
|
84
|
+
}),
|
|
85
|
+
strategyPathValidation: (0, eslint_devkit_2.formatLLMMessage)({
|
|
86
|
+
icon: eslint_devkit_2.MessageIcons.STRATEGY,
|
|
87
|
+
issueName: 'Path Validation Strategy',
|
|
88
|
+
description: 'Validate paths before any file operations',
|
|
89
|
+
severity: 'LOW',
|
|
90
|
+
fix: 'Check path.startsWith(destination) and no ../ sequences',
|
|
91
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/22.html',
|
|
92
|
+
}),
|
|
93
|
+
strategySafeLibraries: (0, eslint_devkit_2.formatLLMMessage)({
|
|
94
|
+
icon: eslint_devkit_2.MessageIcons.STRATEGY,
|
|
95
|
+
issueName: 'Safe Libraries Strategy',
|
|
96
|
+
description: 'Use archive libraries with built-in safety',
|
|
97
|
+
severity: 'LOW',
|
|
98
|
+
fix: 'Use yauzl, adm-zip with validation, or safe-archive-extract',
|
|
99
|
+
documentationLink: 'https://www.npmjs.com/package/safe-archive-extract',
|
|
100
|
+
}),
|
|
101
|
+
strategySandboxing: (0, eslint_devkit_2.formatLLMMessage)({
|
|
102
|
+
icon: eslint_devkit_2.MessageIcons.STRATEGY,
|
|
103
|
+
issueName: 'Sandboxing Strategy',
|
|
104
|
+
description: 'Extract archives in sandboxed environment',
|
|
105
|
+
severity: 'LOW',
|
|
106
|
+
fix: 'Use temporary directories and restrict permissions',
|
|
107
|
+
documentationLink: 'https://nodejs.org/api/fs.html#fsopentempdirprefix-options-callback',
|
|
108
|
+
})
|
|
109
|
+
},
|
|
110
|
+
schema: [
|
|
111
|
+
{
|
|
112
|
+
type: 'object',
|
|
113
|
+
properties: {
|
|
114
|
+
archiveFunctions: {
|
|
115
|
+
type: 'array',
|
|
116
|
+
items: { type: 'string' },
|
|
117
|
+
default: ['extract', 'extractAll', 'extractAllTo', 'unzip', 'untar', 'extractArchive'],
|
|
118
|
+
},
|
|
119
|
+
pathValidationFunctions: {
|
|
120
|
+
type: 'array',
|
|
121
|
+
items: { type: 'string' },
|
|
122
|
+
default: ['validatePath', 'sanitizePath', 'checkPath', 'safePath'],
|
|
123
|
+
},
|
|
124
|
+
safeLibraries: {
|
|
125
|
+
type: 'array',
|
|
126
|
+
items: { type: 'string' },
|
|
127
|
+
default: ['yauzl', 'safe-archive-extract', 'tar-stream', 'unzipper'],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
additionalProperties: false,
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
defaultOptions: [
|
|
135
|
+
{
|
|
136
|
+
archiveFunctions: ['extract', 'extractAll', 'extractAllTo', 'unzip', 'untar', 'extractArchive'],
|
|
137
|
+
pathValidationFunctions: ['validatePath', 'sanitizePath', 'checkPath', 'safePath'],
|
|
138
|
+
safeLibraries: ['yauzl', 'safe-archive-extract', 'tar-stream', 'unzipper'],
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
create(context) {
|
|
142
|
+
const options = context.options[0] || {};
|
|
143
|
+
const { archiveFunctions = ['extract', 'extractAll', 'extractAllTo', 'unzip', 'untar', 'extractArchive'], pathValidationFunctions = ['validatePath', 'sanitizePath', 'checkPath', 'safePath'], safeLibraries = ['yauzl', 'safe-archive-extract', 'tar-stream', 'unzipper'], } = options;
|
|
144
|
+
const filename = context.filename || context.getFilename();
|
|
145
|
+
// Safety checks are implemented directly in the handlers
|
|
146
|
+
/**
|
|
147
|
+
* Check if this is an archive extraction operation
|
|
148
|
+
*/
|
|
149
|
+
const isArchiveExtraction = (node) => {
|
|
150
|
+
const callee = node.callee;
|
|
151
|
+
// Check for archive method calls (e.g., zip.extractAllTo)
|
|
152
|
+
if (callee.type === 'MemberExpression' &&
|
|
153
|
+
callee.property.type === 'Identifier' &&
|
|
154
|
+
archiveFunctions.includes(callee.property.name)) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
// Check for standalone archive functions (e.g., extractArchive)
|
|
158
|
+
if (callee.type === 'Identifier' &&
|
|
159
|
+
archiveFunctions.includes(callee.name)) {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Check if path contains dangerous traversal sequences
|
|
166
|
+
*/
|
|
167
|
+
const containsPathTraversal = (pathText) => {
|
|
168
|
+
// Check for ../ sequences
|
|
169
|
+
return /\.\.\//.test(pathText) ||
|
|
170
|
+
/\.\.\\/.test(pathText) || // Windows paths
|
|
171
|
+
/^\.\./.test(pathText) || // Leading ..
|
|
172
|
+
/\/\.\./.test(pathText); // Embedded /..
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Check if path has been validated
|
|
176
|
+
*/
|
|
177
|
+
const isPathValidated = (pathNode) => {
|
|
178
|
+
let current = pathNode;
|
|
179
|
+
while (current) {
|
|
180
|
+
if (current.type === 'CallExpression' &&
|
|
181
|
+
current.callee.type === 'Identifier' &&
|
|
182
|
+
pathValidationFunctions.includes(current.callee.name)) {
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
current = current.parent;
|
|
186
|
+
}
|
|
187
|
+
return false;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Check if this uses a safe library
|
|
191
|
+
*/
|
|
192
|
+
const isSafeLibrary = (node) => {
|
|
193
|
+
const callee = node.callee;
|
|
194
|
+
if (callee.type === 'MemberExpression' &&
|
|
195
|
+
callee.object.type === 'Identifier' &&
|
|
196
|
+
safeLibraries.includes(callee.object.name)) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Check if destination is dangerous
|
|
203
|
+
*/
|
|
204
|
+
const isDangerousDestination = (destText) => {
|
|
205
|
+
return destText.includes('/tmp') ||
|
|
206
|
+
destText.includes('/var') ||
|
|
207
|
+
destText.includes('/usr') ||
|
|
208
|
+
destText.includes('/etc') ||
|
|
209
|
+
destText.includes('/root') ||
|
|
210
|
+
destText.includes('/home') ||
|
|
211
|
+
destText.includes('C:\\Windows') ||
|
|
212
|
+
destText.includes('C:\\Program Files') ||
|
|
213
|
+
destText.includes('C:\\Users');
|
|
214
|
+
};
|
|
215
|
+
return {
|
|
216
|
+
// Check archive extraction calls
|
|
217
|
+
CallExpression(node) {
|
|
218
|
+
if (isArchiveExtraction(node) && !isSafeLibrary(node)) {
|
|
219
|
+
// Check for @safe annotations in the source
|
|
220
|
+
const sourceCode = context.sourceCode;
|
|
221
|
+
let hasSafeAnnotation = false;
|
|
222
|
+
// Look for @safe comments in the source code
|
|
223
|
+
const allComments = sourceCode.getAllComments();
|
|
224
|
+
for (const comment of allComments) {
|
|
225
|
+
if (comment.type === 'Block' && comment.value.includes('@safe')) {
|
|
226
|
+
hasSafeAnnotation = true;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (hasSafeAnnotation) {
|
|
231
|
+
return; // Skip reporting if marked as safe
|
|
232
|
+
}
|
|
233
|
+
// Check if destination is dangerous
|
|
234
|
+
const args = node.arguments;
|
|
235
|
+
let destArg;
|
|
236
|
+
// Determine which argument is the destination based on the function
|
|
237
|
+
if (node.callee.type === 'MemberExpression' && node.callee.property.type === 'Identifier') {
|
|
238
|
+
const methodName = node.callee.property.name;
|
|
239
|
+
if (['extractAllTo', 'unzip'].includes(methodName)) {
|
|
240
|
+
// Destination is the first argument
|
|
241
|
+
destArg = args[0];
|
|
242
|
+
}
|
|
243
|
+
else if (archiveFunctions.includes(methodName)) {
|
|
244
|
+
// For other archive functions, destination is typically the second argument
|
|
245
|
+
destArg = args.length >= 2 ? args[1] : undefined;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else if (node.callee.type === 'Identifier' && archiveFunctions.includes(node.callee.name)) {
|
|
249
|
+
// For standalone functions like extractArchive(file, dest)
|
|
250
|
+
destArg = args.length >= 2 ? args[1] : undefined;
|
|
251
|
+
}
|
|
252
|
+
const destText = destArg && destArg.type === 'Literal' && typeof destArg.value === 'string' ? destArg.value : '';
|
|
253
|
+
const isDestDangerous = isDangerousDestination(destText);
|
|
254
|
+
const isMethodCall = node.callee.type === 'MemberExpression';
|
|
255
|
+
if (isMethodCall) {
|
|
256
|
+
// Method calls report unsafeArchiveExtraction unless destination is a safe relative path
|
|
257
|
+
const isSafeRelativePath = destText.startsWith('./') || destText.startsWith('../');
|
|
258
|
+
if (!isSafeRelativePath) {
|
|
259
|
+
context.report({
|
|
260
|
+
node,
|
|
261
|
+
messageId: 'unsafeArchiveExtraction',
|
|
262
|
+
data: {
|
|
263
|
+
filePath: filename,
|
|
264
|
+
line: String(node.loc?.start.line ?? 0),
|
|
265
|
+
},
|
|
266
|
+
suggest: [
|
|
267
|
+
{
|
|
268
|
+
messageId: 'useSafeArchiveExtraction',
|
|
269
|
+
fix: () => null,
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
// For safe relative paths, don't report any error
|
|
275
|
+
// Additionally report dangerous destination for dangerous destinations
|
|
276
|
+
if (isDestDangerous) {
|
|
277
|
+
context.report({
|
|
278
|
+
node: destArg || node,
|
|
279
|
+
messageId: 'dangerousArchiveDestination',
|
|
280
|
+
data: {
|
|
281
|
+
filePath: filename,
|
|
282
|
+
line: String(node.loc?.start.line ?? 0),
|
|
283
|
+
},
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
// Standalone calls: report dangerousArchiveDestination for dangerous destinations, unsafeArchiveExtraction otherwise
|
|
289
|
+
if (isDestDangerous) {
|
|
290
|
+
context.report({
|
|
291
|
+
node,
|
|
292
|
+
messageId: 'dangerousArchiveDestination',
|
|
293
|
+
data: {
|
|
294
|
+
filePath: filename,
|
|
295
|
+
line: String(node.loc?.start.line ?? 0),
|
|
296
|
+
},
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
context.report({
|
|
301
|
+
node,
|
|
302
|
+
messageId: 'unsafeArchiveExtraction',
|
|
303
|
+
data: {
|
|
304
|
+
filePath: filename,
|
|
305
|
+
line: String(node.loc?.start.line ?? 0),
|
|
306
|
+
},
|
|
307
|
+
suggest: [
|
|
308
|
+
{
|
|
309
|
+
messageId: 'useSafeArchiveExtraction',
|
|
310
|
+
fix: () => null
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
// Check for path.join or similar operations with archive entry names
|
|
318
|
+
const callee = node.callee;
|
|
319
|
+
if (callee.type === 'MemberExpression' &&
|
|
320
|
+
callee.property.type === 'Identifier' &&
|
|
321
|
+
['join', 'resolve', 'relative', 'normalize'].includes(callee.property.name)) {
|
|
322
|
+
// Check arguments for potential archive entry usage
|
|
323
|
+
const args = node.arguments;
|
|
324
|
+
for (const arg of args) {
|
|
325
|
+
if (arg.type === 'MemberExpression' &&
|
|
326
|
+
arg.property.type === 'Identifier' &&
|
|
327
|
+
['name', 'path', 'fileName', 'entryName', 'relativePath', 'filename', 'pathname'].includes(arg.property.name)) {
|
|
328
|
+
// This looks like path.join(dest, entry.name) - check if validated
|
|
329
|
+
if (!isPathValidated(arg)) {
|
|
330
|
+
context.report({
|
|
331
|
+
node: arg,
|
|
332
|
+
messageId: 'unvalidatedArchivePath',
|
|
333
|
+
data: {
|
|
334
|
+
filePath: filename,
|
|
335
|
+
line: String(node.loc?.start.line ?? 0),
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
// Check string literals for dangerous paths
|
|
344
|
+
Literal(node) {
|
|
345
|
+
if (typeof node.value !== 'string') {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
const text = node.value;
|
|
349
|
+
// Check for path traversal in strings that look like file paths
|
|
350
|
+
if ((text.includes('/') || text.includes('\\')) && containsPathTraversal(text)) {
|
|
351
|
+
// Check if this is in an archive-related context
|
|
352
|
+
let current = node;
|
|
353
|
+
let isArchiveContext = false;
|
|
354
|
+
while (current && !isArchiveContext) {
|
|
355
|
+
if (current.type === 'CallExpression' && isArchiveExtraction(current)) {
|
|
356
|
+
isArchiveContext = true;
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
if (current.type === 'VariableDeclarator' &&
|
|
360
|
+
current.id.type === 'Identifier' &&
|
|
361
|
+
(current.id.name.includes('archive') ||
|
|
362
|
+
current.id.name.includes('zip') ||
|
|
363
|
+
current.id.name.includes('tar') ||
|
|
364
|
+
current.id.name.includes('path') ||
|
|
365
|
+
current.id.name.includes('file') ||
|
|
366
|
+
current.id.name.includes('entry'))) {
|
|
367
|
+
isArchiveContext = true;
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
current = current.parent;
|
|
371
|
+
}
|
|
372
|
+
// Also check if the variable name suggests archive usage
|
|
373
|
+
const parent = node.parent;
|
|
374
|
+
if (parent && parent.type === 'VariableDeclarator' && parent.id.type === 'Identifier') {
|
|
375
|
+
const varName = parent.id.name.toLowerCase();
|
|
376
|
+
if (varName.includes('archive') || varName.includes('zip') || varName.includes('tar') ||
|
|
377
|
+
varName.includes('path') || varName.includes('file') || varName.includes('extract') ||
|
|
378
|
+
varName.includes('entry')) {
|
|
379
|
+
isArchiveContext = true;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (isArchiveContext) {
|
|
383
|
+
context.report({
|
|
384
|
+
node,
|
|
385
|
+
messageId: 'pathTraversalInArchive',
|
|
386
|
+
data: {
|
|
387
|
+
filePath: filename,
|
|
388
|
+
line: String(node.loc?.start.line ?? 0),
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
// Dangerous destinations are handled by the CallExpression handler to avoid duplicates
|
|
394
|
+
// Only check for dangerous destinations not related to archive extraction
|
|
395
|
+
if (isDangerousDestination(text) && !containsPathTraversal(text)) {
|
|
396
|
+
// Check if this is used as an extraction destination
|
|
397
|
+
let current = node;
|
|
398
|
+
let isExtractionDest = false;
|
|
399
|
+
while (current && !isExtractionDest) {
|
|
400
|
+
if (current.type === 'CallExpression' && isArchiveExtraction(current)) {
|
|
401
|
+
// Check if this node is a destination argument
|
|
402
|
+
const args = current.arguments;
|
|
403
|
+
const callee = current.callee;
|
|
404
|
+
const isMethodCall = callee.type === 'MemberExpression';
|
|
405
|
+
if ((isMethodCall && args.length >= 1 && args[0] === node) ||
|
|
406
|
+
(!isMethodCall && args.length >= 2 && args[1] === node)) {
|
|
407
|
+
isExtractionDest = true;
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
current = current.parent;
|
|
412
|
+
}
|
|
413
|
+
// Only report if not already handled by CallExpression handler
|
|
414
|
+
if (!isExtractionDest) {
|
|
415
|
+
context.report({
|
|
416
|
+
node,
|
|
417
|
+
messageId: 'dangerousArchiveDestination',
|
|
418
|
+
data: {
|
|
419
|
+
filePath: filename,
|
|
420
|
+
line: String(node.loc?.start.line ?? 0),
|
|
421
|
+
},
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
// Check variable assignments
|
|
427
|
+
VariableDeclarator(node) {
|
|
428
|
+
if (!node.init || node.id.type !== 'Identifier') {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const varName = node.id.name.toLowerCase();
|
|
432
|
+
// Check if this variable holds archive-related data
|
|
433
|
+
if (varName.includes('entry') || varName.includes('file') || varName.includes('path')) {
|
|
434
|
+
if (node.init.type === 'MemberExpression' &&
|
|
435
|
+
node.init.property.type === 'Identifier' &&
|
|
436
|
+
['name', 'path'].includes(node.init.property.name)) {
|
|
437
|
+
// This looks like: const entryName = entry.name;
|
|
438
|
+
// Check if this variable is used unsafely later
|
|
439
|
+
// This is a simplified check - in practice we'd need more sophisticated analysis
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
},
|
|
445
|
+
});
|
|
446
|
+
//# sourceMappingURL=no-zip-slip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-zip-slip.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/security/no-zip-slip.ts"],"names":[],"mappings":";;;AAgBA,4DAAsD;AACtD,4DAA0E;AA4B7D,QAAA,SAAS,GAAG,IAAA,0BAAU,EAA0B;IAC3D,IAAI,EAAE,a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ACpD,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;oBACtF,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,kBAAkB;wBACrC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;wBACxC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;wBAEvD,iDAAiD;wBACjD,gDAAgD;wBAChD,iFAAiF;oBACnF,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* eslint-plugin-secure-coding Type Exports
|
|
3
|
+
*
|
|
4
|
+
* Barrel file that exports all security rule Options types with consistent naming.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import type { NoSqlInjectionOptions } from 'eslint-plugin-secure-coding/types';
|
|
9
|
+
*
|
|
10
|
+
* const config: NoSqlInjectionOptions = {
|
|
11
|
+
* allowDynamicTableNames: false,
|
|
12
|
+
* strategy: 'parameterize',
|
|
13
|
+
* };
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import type { Options as NoSqlInjectionOptions } from '../rules/security/no-sql-injection';
|
|
17
|
+
import type { Options as DatabaseInjectionOptions } from '../rules/security/database-injection';
|
|
18
|
+
import type { Options as DetectEvalWithExpressionOptions } from '../rules/security/detect-eval-with-expression';
|
|
19
|
+
import type { Options as DetectChildProcessOptions } from '../rules/security/detect-child-process';
|
|
20
|
+
import type { Options as NoUnsafeDynamicRequireOptions } from '../rules/security/no-unsafe-dynamic-require';
|
|
21
|
+
import type { Options as NoGraphqlInjectionOptions } from '../rules/security/no-graphql-injection';
|
|
22
|
+
import type { Options as NoXxeInjectionOptions } from '../rules/security/no-xxe-injection';
|
|
23
|
+
import type { Options as NoXpathInjectionOptions } from '../rules/security/no-xpath-injection';
|
|
24
|
+
import type { Options as NoLdapInjectionOptions } from '../rules/security/no-ldap-injection';
|
|
25
|
+
import type { Options as NoDirectiveInjectionOptions } from '../rules/security/no-directive-injection';
|
|
26
|
+
import type { Options as NoFormatStringInjectionOptions } from '../rules/security/no-format-string-injection';
|
|
27
|
+
import type { Options as DetectNonLiteralFsFilenameOptions } from '../rules/security/detect-non-literal-fs-filename';
|
|
28
|
+
import type { Options as NoZipSlipOptions } from '../rules/security/no-zip-slip';
|
|
29
|
+
import type { Options as NoToctouVulnerabilityOptions } from '../rules/security/no-toctou-vulnerability';
|
|
30
|
+
import type { Options as DetectNonLiteralRegexpOptions } from '../rules/security/detect-non-literal-regexp';
|
|
31
|
+
import type { Options as NoRedosVulnerableRegexOptions } from '../rules/security/no-redos-vulnerable-regex';
|
|
32
|
+
import type { Options as NoUnsafeRegexConstructionOptions } from '../rules/security/no-unsafe-regex-construction';
|
|
33
|
+
import type { Options as DetectObjectInjectionOptions } from '../rules/security/detect-object-injection';
|
|
34
|
+
import type { Options as NoUnsafeDeserializationOptions } from '../rules/security/no-unsafe-deserialization';
|
|
35
|
+
import type { Options as NoHardcodedCredentialsOptions } from '../rules/security/no-hardcoded-credentials';
|
|
36
|
+
import type { Options as NoWeakCryptoOptions } from '../rules/security/no-weak-crypto';
|
|
37
|
+
import type { Options as NoInsufficientRandomOptions } from '../rules/security/no-insufficient-random';
|
|
38
|
+
import type { Options as NoTimingAttackOptions } from '../rules/security/no-timing-attack';
|
|
39
|
+
import type { Options as NoInsecureComparisonOptions } from '../rules/security/no-insecure-comparison';
|
|
40
|
+
import type { Options as NoInsecureJwtOptions } from '../rules/security/no-insecure-jwt';
|
|
41
|
+
import type { Options as NoUnvalidatedUserInputOptions } from '../rules/security/no-unvalidated-user-input';
|
|
42
|
+
import type { Options as NoUnsanitizedHtmlOptions } from '../rules/security/no-unsanitized-html';
|
|
43
|
+
import type { Options as NoUnescapedUrlParameterOptions } from '../rules/security/no-unescaped-url-parameter';
|
|
44
|
+
import type { Options as NoImproperSanitizationOptions } from '../rules/security/no-improper-sanitization';
|
|
45
|
+
import type { Options as NoImproperTypeValidationOptions } from '../rules/security/no-improper-type-validation';
|
|
46
|
+
import type { Options as NoMissingAuthenticationOptions } from '../rules/security/no-missing-authentication';
|
|
47
|
+
import type { Options as NoPrivilegeEscalationOptions } from '../rules/security/no-privilege-escalation';
|
|
48
|
+
import type { Options as NoWeakPasswordRecoveryOptions } from '../rules/security/no-weak-password-recovery';
|
|
49
|
+
import type { Options as NoInsecureCookieSettingsOptions } from '../rules/security/no-insecure-cookie-settings';
|
|
50
|
+
import type { Options as NoMissingCsrfProtectionOptions } from '../rules/security/no-missing-csrf-protection';
|
|
51
|
+
import type { Options as NoDocumentCookieOptions } from '../rules/security/no-document-cookie';
|
|
52
|
+
import type { Options as NoMissingCorsCheckOptions } from '../rules/security/no-missing-cors-check';
|
|
53
|
+
import type { Options as NoMissingSecurityHeadersOptions } from '../rules/security/no-missing-security-headers';
|
|
54
|
+
import type { Options as NoInsecureRedirectsOptions } from '../rules/security/no-insecure-redirects';
|
|
55
|
+
import type { Options as NoUnencryptedTransmissionOptions } from '../rules/security/no-unencrypted-transmission';
|
|
56
|
+
import type { Options as NoClickjackingOptions } from '../rules/security/no-clickjacking';
|
|
57
|
+
import type { Options as NoExposedSensitiveDataOptions } from '../rules/security/no-exposed-sensitive-data';
|
|
58
|
+
import type { Options as NoSensitiveDataExposureOptions } from '../rules/security/no-sensitive-data-exposure';
|
|
59
|
+
import type { Options as NoBufferOverreadOptions } from '../rules/security/no-buffer-overread';
|
|
60
|
+
import type { Options as NoUnlimitedResourceAllocationOptions } from '../rules/security/no-unlimited-resource-allocation';
|
|
61
|
+
import type { Options as NoUncheckedLoopConditionOptions } from '../rules/security/no-unchecked-loop-condition';
|
|
62
|
+
import type { Options as NoElectronSecurityIssuesOptions } from '../rules/security/no-electron-security-issues';
|
|
63
|
+
import type { Options as NoInsufficientPostmessageValidationOptions } from '../rules/security/no-insufficient-postmessage-validation';
|
|
64
|
+
export type { NoSqlInjectionOptions, DatabaseInjectionOptions, DetectEvalWithExpressionOptions, DetectChildProcessOptions, NoUnsafeDynamicRequireOptions, NoGraphqlInjectionOptions, NoXxeInjectionOptions, NoXpathInjectionOptions, NoLdapInjectionOptions, NoDirectiveInjectionOptions, NoFormatStringInjectionOptions, DetectNonLiteralFsFilenameOptions, NoZipSlipOptions, NoToctouVulnerabilityOptions, DetectNonLiteralRegexpOptions, NoRedosVulnerableRegexOptions, NoUnsafeRegexConstructionOptions, DetectObjectInjectionOptions, NoUnsafeDeserializationOptions, NoHardcodedCredentialsOptions, NoWeakCryptoOptions, NoInsufficientRandomOptions, NoTimingAttackOptions, NoInsecureComparisonOptions, NoInsecureJwtOptions, NoUnvalidatedUserInputOptions, NoUnsanitizedHtmlOptions, NoUnescapedUrlParameterOptions, NoImproperSanitizationOptions, NoImproperTypeValidationOptions, NoMissingAuthenticationOptions, NoPrivilegeEscalationOptions, NoWeakPasswordRecoveryOptions, NoInsecureCookieSettingsOptions, NoMissingCsrfProtectionOptions, NoDocumentCookieOptions, NoMissingCorsCheckOptions, NoMissingSecurityHeadersOptions, NoInsecureRedirectsOptions, NoUnencryptedTransmissionOptions, NoClickjackingOptions, NoExposedSensitiveDataOptions, NoSensitiveDataExposureOptions, NoBufferOverreadOptions, NoUnlimitedResourceAllocationOptions, NoUncheckedLoopConditionOptions, NoElectronSecurityIssuesOptions, NoInsufficientPostmessageValidationOptions, };
|
|
65
|
+
/**
|
|
66
|
+
* Combined type for all security rule options
|
|
67
|
+
* Useful for creating unified configuration objects
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const config: AllSecurityRulesOptions = {
|
|
72
|
+
* 'no-sql-injection': {
|
|
73
|
+
* allowDynamicTableNames: false,
|
|
74
|
+
* strategy: 'parameterize',
|
|
75
|
+
* },
|
|
76
|
+
* 'no-hardcoded-credentials': {
|
|
77
|
+
* ignorePatterns: ['test/*'],
|
|
78
|
+
* },
|
|
79
|
+
* };
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export type AllSecurityRulesOptions = {
|
|
83
|
+
'no-sql-injection'?: NoSqlInjectionOptions;
|
|
84
|
+
'database-injection'?: DatabaseInjectionOptions;
|
|
85
|
+
'detect-eval-with-expression'?: DetectEvalWithExpressionOptions;
|
|
86
|
+
'detect-child-process'?: DetectChildProcessOptions;
|
|
87
|
+
'no-unsafe-dynamic-require'?: NoUnsafeDynamicRequireOptions;
|
|
88
|
+
'no-graphql-injection'?: NoGraphqlInjectionOptions;
|
|
89
|
+
'no-xxe-injection'?: NoXxeInjectionOptions;
|
|
90
|
+
'no-xpath-injection'?: NoXpathInjectionOptions;
|
|
91
|
+
'no-ldap-injection'?: NoLdapInjectionOptions;
|
|
92
|
+
'no-directive-injection'?: NoDirectiveInjectionOptions;
|
|
93
|
+
'no-format-string-injection'?: NoFormatStringInjectionOptions;
|
|
94
|
+
'detect-non-literal-fs-filename'?: DetectNonLiteralFsFilenameOptions;
|
|
95
|
+
'no-zip-slip'?: NoZipSlipOptions;
|
|
96
|
+
'no-toctou-vulnerability'?: NoToctouVulnerabilityOptions;
|
|
97
|
+
'detect-non-literal-regexp'?: DetectNonLiteralRegexpOptions;
|
|
98
|
+
'no-redos-vulnerable-regex'?: NoRedosVulnerableRegexOptions;
|
|
99
|
+
'no-unsafe-regex-construction'?: NoUnsafeRegexConstructionOptions;
|
|
100
|
+
'detect-object-injection'?: DetectObjectInjectionOptions;
|
|
101
|
+
'no-unsafe-deserialization'?: NoUnsafeDeserializationOptions;
|
|
102
|
+
'no-hardcoded-credentials'?: NoHardcodedCredentialsOptions;
|
|
103
|
+
'no-weak-crypto'?: NoWeakCryptoOptions;
|
|
104
|
+
'no-insufficient-random'?: NoInsufficientRandomOptions;
|
|
105
|
+
'no-timing-attack'?: NoTimingAttackOptions;
|
|
106
|
+
'no-insecure-comparison'?: NoInsecureComparisonOptions;
|
|
107
|
+
'no-insecure-jwt'?: NoInsecureJwtOptions;
|
|
108
|
+
'no-unvalidated-user-input'?: NoUnvalidatedUserInputOptions;
|
|
109
|
+
'no-unsanitized-html'?: NoUnsanitizedHtmlOptions;
|
|
110
|
+
'no-unescaped-url-parameter'?: NoUnescapedUrlParameterOptions;
|
|
111
|
+
'no-improper-sanitization'?: NoImproperSanitizationOptions;
|
|
112
|
+
'no-improper-type-validation'?: NoImproperTypeValidationOptions;
|
|
113
|
+
'no-missing-authentication'?: NoMissingAuthenticationOptions;
|
|
114
|
+
'no-privilege-escalation'?: NoPrivilegeEscalationOptions;
|
|
115
|
+
'no-weak-password-recovery'?: NoWeakPasswordRecoveryOptions;
|
|
116
|
+
'no-insecure-cookie-settings'?: NoInsecureCookieSettingsOptions;
|
|
117
|
+
'no-missing-csrf-protection'?: NoMissingCsrfProtectionOptions;
|
|
118
|
+
'no-document-cookie'?: NoDocumentCookieOptions;
|
|
119
|
+
'no-missing-cors-check'?: NoMissingCorsCheckOptions;
|
|
120
|
+
'no-missing-security-headers'?: NoMissingSecurityHeadersOptions;
|
|
121
|
+
'no-insecure-redirects'?: NoInsecureRedirectsOptions;
|
|
122
|
+
'no-unencrypted-transmission'?: NoUnencryptedTransmissionOptions;
|
|
123
|
+
'no-clickjacking'?: NoClickjackingOptions;
|
|
124
|
+
'no-exposed-sensitive-data'?: NoExposedSensitiveDataOptions;
|
|
125
|
+
'no-sensitive-data-exposure'?: NoSensitiveDataExposureOptions;
|
|
126
|
+
'no-buffer-overread'?: NoBufferOverreadOptions;
|
|
127
|
+
'no-unlimited-resource-allocation'?: NoUnlimitedResourceAllocationOptions;
|
|
128
|
+
'no-unchecked-loop-condition'?: NoUncheckedLoopConditionOptions;
|
|
129
|
+
'no-electron-security-issues'?: NoElectronSecurityIssuesOptions;
|
|
130
|
+
'no-insufficient-postmessage-validation'?: NoInsufficientPostmessageValidationOptions;
|
|
131
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* eslint-plugin-secure-coding Type Exports
|
|
4
|
+
*
|
|
5
|
+
* Barrel file that exports all security rule Options types with consistent naming.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import type { NoSqlInjectionOptions } from 'eslint-plugin-secure-coding/types';
|
|
10
|
+
*
|
|
11
|
+
* const config: NoSqlInjectionOptions = {
|
|
12
|
+
* allowDynamicTableNames: false,
|
|
13
|
+
* strategy: 'parameterize',
|
|
14
|
+
* };
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/eslint-plugin-secure-coding/src/types/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|