eslint-plugin-lambda-security 1.2.5 → 1.2.6

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [1.2.3] - 2026-02-08
2
2
 
3
+ ## 1.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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).
8
+
3
9
  ## 1.2.5
4
10
 
5
11
  ### 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/tree/main" target="_blank"><img src="https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?flag=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.5",
3
+ "version": "1.2.6",
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
@@ -53,7 +53,7 @@ exports.rules = {
53
53
  exports.plugin = {
54
54
  meta: {
55
55
  name: 'eslint-plugin-lambda-security',
56
- version: '1.2.5',
56
+ version: '1.2.6',
57
57
  },
58
58
  rules: exports.rules,
59
59
  };
@@ -144,23 +144,10 @@ exports.noUnvalidatedEventBody = (0, eslint_devkit_1.createRule)({
144
144
  }
145
145
  return null;
146
146
  }
147
- /**
148
- * Check if JSON.parse is being called on event property
149
- */
150
- function isJsonParseOfEventBody(node) {
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
- if (first.type === eslint_devkit_1.AST_NODE_TYPES.Identifier) {
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'