eslint-plugin-secure-coding 3.4.1 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/rules/no-insecure-comparison/index.js +6 -4
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding" target="blank"><img src="https://eslint.interlace.tools/
|
|
2
|
+
<a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-secure-coding" target="blank"><img src="https://eslint.interlace.tools/logos/interlace.svg" alt="Interlace" height="90" /></a>
|
|
3
3
|
|
|
4
|
-
<a href="https://
|
|
4
|
+
<a href="https://oxc.rs" target="_blank"><img src="https://eslint.interlace.tools/logos/oxlint.svg" alt="oxlint" height="90" /></a>
|
|
5
|
+
|
|
6
|
+
<a href="https://eslint.org" target="_blank"><img src="https://eslint.interlace.tools/logos/eslint.svg" alt="ESLint" height="90" /></a>
|
|
5
7
|
</p>
|
|
6
8
|
|
|
7
9
|
<p align="center">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-secure-coding",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"description": "ESLint plugin for secure coding — detects LDAP, XPath, XXE, GraphQL and template injection, unsafe deserialization, ReDoS, missing authentication, and PII in logs.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/index.js
CHANGED
|
@@ -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',
|