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,341 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noExposedSensitiveData = void 0;
|
|
4
|
+
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
+
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
6
|
+
/**
|
|
7
|
+
* Default sensitive data patterns
|
|
8
|
+
*/
|
|
9
|
+
const DEFAULT_SENSITIVE_PATTERNS = [
|
|
10
|
+
'ssn',
|
|
11
|
+
'social',
|
|
12
|
+
'credit',
|
|
13
|
+
'card',
|
|
14
|
+
'password',
|
|
15
|
+
'secret',
|
|
16
|
+
'token',
|
|
17
|
+
'apiKey',
|
|
18
|
+
'apikey',
|
|
19
|
+
'api_key',
|
|
20
|
+
'privateKey',
|
|
21
|
+
'private_key',
|
|
22
|
+
'accessToken',
|
|
23
|
+
'access_token',
|
|
24
|
+
'refreshToken',
|
|
25
|
+
'refresh_token',
|
|
26
|
+
'authToken',
|
|
27
|
+
'auth_token',
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* Default logging/output patterns
|
|
31
|
+
*/
|
|
32
|
+
const DEFAULT_LOGGING_PATTERNS = [
|
|
33
|
+
'log',
|
|
34
|
+
'console',
|
|
35
|
+
'print',
|
|
36
|
+
'debug',
|
|
37
|
+
'error',
|
|
38
|
+
'warn',
|
|
39
|
+
'info',
|
|
40
|
+
'trace',
|
|
41
|
+
'response',
|
|
42
|
+
'res.',
|
|
43
|
+
'req.',
|
|
44
|
+
];
|
|
45
|
+
/**
|
|
46
|
+
* Sensitive data regex patterns
|
|
47
|
+
*/
|
|
48
|
+
const SENSITIVE_DATA_PATTERNS = {
|
|
49
|
+
// SSN pattern (XXX-XX-XXXX)
|
|
50
|
+
ssn: /\b\d{3}-\d{2}-\d{4}\b/,
|
|
51
|
+
// Credit card pattern (basic - 13-19 digits, may have spaces/dashes)
|
|
52
|
+
creditCard: /\b(?:\d{4}[-\s]?){3}\d{1,4}\b/,
|
|
53
|
+
// Email with sensitive context
|
|
54
|
+
sensitiveEmail: /\b(?:password|secret|token|key|credential)[\w.-]*@[\w.-]+\.\w+\b/i,
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Check if a string contains sensitive data patterns
|
|
58
|
+
*/
|
|
59
|
+
function containsSensitiveData(value, sensitivePatterns) {
|
|
60
|
+
// Check for SSN pattern
|
|
61
|
+
if (SENSITIVE_DATA_PATTERNS.ssn.test(value)) {
|
|
62
|
+
return { isSensitive: true, type: 'SSN pattern detected' };
|
|
63
|
+
}
|
|
64
|
+
// Check for credit card pattern
|
|
65
|
+
if (SENSITIVE_DATA_PATTERNS.creditCard.test(value)) {
|
|
66
|
+
return { isSensitive: true, type: 'Credit card pattern detected' };
|
|
67
|
+
}
|
|
68
|
+
// Check for sensitive keywords in variable names or values
|
|
69
|
+
const lowerValue = value.toLowerCase();
|
|
70
|
+
for (const pattern of sensitivePatterns) {
|
|
71
|
+
if (lowerValue.includes(pattern.toLowerCase())) {
|
|
72
|
+
// Check if it's in a sensitive context (not just a comment or documentation)
|
|
73
|
+
if (/\b(?:log|console|print|debug|error|warn|info|trace|response|res\.|req\.|body|query|params)\b/i.test(value) ||
|
|
74
|
+
/\b(?:password|secret|token|key|credential)\s*[:=]/i.test(value)) {
|
|
75
|
+
return { isSensitive: true, type: `Sensitive data keyword: ${pattern}` };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return { isSensitive: false, type: '' };
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if a string matches any ignore pattern
|
|
83
|
+
*/
|
|
84
|
+
function matchesIgnorePattern(text, patterns) {
|
|
85
|
+
return patterns.some(pattern => {
|
|
86
|
+
try {
|
|
87
|
+
const regex = new RegExp(pattern, 'i');
|
|
88
|
+
return regex.test(text);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Check if a node is in a logging or output context
|
|
97
|
+
*/
|
|
98
|
+
function isInLoggingContext(node, sourceCode, loggingPatterns) {
|
|
99
|
+
// Build regex pattern from logging patterns
|
|
100
|
+
const patternRegex = new RegExp(`\\b(?:${loggingPatterns.map(p => p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})\\b`, 'i');
|
|
101
|
+
let current = node;
|
|
102
|
+
// Check parent chain for logging calls
|
|
103
|
+
while (current && 'parent' in current && current.parent) {
|
|
104
|
+
current = current.parent;
|
|
105
|
+
if (current.type === 'CallExpression') {
|
|
106
|
+
const callExpr = current;
|
|
107
|
+
const callText = sourceCode.getText(current);
|
|
108
|
+
// Check if it's a logging method call
|
|
109
|
+
if (callExpr.callee.type === 'MemberExpression') {
|
|
110
|
+
const memberExpr = callExpr.callee;
|
|
111
|
+
if (memberExpr.object.type === 'Identifier' && memberExpr.property.type === 'Identifier') {
|
|
112
|
+
const objName = memberExpr.object.name.toLowerCase();
|
|
113
|
+
const propName = memberExpr.property.name.toLowerCase();
|
|
114
|
+
// Check against logging patterns
|
|
115
|
+
if (loggingPatterns.some(p => objName.includes(p.toLowerCase()) || propName.includes(p.toLowerCase()))) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Also check for patterns in the call text
|
|
121
|
+
if (patternRegex.test(callText)) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Check if it's in an object expression that's being logged
|
|
126
|
+
if (current.type === 'ObjectExpression') {
|
|
127
|
+
// Check if parent is a CallExpression with logging
|
|
128
|
+
if (current.parent && current.parent.type === 'CallExpression') {
|
|
129
|
+
const parentCall = current.parent;
|
|
130
|
+
const callText = sourceCode.getText(parentCall);
|
|
131
|
+
if (patternRegex.test(callText)) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
exports.noExposedSensitiveData = (0, eslint_devkit_2.createRule)({
|
|
140
|
+
name: 'no-exposed-sensitive-data',
|
|
141
|
+
meta: {
|
|
142
|
+
type: 'problem',
|
|
143
|
+
docs: {
|
|
144
|
+
description: 'Detects exposure of PII/sensitive data (SSN, credit card numbers in logs, etc.)',
|
|
145
|
+
},
|
|
146
|
+
hasSuggestions: true,
|
|
147
|
+
messages: {
|
|
148
|
+
exposedSensitiveData: (0, eslint_devkit_1.formatLLMMessage)({
|
|
149
|
+
icon: eslint_devkit_1.MessageIcons.SECURITY,
|
|
150
|
+
issueName: 'Exposed Sensitive Data',
|
|
151
|
+
cwe: 'CWE-200',
|
|
152
|
+
description: 'Sensitive data exposure detected: {{issue}}',
|
|
153
|
+
severity: 'CRITICAL',
|
|
154
|
+
fix: '{{safeAlternative}}',
|
|
155
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/200.html',
|
|
156
|
+
}),
|
|
157
|
+
sanitizeData: (0, eslint_devkit_1.formatLLMMessage)({
|
|
158
|
+
icon: eslint_devkit_1.MessageIcons.INFO,
|
|
159
|
+
issueName: 'Sanitize Data',
|
|
160
|
+
description: 'Remove or mask sensitive information',
|
|
161
|
+
severity: 'LOW',
|
|
162
|
+
fix: 'Mask or remove sensitive data before logging/transmitting',
|
|
163
|
+
documentationLink: 'https://cwe.mitre.org/data/definitions/200.html',
|
|
164
|
+
}),
|
|
165
|
+
},
|
|
166
|
+
schema: [
|
|
167
|
+
{
|
|
168
|
+
type: 'object',
|
|
169
|
+
properties: {
|
|
170
|
+
allowInTests: {
|
|
171
|
+
type: 'boolean',
|
|
172
|
+
default: false,
|
|
173
|
+
description: 'Allow sensitive data in test files',
|
|
174
|
+
},
|
|
175
|
+
sensitivePatterns: {
|
|
176
|
+
type: 'array',
|
|
177
|
+
items: { type: 'string' },
|
|
178
|
+
default: [],
|
|
179
|
+
description: 'Patterns to detect sensitive data',
|
|
180
|
+
},
|
|
181
|
+
loggingPatterns: {
|
|
182
|
+
type: 'array',
|
|
183
|
+
items: { type: 'string' },
|
|
184
|
+
default: [],
|
|
185
|
+
description: 'Logging/output patterns to detect',
|
|
186
|
+
},
|
|
187
|
+
ignorePatterns: {
|
|
188
|
+
type: 'array',
|
|
189
|
+
items: { type: 'string' },
|
|
190
|
+
default: [],
|
|
191
|
+
description: 'Additional safe patterns to ignore',
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
additionalProperties: false,
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
defaultOptions: [
|
|
199
|
+
{
|
|
200
|
+
allowInTests: false,
|
|
201
|
+
sensitivePatterns: [],
|
|
202
|
+
loggingPatterns: [],
|
|
203
|
+
ignorePatterns: [],
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
create(context, [options = {}]) {
|
|
207
|
+
const { allowInTests = false, sensitivePatterns, loggingPatterns, ignorePatterns = [], } = options;
|
|
208
|
+
const patternsToCheck = sensitivePatterns && sensitivePatterns.length > 0
|
|
209
|
+
? sensitivePatterns
|
|
210
|
+
: DEFAULT_SENSITIVE_PATTERNS;
|
|
211
|
+
const loggingPatternsToCheck = loggingPatterns && loggingPatterns.length > 0
|
|
212
|
+
? loggingPatterns
|
|
213
|
+
: DEFAULT_LOGGING_PATTERNS;
|
|
214
|
+
const filename = context.getFilename();
|
|
215
|
+
const isTestFile = allowInTests && /\.(test|spec)\.(ts|tsx|js|jsx)$/.test(filename);
|
|
216
|
+
const sourceCode = context.sourceCode || context.sourceCode;
|
|
217
|
+
function checkLiteral(node) {
|
|
218
|
+
if (isTestFile) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (typeof node.value !== 'string') {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const value = node.value;
|
|
225
|
+
const text = sourceCode.getText(node);
|
|
226
|
+
// Check if it matches any ignore pattern
|
|
227
|
+
if (matchesIgnorePattern(text, ignorePatterns)) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
// Only check if in logging/output context
|
|
231
|
+
if (!isInLoggingContext(node, sourceCode, loggingPatternsToCheck)) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const { isSensitive, type } = containsSensitiveData(value, patternsToCheck);
|
|
235
|
+
if (isSensitive) {
|
|
236
|
+
// For SSN and credit card patterns, don't provide auto-fix suggestions
|
|
237
|
+
// as they require manual review
|
|
238
|
+
const isPatternMatch = type.includes('pattern detected');
|
|
239
|
+
context.report({
|
|
240
|
+
node,
|
|
241
|
+
messageId: 'exposedSensitiveData',
|
|
242
|
+
data: {
|
|
243
|
+
issue: `${type} in logging/output context`,
|
|
244
|
+
safeAlternative: 'Remove or mask sensitive data before logging: logger.info({ userId: user.id }) instead of logger.info({ password: user.password })',
|
|
245
|
+
},
|
|
246
|
+
...(isPatternMatch ? {} : {
|
|
247
|
+
suggest: [
|
|
248
|
+
{
|
|
249
|
+
messageId: 'sanitizeData',
|
|
250
|
+
fix(fixer) {
|
|
251
|
+
// Suggest removing or masking the sensitive data
|
|
252
|
+
return fixer.replaceText(node, '"***REDACTED***"');
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
}),
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function checkIdentifier(node) {
|
|
261
|
+
if (isTestFile) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const name = node.name;
|
|
265
|
+
const text = sourceCode.getText(node);
|
|
266
|
+
// Check if it matches any ignore pattern
|
|
267
|
+
if (matchesIgnorePattern(text, ignorePatterns)) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
// Only check if in logging/output context
|
|
271
|
+
if (!isInLoggingContext(node, sourceCode, loggingPatternsToCheck)) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
// Check if identifier name contains sensitive patterns
|
|
275
|
+
const lowerName = name.toLowerCase();
|
|
276
|
+
for (const pattern of patternsToCheck) {
|
|
277
|
+
if (lowerName.includes(pattern.toLowerCase())) {
|
|
278
|
+
// Check if it's being accessed in a sensitive way
|
|
279
|
+
if (node.parent) {
|
|
280
|
+
const parentText = sourceCode.getText(node.parent);
|
|
281
|
+
// Build regex pattern from logging patterns
|
|
282
|
+
const loggingPatternRegex = new RegExp(`\\b(?:${loggingPatternsToCheck.map(p => p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})\\b`, 'i');
|
|
283
|
+
if (loggingPatternRegex.test(parentText)) {
|
|
284
|
+
// Get the actual property name from context
|
|
285
|
+
const actualPropertyName = name;
|
|
286
|
+
context.report({
|
|
287
|
+
node,
|
|
288
|
+
messageId: 'exposedSensitiveData',
|
|
289
|
+
data: {
|
|
290
|
+
issue: `Sensitive variable "${name}" exposed in logging/output`,
|
|
291
|
+
safeAlternative: `Remove or mask sensitive data: logger.info({ userId: user.id }) instead of logger.info({ ${actualPropertyName}: user.${actualPropertyName} })`,
|
|
292
|
+
},
|
|
293
|
+
// Don't provide auto-fix suggestions for identifiers (too risky)
|
|
294
|
+
});
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function checkMemberExpression(node) {
|
|
302
|
+
if (isTestFile) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const text = sourceCode.getText(node);
|
|
306
|
+
// Check if it matches any ignore pattern
|
|
307
|
+
if (matchesIgnorePattern(text, ignorePatterns)) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
// Only check if in logging/output context
|
|
311
|
+
if (!isInLoggingContext(node, sourceCode, loggingPatternsToCheck)) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
// Check if property name contains sensitive patterns
|
|
315
|
+
if (node.property.type === 'Identifier') {
|
|
316
|
+
const propertyName = node.property.name.toLowerCase();
|
|
317
|
+
for (const pattern of patternsToCheck) {
|
|
318
|
+
if (propertyName.includes(pattern.toLowerCase())) {
|
|
319
|
+
const objectName = node.object.type === 'Identifier' ? node.object.name : 'object';
|
|
320
|
+
context.report({
|
|
321
|
+
node,
|
|
322
|
+
messageId: 'exposedSensitiveData',
|
|
323
|
+
data: {
|
|
324
|
+
issue: `Sensitive property "${node.property.name}" exposed in logging/output`,
|
|
325
|
+
safeAlternative: `Remove or mask sensitive data: logger.info({ userId: user.id }) instead of logger.info({ ${node.property.name}: ${objectName}.${node.property.name} })`,
|
|
326
|
+
},
|
|
327
|
+
// Don't provide auto-fix suggestions for property access (too risky)
|
|
328
|
+
});
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
Literal: checkLiteral,
|
|
336
|
+
Identifier: checkIdentifier,
|
|
337
|
+
MemberExpression: checkMemberExpression,
|
|
338
|
+
};
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
//# sourceMappingURL=no-exposed-sensitive-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-exposed-sensitive-data.js","sourceRoot":"","sources":["../../../../../../packages/eslint-plugin-secure-coding/src/rules/security/no-exposed-sensitive-data.ts"],"names":[],"mappings":";;;AASA,4DAA0E;AAC1E,4DAAsD;AAoBtD;;GAEG;AACH,MAAM,0BAA0B,GAAG;IACjC,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,aAAa;IACb,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;IACf,WAAW;IACX,YAAY;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,wBAAwB,GAAG;IAC/B,KAAK;IACL,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,UAAU;IACV,MAAM;IACN,MAAM;CACP,CAAC;AAEF;;GAEG;AACH,MAAM,uBAAuB,GAAG;IAC9B,4BAA4B;IAC5B,GAAG,EAAE,uBAAuB;IAE5B,qEAAqE;IACrE,UAAU,EAAE,+BAA+B;IAE3C,+BAA+B;IAC/B,cAAc,EAAE,mEAAmE;CACpF,CAAC;AAEF;;GAEG;AACH,SAAS,qBAAqB,CAC5B,KAAa,EACb,iBAA2B;IAE3B,wBAAwB;IACxB,IAAI,uBAAuB,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC;IAC7D,CAAC;IAED,gCAAgC;IAChC,IAAI,uBAAuB,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACnD,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,8BAA8B,EAAE,CAAC;IACrE,CAAC;IAED,2DAA2D;IAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IACvC,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAA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ACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE,YAAY;YACrB,UAAU,EAAE,eAAe;YAC3B,gBAAgB,EAAE,qBAAqB;SACxC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Options {
|
|
2
|
+
/** Functions that use format strings */
|
|
3
|
+
formatFunctions?: string[];
|
|
4
|
+
/** Format specifiers to detect */
|
|
5
|
+
formatSpecifiers?: string[];
|
|
6
|
+
/** Variables that contain user input */
|
|
7
|
+
userInputVariables?: string[];
|
|
8
|
+
/** Safe formatting libraries */
|
|
9
|
+
safeFormatLibraries?: string[];
|
|
10
|
+
/** Additional function names to consider as sanitizers */
|
|
11
|
+
trustedSanitizers?: string[];
|
|
12
|
+
/** Additional JSDoc annotations to consider as safe markers */
|
|
13
|
+
trustedAnnotations?: string[];
|
|
14
|
+
/** Disable all false positive detection (strict mode) */
|
|
15
|
+
strictMode?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const noFormatStringInjection: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|