eslint-plugin-lambda-security 1.2.5 → 1.2.7
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/rules/no-unvalidated-event-body/index.js +7 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
## [1.2.3] - 2026-02-08
|
|
2
2
|
|
|
3
|
+
## 1.2.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#252](https://github.com/ofri-peretz/eslint/pull/252) [`d67e395`](https://github.com/ofri-peretz/eslint/commit/d67e3953c2748ad36e6aebe0f24b1d04e518b4d0) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Fix Codecov badge showing "unknown" — switch from flag to component URL format
|
|
8
|
+
|
|
9
|
+
## 1.2.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#225](https://github.com/ofri-peretz/eslint/pull/225) [`34ff5a8`](https://github.com/ofri-peretz/eslint/commit/34ff5a8e6f5126c5d1c0a524759e0af2b5476b46) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - CI-only: pin all coverage thresholds at 100% (integration target, merges last).
|
|
14
|
+
|
|
3
15
|
## 1.2.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<a href="https://www.npmjs.com/package/eslint-plugin-lambda-security" target="_blank"><img src="https://img.shields.io/npm/v/eslint-plugin-lambda-security.svg" alt="NPM Version" /></a>
|
|
11
11
|
<a href="https://www.npmjs.com/package/eslint-plugin-lambda-security" target="_blank"><img src="https://img.shields.io/npm/dm/eslint-plugin-lambda-security.svg" alt="NPM Downloads" /></a>
|
|
12
12
|
<a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="Package License" /></a>
|
|
13
|
-
<a href="https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=lambda-security" target="_blank"><img src="https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?component=lambda-security" alt="Codecov" /></a>
|
|
13
|
+
<a href="https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=eslint-plugin-lambda-security" target="_blank"><img src="https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?component=eslint-plugin-lambda-security" alt="Codecov" /></a>
|
|
14
14
|
<a href="https://github.com/ofri-peretz/eslint" target="_blank"><img src="https://img.shields.io/badge/Since-Dec_2025-blue?logo=rocket&logoColor=white" alt="Since Dec 2025" /></a>
|
|
15
15
|
</p>
|
|
16
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-lambda-security",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "Security-focused ESLint plugin for AWS Lambda and Middy applications. Detects insecure API Gateway responses, missing security headers, CORS misconfigurations, input validation issues, and more.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/index.js
CHANGED
|
@@ -144,23 +144,10 @@ exports.noUnvalidatedEventBody = (0, eslint_devkit_1.createRule)({
|
|
|
144
144
|
}
|
|
145
145
|
return null;
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (node.callee.type === eslint_devkit_1.AST_NODE_TYPES.MemberExpression &&
|
|
152
|
-
node.callee.object.type === eslint_devkit_1.AST_NODE_TYPES.Identifier &&
|
|
153
|
-
node.callee.object.name === 'JSON' &&
|
|
154
|
-
node.callee.property.type === eslint_devkit_1.AST_NODE_TYPES.Identifier &&
|
|
155
|
-
node.callee.property.name === 'parse' &&
|
|
156
|
-
node.arguments.length > 0) {
|
|
157
|
-
const arg = node.arguments[0];
|
|
158
|
-
if (arg.type === eslint_devkit_1.AST_NODE_TYPES.MemberExpression) {
|
|
159
|
-
return isEventPropertyAccess(arg) !== null;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
147
|
+
// NOTE: a dedicated `isJsonParseOfEventBody(parent)` check used to live
|
|
148
|
+
// here, but it was dead code: `JSON.parse(...)` always satisfies
|
|
149
|
+
// `isValidationCall` first ('parse' is in VALIDATION_INDICATORS), so the
|
|
150
|
+
// early return above it made it unreachable for every possible AST.
|
|
164
151
|
// Determine whether THIS file looks like Lambda code at all. We're
|
|
165
152
|
// strict: a function parameter is only treated as a Lambda event if
|
|
166
153
|
// (a) it's named `event` AND its sibling is `context` (the AWS
|
|
@@ -258,10 +245,10 @@ exports.noUnvalidatedEventBody = (0, eslint_devkit_1.createRule)({
|
|
|
258
245
|
'ArrowFunctionExpression, FunctionExpression, FunctionDeclaration'(node) {
|
|
259
246
|
if (!isLambdaSignature(node.params, node))
|
|
260
247
|
return;
|
|
248
|
+
// isLambdaSignature already guarantees params[0] is an Identifier
|
|
249
|
+
// (it returns false otherwise), so a type-narrowing cast is safe here.
|
|
261
250
|
const first = node.params[0];
|
|
262
|
-
|
|
263
|
-
eventParameters.add(first.name);
|
|
264
|
-
}
|
|
251
|
+
eventParameters.add(first.name);
|
|
265
252
|
},
|
|
266
253
|
// Check for Middy with validation middleware
|
|
267
254
|
CallExpression(node) {
|
|
@@ -303,13 +290,6 @@ exports.noUnvalidatedEventBody = (0, eslint_devkit_1.createRule)({
|
|
|
303
290
|
isValidationCall(parent)) {
|
|
304
291
|
return;
|
|
305
292
|
}
|
|
306
|
-
// Case: const body = JSON.parse(event.body); schema.parse(body); - track this
|
|
307
|
-
if (parent?.type === eslint_devkit_1.AST_NODE_TYPES.CallExpression &&
|
|
308
|
-
isJsonParseOfEventBody(parent)) {
|
|
309
|
-
// We need to check if this variable is later validated
|
|
310
|
-
// For now, flag it as potentially dangerous
|
|
311
|
-
// A more sophisticated analysis would track variable flow
|
|
312
|
-
}
|
|
313
293
|
// Case: Direct use without validation - DANGER
|
|
314
294
|
// Check common safe patterns
|
|
315
295
|
// Safe: typeof event.body === 'string'
|