eslint-plugin-lambda-security 1.2.4 → 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,52 @@
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
+
9
+ ## 1.2.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [#220](https://github.com/ofri-peretz/eslint/pull/220) [`ad8416d`](https://github.com/ofri-peretz/eslint/commit/ad8416d4db196bf0b24942ddabbfaefb0cae7bab) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Fix runtime crashes when linting realistic AWS Lambda handlers under ESLint 9.
14
+
15
+ The published `1.2.3` tarball was a **stale build**: its rules still threw on the
16
+ generated lambda-ai-corpus handlers, even though source had already been fixed.
17
+ This republishes the corrected build and locks it with a regression test.
18
+ - **`no-error-swallowing`** no longer throws `RangeError: Maximum call stack size
19
+ exceeded`. The old build walked the catch-block AST by hand and recursed through
20
+ the cyclic `node.parent` reference; source now uses `sourceCode.getText()` + a
21
+ regex.
22
+ - **`require-timeout-handling`**, **`no-missing-authorization-check`**, and
23
+ **`no-unbounded-batch-processing`** no longer throw `Error: Unknown class name:
24
+ exit`. They used a grouped `:exit` selector (`'A:exit, B:exit, C:exit'`); ESLint
25
+ only strips the trailing `:exit`, so esquery received a bare `:exit`. Source now
26
+ uses one listener key per node type.
27
+ - `plugin.meta.version` is now read from `package.json` instead of a hardcoded
28
+ string, so a build can no longer mislabel its own version (1.2.3 embedded
29
+ `1.1.0`).
30
+
31
+ - [#213](https://github.com/ofri-peretz/eslint/pull/213) [`391dbe6`](https://github.com/ofri-peretz/eslint/commit/391dbe6b39f78d549379218567cb959649f8c614) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Align every security rule's `meta.docs.cvss` to the CVSS its finding actually
32
+ emits. The emitted machine-readable message sources its `CVSS:x` from
33
+ `CWE_MAPPING` via `formatLLMMessage` → `enrichFromCWE`, but the static
34
+ `meta.docs.cvss` documentation field had drifted on 45 rules across these 7
35
+ plugins — e.g. `no-hardcoded-credentials` documented `9.5` while emitting
36
+ `CVSS:9.8` (the value the published article and SARIF/LLM consumers already
37
+ read).
38
+
39
+ This corrects the **documentation metadata only** — no emitted finding changes.
40
+ Locked by `security-cvss-docs-consistency.lock.test.ts` (cross-plugin: every
41
+ security rule's `meta.docs.cvss` must equal the CVSS it emits), the
42
+ `no-hardcoded-credentials` rule lock (real ESLint `Linter` emission), and a
43
+ devkit `enrichFromCWE` contract test pinning `CWE-798 → 9.8`.
44
+
45
+ Follow-up (not in scope): 50 security rules document a CVSS that never appears
46
+ in any emitted message (their messages carry no CWE), and several rules emit the
47
+ generic CWE score where a rule-specific score may be warranted — both change
48
+ emitted output and are separate decisions.
49
+
3
50
  ## 1.2.4
4
51
 
5
52
  ### 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.4",
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.4',
56
+ version: '1.2.6',
57
57
  },
58
58
  rules: exports.rules,
59
59
  };
@@ -17,7 +17,7 @@ exports.noEnvLogging = (0, eslint_devkit_1.createRule)({
17
17
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-lambda-security/docs/rules/no-env-logging.md',
18
18
  description: 'Detects logging of process.env which may expose secrets',
19
19
  cwe: 'CWE-532',
20
- cvss: 7.5,
20
+ cvss: 5.3,
21
21
  },
22
22
  hasSuggestions: true,
23
23
  messages: {
@@ -52,7 +52,7 @@ exports.noHardcodedCredentialsSdk = (0, eslint_devkit_1.createRule)({
52
52
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-lambda-security/docs/rules/no-hardcoded-credentials-sdk.md',
53
53
  description: 'Detects hardcoded AWS credentials in SDK client configurations',
54
54
  cwe: 'CWE-798',
55
- cvss: 9.5,
55
+ cvss: 9.8,
56
56
  },
57
57
  hasSuggestions: true,
58
58
  messages: {
@@ -32,7 +32,7 @@ exports.noSecretsInEnv = (0, eslint_devkit_1.createRule)({
32
32
  url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-lambda-security/docs/rules/no-secrets-in-env.md',
33
33
  description: 'Detects secrets directly assigned to environment variables',
34
34
  cwe: 'CWE-798',
35
- cvss: 9.5,
35
+ cvss: 9.8,
36
36
  },
37
37
  hasSuggestions: true,
38
38
  messages: {
@@ -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'