eslint-plugin-lambda-security 1.2.2 → 1.2.4

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 ADDED
@@ -0,0 +1,106 @@
1
+ # AGENTS.md
2
+
3
+ > Context for AI coding agents working on eslint-plugin-lambda-security
4
+
5
+ ## Setup Commands
6
+
7
+ ```bash
8
+ # Install dependencies (from monorepo root)
9
+ npm install
10
+
11
+ # Build this package
12
+ nx build eslint-plugin-lambda-security
13
+
14
+ # Run tests
15
+ nx test eslint-plugin-lambda-security
16
+
17
+ # Run tests with coverage
18
+ nx test eslint-plugin-lambda-security --coverage
19
+
20
+ # Lint this package
21
+ nx lint eslint-plugin-lambda-security
22
+ ```
23
+
24
+ ## Code Style
25
+
26
+ - TypeScript strict mode with `@interlace/eslint-devkit` types
27
+ - Use `AST_NODE_TYPES` constants, never string literals for node types
28
+ - Use `formatLLMMessage()` for all rule error messages
29
+ - Include CWE, CVSS, OWASP Serverless Top 10 in every security message
30
+ - Use `c8 ignore` comments with documented reasons for untestable code
31
+ - Single-pass AST traversal patterns (O(n) complexity)
32
+
33
+ ## Testing Instructions
34
+
35
+ - Tests use `@typescript-eslint/rule-tester` with Vitest
36
+ - Each rule has `index.ts` (implementation) and `*.test.ts` (tests) in same directory
37
+ - Run specific rule test: `nx test eslint-plugin-lambda-security --testPathPattern="no-hardcoded-credentials"`
38
+ - Coverage target: ≥90% lines, ≥95% functions
39
+ - All tests must pass before committing
40
+
41
+ ## Project Structure
42
+
43
+ ```
44
+ src/
45
+ ├── index.ts # Plugin entry, exports rules and 2 configs
46
+ ├── types/index.ts # Exported rule option types
47
+ └── rules/ # 5 rule directories
48
+ └── [rule-name]/
49
+ ├── index.ts # Rule implementation
50
+ └── *.test.ts # Rule tests
51
+ docs/rules/ # Markdown documentation per rule
52
+ ```
53
+
54
+ ## Plugin Purpose
55
+
56
+ Security-focused ESLint plugin with **5 rules** for AWS Lambda, Middy, and serverless applications. Covers hardcoded credentials, secrets exposure, environment logging, and CORS misconfigurations.
57
+
58
+ ## Rule Categories
59
+
60
+ | Category | Rules | CWEs |
61
+ | --------------------- | --------------------------------------------------------------------- | -------- |
62
+ | Credentials & Secrets | `no-hardcoded-credentials-sdk`, `no-secrets-in-env`, `no-env-logging` | 532, 798 |
63
+ | CORS | `no-permissive-cors-response`, `no-permissive-cors-middy` | 942 |
64
+
65
+ ## AWS SDK Clients Detected
66
+
67
+ S3Client, DynamoDBClient, LambdaClient, STSClient, SecretsManagerClient, SQSClient, SNSClient, EC2Client, ECSClient, CloudWatchClient, CloudWatchLogsClient, APIGatewayClient, CognitoIdentityClient, CognitoIdentityProviderClient, EventBridgeClient, StepFunctionsClient, RDSClient, ElastiCacheClient
68
+
69
+ ## AWS Access Key Patterns
70
+
71
+ | Pattern | Type |
72
+ | ------- | ------------------------ |
73
+ | `AKIA*` | IAM user access key |
74
+ | `ASIA*` | STS temporary access key |
75
+ | `AIDA*` | IAM user ID |
76
+
77
+ ## Common Fix Patterns
78
+
79
+ ```typescript
80
+ // Hardcoded credentials
81
+ // BAD: new S3Client({ credentials: { accessKeyId: 'AKIA...', secretAccessKey: '...' } })
82
+ // GOOD: new S3Client({ region: 'us-east-1' }) // Uses Lambda execution role
83
+ // GOOD: new S3Client({ credentials: fromNodeProviderChain() })
84
+
85
+ // Secrets in env
86
+ // BAD: process.env.DB_PASSWORD = 'my-secret'
87
+ // GOOD: const secret = await client.send(new GetSecretValueCommand({ SecretId: 'my-secret' }))
88
+
89
+ // Logging env
90
+ // BAD: console.log(process.env)
91
+ // GOOD: console.log('Region:', process.env.AWS_REGION)
92
+
93
+ // Lambda CORS
94
+ // BAD: return { headers: { 'Access-Control-Allow-Origin': '*' }, ... }
95
+ // GOOD: return { headers: { 'Access-Control-Allow-Origin': 'https://your-app.com' }, ... }
96
+
97
+ // Middy CORS
98
+ // BAD: middy(handler).use(httpCors())
99
+ // GOOD: middy(handler).use(httpCors({ origins: ['https://your-app.com'] }))
100
+ ```
101
+
102
+ ## Security Considerations
103
+
104
+ - All rules map to OWASP Serverless Top 10: SAS-2, SAS-3, SAS-4
105
+ - CWE coverage: 532, 798, 942
106
+ - Real AWS key pattern detection (not just string length checks)
package/CHANGELOG.md ADDED
@@ -0,0 +1,122 @@
1
+ ## [1.2.3] - 2026-02-08
2
+
3
+ ## 1.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#144](https://github.com/ofri-peretz/eslint/pull/144) [`8843ce7`](https://github.com/ofri-peretz/eslint/commit/8843ce7fbb465caad161b97032467b3a37a49319) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - fix: ILB-Wild FP reduction + doc examples + doc-test-alignment scanner fixes
8
+
9
+ **`no-unlimited-resource-allocation` — FP reduction (430 Edge FPs)**
10
+ - Skip loop-allocation reporting when the first argument is a numeric literal (e.g. `Buffer.alloc(1024)` inside a loop is statically bounded, not a risk)
11
+ - Skip `Array.isArray`, `Array.from`, `Array.of` calls in the `alloc/Array` pattern check (these don't allocate unbounded memory)
12
+
13
+ **`no-hardcoded-credentials` — FP reduction (~280 Edge FPs)**
14
+ - Extended test-file skip to cover `.fixture.`, `.mock.`, `__mocks__/`, `/tests/`, `/fixtures/`, `/mocks/` paths
15
+ - Skip string literals that are fallback values in `process.env.X || 'fallback'` expressions — the secret lives in the environment, the string is only a dev-mode default
16
+
17
+ **Doc examples — 4 rules now have ❌ Incorrect examples**
18
+ - `lambda-security/no-missing-authorization-check`
19
+ - `lambda-security/no-overly-permissive-iam-policy`
20
+ - `node-security/prefer-native-crypto` (renamed non-standard `### ❌ Third-Party (Flagged)` to `### ❌ Incorrect`)
21
+ - `vercel-ai-security/require-tool-confirmation` (replaced placeholder with a real tested example)
22
+
23
+ **`ilb-doc-test-alignment` scanner fixes**
24
+ - Accept both `## ❌` and `### ❌` headings (docs use H3 under an H2 `## Examples` section; was only finding H2)
25
+ - Slice from end-of-line rather than end-of-regex-match (prevents `## ❌ Incorrect Code` from leaving a partial heading in the parsed section)
26
+
27
+ Result: `ilb:doc-test-alignment` → 206 ok, 0 doc has no ❌ examples (was 165 missing).
28
+
29
+ - [#194](https://github.com/ofri-peretz/eslint/pull/194) [`55d5c0a`](https://github.com/ofri-peretz/eslint/commit/55d5c0ab90bfaaecf01be5146a91a2e4b14e1d41) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Fix a hard crash (`Error: Unknown class name: exit`) that aborted the entire ESLint run on ESLint 9 whenever the `recommended` or `strict` config was enabled.
30
+
31
+ Three rules — `require-timeout-handling`, `no-missing-authorization-check`, and `no-unbounded-batch-processing` — registered their function-exit listener as a single comma-joined selector key:
32
+
33
+ ```
34
+ 'ArrowFunctionExpression:exit, FunctionExpression:exit, FunctionDeclaration:exit'
35
+ ```
36
+
37
+ ESLint only strips a **trailing** `:exit` before handing a selector to esquery, so the earlier `:exit` tokens survived into the parser and threw `Unknown class name: exit` for every linted file. Each listener is now registered as one key per node type, which is the only esquery-safe form.
38
+
39
+ A config-level regression test (`src/index.test.ts`) now boots the real ESLint engine against both shipped configs, so any future comma-joined `:exit` — or any other unparseable selector in any rule — fails in CI instead of in a consumer's editor.
40
+
41
+ `@interlace/eslint-config` re-exports the `recommended` config and is republished against the fixed plugin.
42
+
43
+ - [#143](https://github.com/ofri-peretz/eslint/pull/143) [`213cde1`](https://github.com/ofri-peretz/eslint/commit/213cde190ff2aea49ca7c1b533170940f879d9b4) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - fix(no-missing-null-checks): eliminate 53 false positives via three new narrowing patterns
44
+
45
+ Rules that were recognized as null guards are now correctly identified as safe:
46
+ 1. **Truthy if guard** — `if (obj) { obj.prop }` — direct truthy check proves non-null. Also covers chains: `if (response)` protects `response.data.items`.
47
+ 2. **Short-circuit AND** — `obj && obj.prop` — right side of `&&` only runs when left is truthy.
48
+ 3. **Ternary consequent** — `obj ? obj.prop : fallback` — truthy test guards the consequent.
49
+
50
+ Also: bumped `beforeAll` timeout to 30 seconds in 7 compatibility test files (`__compatibility__/*.spec.ts`). Native-addon packages routinely exceed the previous 10-second default on a cold ESM load.
51
+
52
+ - Updated dependencies [[`736a5fe`](https://github.com/ofri-peretz/eslint/commit/736a5fed47e673f6157ea900b29fe2a54e4bc7df)]:
53
+ - @interlace/eslint-devkit@1.4.1
54
+
55
+ ### Bug Fixes
56
+
57
+ - align codecov component IDs with full package names ([2831b968](https://github.com/ofri-peretz/eslint/commit/2831b968))
58
+
59
+ ### Documentation
60
+
61
+ - fix changelog header format across all packages ([c3a15082](https://github.com/ofri-peretz/eslint/commit/c3a15082))
62
+
63
+ ### ❤️ Thank You
64
+
65
+ - Ofri Peretz
66
+
67
+ ## [1.2.2] - 2026-02-06
68
+
69
+ ### Bug Fixes
70
+
71
+ - align codecov component names and update docs components ([0a59a86c](https://github.com/ofri-peretz/eslint/commit/0a59a86c))
72
+
73
+ ### ❤️ Thank You
74
+
75
+ - Ofri Peretz
76
+
77
+ ## [1.2.1] - 2026-02-02
78
+
79
+ This was a version bump only for eslint-plugin-lambda-security to align it with other projects, there were no code changes.
80
+
81
+ # Changelog
82
+
83
+ All notable changes to `eslint-plugin-lambda-security` will be documented in this file.
84
+
85
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
86
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
87
+
88
+ ## [1.0.0] - 2025-12-29
89
+
90
+ ### Added
91
+
92
+ #### Credential & Secrets Protection Rules (3)
93
+
94
+ - `no-hardcoded-credentials-sdk` - Detect hardcoded AWS credentials in SDK v3 clients (CWE-798)
95
+ - `no-secrets-in-env` - Detect secrets hardcoded in environment variables (CWE-798)
96
+ - `no-env-logging` - Detect logging entire process.env object (CWE-532)
97
+
98
+ #### CORS Security Rules (2)
99
+
100
+ - `no-permissive-cors-response` - Detect wildcard CORS in Lambda response headers (CWE-942)
101
+ - `no-permissive-cors-middy` - Detect permissive CORS in @middy/http-cors middleware (CWE-942)
102
+
103
+ #### Presets (2)
104
+
105
+ - `recommended` - Balanced security defaults
106
+ - `strict` - All 5 rules as errors
107
+
108
+ #### Features
109
+
110
+ - LLM-optimized error messages with CWE references
111
+ - OWASP Serverless Top 10 alignment (SAS-2, SAS-3, SAS-4)
112
+ - AWS SDK v3 client detection (S3, DynamoDB, Lambda, STS, etc.)
113
+ - Middy middleware detection (@middy/http-cors)
114
+ - Real AWS access key pattern matching (AKIA*, ASIA*)
115
+ - TypeScript support with exported option types
116
+ - Comprehensive test coverage (78 tests, 97.40% line coverage)
117
+ - Auto-fix for CORS violations
118
+
119
+ ### Security
120
+
121
+ - Covers 3 CWEs: 532, 798, 942
122
+ - Maps to OWASP Serverless Top 10: SAS-2, SAS-3, SAS-4
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <a href="https://eslint.interlace.tools" target="blank"><img src="https://eslint.interlace.tools/eslint-interlace-logo-light.svg" alt="ESLint Interlace Logo" width="120" /></a>
2
+ <a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security" target="blank"><img src="https://eslint.interlace.tools/eslint-interlace-logo-light.svg" alt="ESLint Interlace Logo" width="120" /></a>
3
3
  </p>
4
4
 
5
5
  <p align="center">
@@ -14,10 +14,11 @@
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
 
17
+ > ⭐ If this plugin caught a real bug for you, [**star the repo**](https://github.com/ofri-peretz/eslint) — it's the signal that keeps these rules maintained.
18
+
17
19
  ## Description
18
20
 
19
21
  This plugin provides Security best practices for AWS Lambda functions (IAM, timeouts, environment).
20
- By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.
21
22
 
22
23
  ## Philosophy
23
24
 
@@ -25,25 +26,31 @@ By using this plugin, you can proactively identify and mitigate security risks a
25
26
 
26
27
  ## Getting Started
27
28
 
28
- - To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-lambda-security), visit [eslint.interlace.tools](https://eslint.interlace.tools). 📚
29
- - 要查看中文 [指南](https://eslint.interlace.tools/docs/security/plugin-lambda-security), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools). 📚
30
- - [가이드](https://eslint.interlace.tools/docs/security/plugin-lambda-security) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools)에서 확인하실 수 있습니다. 📚
31
- - [ガイド](https://eslint.interlace.tools/docs/security/plugin-lambda-security)は [eslint.interlace.tools](https://eslint.interlace.tools)でご確認ください。 📚
32
- - Para ver la [guía](https://eslint.interlace.tools/docs/security/plugin-lambda-security), visita [eslint.interlace.tools](https://eslint.interlace.tools). 📚
33
- - للاطلاع على [الدليل](https://eslint.interlace.tools/docs/security/plugin-lambda-security)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools). 📚
29
+ - To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-lambda-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security), visit [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security). 📚
30
+ - 要查看中文 [指南](https://eslint.interlace.tools/docs/security/plugin-lambda-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security). 📚
31
+ - [가이드](https://eslint.interlace.tools/docs/security/plugin-lambda-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security)에서 확인하실 수 있습니다. 📚
32
+ - [ガイド](https://eslint.interlace.tools/docs/security/plugin-lambda-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security)は [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security)でご確認ください。 📚
33
+ - Para ver la [guía](https://eslint.interlace.tools/docs/security/plugin-lambda-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security), visita [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security). 📚
34
+ - للاطلاع على [الدليل](https://eslint.interlace.tools/docs/security/plugin-lambda-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security). 📚
34
35
 
35
36
  ```bash
36
37
  npm install eslint-plugin-lambda-security --save-dev
37
38
  ```
38
39
 
39
- ## 💡 What you get
40
- - **Serverless-focused coverage:** 5 rules targeting Lambda-specific vulnerabilities (credentials, CORS, secrets, logging).
41
- - **LLM-optimized & MCP-ready:** Structured 2-line messages with CWE + OWASP + CVSS + concrete fixes so humans _and_ AI auto-fixers stay aligned.
42
- - **Standards aligned:** OWASP Serverless Top 10, CWE tagging, CVSS scoring in every finding for compliance mapping.
43
- - **Tiered presets:** `recommended`, `strict` for fast policy rollout.
44
- - **Framework-aware:** Detects Middy middleware, API Gateway response patterns, AWS SDK v3 clients.
45
- - **Low false positive rate:** Context-aware detection with production heuristics.
40
+ ## ⚙️ Configuration Presets
41
+ | Preset | Description |
42
+ | :------------ | :--------------------------------------------------------------------- |
43
+ | `recommended` | Balanced security for Lambda projects (critical as error, others warn) |
44
+ | `strict` | Maximum security enforcement (all rules as errors) |
46
45
 
46
+ ## 📚 Supported Libraries
47
+ | Library | npm | Downloads | Detection |
48
+ | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------- |
49
+ | `aws-lambda` | [![npm](https://img.shields.io/npm/v/aws-lambda.svg?style=flat-square)](https://www.npmjs.com/package/aws-lambda) | [![downloads](https://img.shields.io/npm/dt/aws-lambda.svg?style=flat-square)](https://www.npmjs.com/package/aws-lambda) | IAM, Logging, Timeouts |
50
+ | `@aws-sdk/client-lambda` | [![npm](https://img.shields.io/npm/v/@aws-sdk/client-lambda.svg?style=flat-square)](https://www.npmjs.com/package/@aws-sdk/client-lambda) | [![downloads](https://img.shields.io/npm/dt/@aws-sdk/client-lambda.svg?style=flat-square)](https://www.npmjs.com/package/@aws-sdk/client-lambda) | Credential Safety |
51
+ | `middy` | [![npm](https://img.shields.io/npm/v/@middy/core.svg?style=flat-square)](https://www.npmjs.com/package/@middy/core) | [![downloads](https://img.shields.io/npm/dt/@middy/core.svg?style=flat-square)](https://www.npmjs.com/package/@middy/core) | Middleware Security |
52
+
53
+ ## 🤖 AI-Optimized Messages
47
54
  Every security rule produces a **structured 2-line error message**:
48
55
 
49
56
  ```bash
@@ -61,20 +68,15 @@ src/handlers/api.ts
61
68
  - ✅ **Fix instruction** - exact code to write
62
69
  - 📚 **Documentation link** - learn more
63
70
 
64
- ## ⚙️ Configuration Presets
65
- | Preset | Description |
66
- | :------------ | :--------------------------------------------------------------------- |
67
- | `recommended` | Balanced security for Lambda projects (critical as error, others warn) |
68
- | `strict` | Maximum security enforcement (all rules as errors) |
69
-
70
- ## 📚 Supported Libraries
71
- | Library | npm | Downloads | Detection |
72
- | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------- |
73
- | `aws-lambda` | [![npm](https://img.shields.io/npm/v/aws-lambda.svg?style=flat-square)](https://www.npmjs.com/package/aws-lambda) | [![downloads](https://img.shields.io/npm/dt/aws-lambda.svg?style=flat-square)](https://www.npmjs.com/package/aws-lambda) | IAM, Logging, Timeouts |
74
- | `@aws-sdk/client-lambda` | [![npm](https://img.shields.io/npm/v/@aws-sdk/client-lambda.svg?style=flat-square)](https://www.npmjs.com/package/@aws-sdk/client-lambda) | [![downloads](https://img.shields.io/npm/dt/@aws-sdk/client-lambda.svg?style=flat-square)](https://www.npmjs.com/package/@aws-sdk/client-lambda) | Credential Safety |
75
- | `middy` | [![npm](https://img.shields.io/npm/v/@middy/core.svg?style=flat-square)](https://www.npmjs.com/package/@middy/core) | [![downloads](https://img.shields.io/npm/dt/@middy/core.svg?style=flat-square)](https://www.npmjs.com/package/@middy/core) | Middleware Security |
71
+ By providing this structured context (CWE, OWASP, Fix), we enable AI tools to **reason** about the security flaw rather than hallucinating. This allows Copilot/Cursor to suggest the _exact_ correct fix immediately.
76
72
 
77
- ---
73
+ ## 💡 What You Get
74
+ - **Serverless-focused coverage:** 5 rules targeting Lambda-specific vulnerabilities (credentials, CORS, secrets, logging).
75
+ - **LLM-optimized & MCP-ready:** Structured 2-line messages with CWE + OWASP + CVSS + concrete fixes so humans _and_ AI auto-fixers stay aligned.
76
+ - **Standards aligned:** OWASP Serverless Top 10, CWE tagging, CVSS scoring in every finding for compliance mapping.
77
+ - **Tiered presets:** `recommended`, `strict` for fast policy rollout.
78
+ - **Framework-aware:** Detects Middy middleware, API Gateway response patterns, AWS SDK v3 clients.
79
+ - **Low false positive rate:** Context-aware detection with production heuristics.
78
80
 
79
81
  ## ⚙️ Configuration Options
80
82
  All rules accept these common options:
@@ -93,7 +95,13 @@ All rules accept these common options:
93
95
  }
94
96
  ```
95
97
 
96
- ---
98
+ ## 📦 Compatibility
99
+ | Package | Version |
100
+ | :--- | :--- |
101
+ | ESLint | `^8.0.0 \|\| ^9.0.0 \|\| ^10.0.0` |
102
+ | Node.js | `>=18.0.0` |
103
+
104
+ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md) — current ecosystem share data, the 20% gate, and the forward-looking exception that covers v10.
97
105
 
98
106
  ## Rules
99
107
 
@@ -102,28 +110,32 @@ All rules accept these common options:
102
110
  | Icon | Description |
103
111
  | :---: | :--- |
104
112
  | 💼 | **Recommended**: Included in the recommended preset. |
105
- | ⚠️ | **Warns**: Set towarn in recommended preset. |
113
+ | ⚠️ | **Warns**: Set to warn in recommended preset. |
106
114
  | 🔧 | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
107
115
  | 💡 | **Suggestions**: Providing code suggestions in IDE. |
108
116
  | 🚫 | **Deprecated**: This rule is deprecated. |
109
-
110
- | Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
111
- | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
112
- | [no-env-logging](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-env-logging) | CWE-532 | | 7.5 | ESLint rule documentation for no-env-logging | 💼 | ⚠️ | | | |
113
- | [no-error-swallowing](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-error-swallowing) | CWE-391 | | 7.5 | ESLint rule documentation for no-error-swallowing | 💼 | ⚠️ | | | |
114
- | [no-exposed-debug-endpoints](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-exposed-debug-endpoints) | | | | ESLint rule documentation for no-exposed-debug-endpoints | | | | | |
115
- | [no-exposed-error-details](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-exposed-error-details) | CWE-209 | | 7.5 | ESLint rule documentation for no-exposed-error-details | 💼 | ⚠️ | | | |
116
- | [no-hardcoded-credentials-sdk](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-hardcoded-credentials-sdk) | CWE-798 | | 9.8 | ESLint rule documentation for no-hardcoded-credentials-sdk | 💼 | | | | |
117
- | [no-missing-authorization-check](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-missing-authorization-check) | CWE-862 | | 7.5 | ESLint rule documentation for no-missing-authorization-check | 💼 | ⚠️ | | | |
118
- | [no-overly-permissive-iam-policy](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-overly-permissive-iam-policy) | CWE-732 | | 9.8 | ESLint rule documentation for no-overly-permissive-iam-policy | 💼 | | | | |
119
- | [no-permissive-cors-middy](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-permissive-cors-middy) | CWE-942 | | 9.1 | ESLint rule documentation for no-permissive-cors-middy | 💼 | | | | |
120
- | [no-permissive-cors-response](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-permissive-cors-response) | CWE-942 | | 9.1 | ESLint rule documentation for no-permissive-cors-response | 💼 | | 🔧 | | |
121
- | [no-secrets-in-env](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-secrets-in-env) | CWE-522 | | 9.8 | ESLint rule documentation for no-secrets-in-env | 💼 | | | | |
122
- | [no-unbounded-batch-processing](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-unbounded-batch-processing) | CWE-400 | | 7.5 | ESLint rule documentation for no-unbounded-batch-processing | 💼 | ⚠️ | | | |
123
- | [no-unvalidated-event-body](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-unvalidated-event-body) | CWE-20 | | 7.5 | ESLint rule documentation for no-unvalidated-event-body | 💼 | ⚠️ | | | |
124
- | [no-user-controlled-requests](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-user-controlled-requests) | CWE-918 | | 9.8 | ESLint rule documentation for no-user-controlled-requests | 💼 | | | | |
125
- | [require-timeout-handling](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/require-timeout-handling) | CWE-703 | | 7.5 | ESLint rule documentation for require-timeout-handling | 💼 | ⚠️ | | | |
126
-
117
+ | 🟢 | **Type-unaware**: AST-only, runs in oxlint JS-plugin tier. |
118
+ | 🟡 | **Type-aware (refining)**: pure-AST primary path; types refine precision. |
119
+ | 🟠 | **Type-aware (graceful)**: requires TS program; silent without it. |
120
+
121
+ <!-- AUTO-GENERATED:RULES_TABLE:START - Do not edit manually -->
122
+ | Rule | CWE | OWASP | CVSS | Description | 🧠 | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
123
+ | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
124
+ | [no-env-logging](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-env-logging?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-532 | A09:2021 | | Detect logging of process.env which may expose secrets | 🟢 | | ⚠️ | | | |
125
+ | [no-error-swallowing](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-error-swallowing?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-390 | A09:2021 | | Detect empty catch blocks and missing error logging | 🟢 | | ⚠️ | | | |
126
+ | [no-exposed-debug-endpoints](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-exposed-debug-endpoints?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-489 | A05:2021 | | Detect debug endpoints without authentication in Lambda handlers | 🟢 | 💼 | | | | |
127
+ | [no-exposed-error-details](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-exposed-error-details?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-209 | A01:2021 | | Detect Lambda handlers exposing internal error details in responses | 🟢 | | ⚠️ | | | |
128
+ | [no-hardcoded-credentials-sdk](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-hardcoded-credentials-sdk?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-798 | | | Detects hardcoded AWS credentials in SDK client configurations | 🟢 | 💼 | | | | |
129
+ | [no-missing-authorization-check](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-missing-authorization-check?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | | | | Security rule for lambda-security. This rule is part of eslint-plugin-lambda-security and provides LLM-opti… | 🟢 | | ⚠️ | | | |
130
+ | [no-overly-permissive-iam-policy](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-overly-permissive-iam-policy?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-732 | | | Security rule for lambda-security. This rule is part of eslint-plugin-lambda-security and provides LLM-opti… | 🟢 | 💼 | | | | |
131
+ | [no-permissive-cors-middy](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-permissive-cors-middy?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-942 | | | Detects permissive CORS configurations in Middy middleware | 🟢 | 💼 | | | | |
132
+ | [no-permissive-cors-response](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-permissive-cors-response?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-942 | | | Detects permissive CORS headers in Lambda API Gateway responses | 🟢 | 💼 | | | | |
133
+ | [no-secrets-in-env](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-secrets-in-env?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-798 | | | Detects secrets defined directly in environment variable configurations | 🟢 | 💼 | | | | |
134
+ | [no-unbounded-batch-processing](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-unbounded-batch-processing?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-770 | | | Detect processing batch records without size validation | 🟢 | | ⚠️ | | | |
135
+ | [no-unvalidated-event-body](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-unvalidated-event-body?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-20 | A03:2021 | | Detect Lambda handlers using event body without validation | 🟢 | | ⚠️ | | | |
136
+ | [no-user-controlled-requests](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/no-user-controlled-requests?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-918 | A10:2021 | | Detect HTTP requests with user-controlled URLs (SSRF) | 🟢 | 💼 | | | | |
137
+ | [require-timeout-handling](https://eslint.interlace.tools/docs/security/plugin-lambda-security/rules/require-timeout-handling?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security) | CWE-400 | | | Require timeout handling in Lambda handlers with external calls | 🟢 | | ⚠️ | | | |
138
+ <!-- AUTO-GENERATED:RULES_TABLE:END -->
127
139
  ## 🔗 Related ESLint Plugins
128
140
 
129
141
  Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
@@ -132,7 +144,7 @@ Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with L
132
144
  | :--- | :---: | :--- |
133
145
  | [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-secure-coding.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-secure-coding) | General security rules & OWASP guidelines. |
134
146
  | [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-pg.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL security & best practices. |
135
- | [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-crypto.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-crypto) | NodeJS Cryptography security rules. |
147
+ | [`eslint-plugin-node-security`](https://www.npmjs.com/package/eslint-plugin-node-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-node-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-node-security) | Node.js core-module security (fs, child_process, vm, crypto, Buffer). |
136
148
  | [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-jwt.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
137
149
  | [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-browser-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-browser-security) | Browser-specific security & XSS prevention. |
138
150
  | [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-express-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-express-security) | Express.js security hardening rules. |
@@ -142,10 +154,19 @@ Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with L
142
154
  | [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-vercel-ai-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security hardening. |
143
155
  | [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-import-next.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-import-next) | Next-gen import sorting & architecture. |
144
156
 
157
+ <!-- INTERLACE:STAR_CTA:START -->
158
+ ## ⭐ Support & follow
159
+
160
+ If this plugin caught a real bug for you, **[star the repo](https://github.com/ofri-peretz/eslint)** — stars are the signal that keeps the Interlace ESLint ecosystem maintained — and **[follow the writeups on Dev.to](https://dev.to/ofri-peretz)** for the benchmarks and security research behind these rules.
161
+
162
+ [![GitHub stars](https://img.shields.io/github/stars/ofri-peretz/eslint?style=social)](https://github.com/ofri-peretz/eslint)
163
+
164
+ <!-- INTERLACE:STAR_CTA:END -->
165
+
145
166
  ## 📄 License
146
167
 
147
168
  MIT © [Ofri Peretz](https://github.com/ofri-peretz)
148
169
 
149
170
  <p align="center">
150
- <a href="https://eslint.interlace.tools/docs/security/plugin-lambda-security"><img src="https://eslint.interlace.tools/images/og-lambda-security.png" alt="ESLint Interlace Plugin" width="100%" /></a>
171
+ <a href="https://eslint.interlace.tools/docs/security/plugin-lambda-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security"><img src="https://eslint.interlace.tools/images/og-lambda-security.png" alt="ESLint Interlace Plugin" width="100%" /></a>
151
172
  </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-lambda-security",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
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",
@@ -13,11 +13,15 @@
13
13
  "./types": {
14
14
  "types": "./src/types/index.d.ts",
15
15
  "default": "./src/types/index.js"
16
+ },
17
+ "./oxlint": {
18
+ "types": "./src/oxlint.d.ts",
19
+ "default": "./src/oxlint.js"
16
20
  }
17
21
  },
18
22
  "author": "Ofri Peretz <ofriperetzdev@gmail.com>",
19
23
  "license": "MIT",
20
- "homepage": "https://github.com/ofri-peretz/eslint/tree/main/packages/eslint-plugin-lambda-security#readme",
24
+ "homepage": "https://eslint.interlace.tools/docs/security/plugin-lambda-security?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-lambda-security",
21
25
  "repository": {
22
26
  "type": "git",
23
27
  "url": "https://github.com/ofri-peretz/eslint",
@@ -64,9 +68,11 @@
64
68
  },
65
69
  "dependencies": {
66
70
  "tslib": "^2.3.0",
67
- "@interlace/eslint-devkit": "^1.2.1"
71
+ "@interlace/eslint-devkit": "^1.4.1"
72
+ },
73
+ "peerDependencies": {
74
+ "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
68
75
  },
69
- "peerDependencies": {},
70
76
  "peerDependenciesMeta": {
71
77
  "@aws-sdk/client-lambda": {
72
78
  "optional": true
@@ -87,5 +93,15 @@
87
93
  "devDependencies": {
88
94
  "@typescript-eslint/parser": "^8.46.2",
89
95
  "@typescript-eslint/rule-tester": "^8.46.2"
96
+ },
97
+ "scripts": {
98
+ "build": "tsx ../../scripts/build-package.ts",
99
+ "test": "vitest run",
100
+ "test:coverage": "vitest run --coverage",
101
+ "typecheck": "tsc -p tsconfig.lib.json --noEmit"
102
+ },
103
+ "funding": {
104
+ "type": "github",
105
+ "url": "https://github.com/ofri-peretz/eslint"
90
106
  }
91
- }
107
+ }
package/src/index.d.ts CHANGED
@@ -21,7 +21,7 @@
21
21
  * - SAS-7: Denial of Service ✅ (require-timeout-handling, no-unbounded-batch-processing)
22
22
  * - SAS-8: Server-Side Request Forgery ✅ (no-user-controlled-requests)
23
23
  * - SAS-9: Functions Misconfiguration ✅ (no-exposed-error-details)
24
- * - SAS-10: Improper Crypto ➡️ (Use eslint-plugin-crypto)
24
+ * - SAS-10: Improper Crypto ➡️ (Use eslint-plugin-node-security)
25
25
  */
26
26
  import type { TSESLint } from '@interlace/eslint-devkit';
27
27
  export declare const rules: Record<string, TSESLint.RuleModule<string, readonly unknown[]>>;
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.1.0',
56
+ version: '1.2.4',
57
57
  },
58
58
  rules: exports.rules,
59
59
  };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2025 Ofri Peretz
3
+ * Licensed under the MIT License. Use of this source code is governed by the
4
+ * MIT license that can be found in the LICENSE file.
5
+ */
6
+ /**
7
+ * oxlint sub-export.
8
+ *
9
+ * Consumers wire oxlint to this entry via:
10
+ * { "jsPlugins": ["eslint-plugin-lambda-security/oxlint"] }
11
+ *
12
+ * oxlint's JS plugin loader does `require('eslint-plugin-lambda-security/oxlint')` and reads
13
+ * `.rules` off the result. The compiled output of `export = plugin` is
14
+ * `module.exports = plugin`, which gives oxlint the plugin object directly
15
+ * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
16
+ *
17
+ * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
18
+ */
19
+ import { plugin } from './index';
20
+ export = plugin;
package/src/oxlint.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2025 Ofri Peretz
4
+ * Licensed under the MIT License. Use of this source code is governed by the
5
+ * MIT license that can be found in the LICENSE file.
6
+ */
7
+ /**
8
+ * oxlint sub-export.
9
+ *
10
+ * Consumers wire oxlint to this entry via:
11
+ * { "jsPlugins": ["eslint-plugin-lambda-security/oxlint"] }
12
+ *
13
+ * oxlint's JS plugin loader does `require('eslint-plugin-lambda-security/oxlint')` and reads
14
+ * `.rules` off the result. The compiled output of `export = plugin` is
15
+ * `module.exports = plugin`, which gives oxlint the plugin object directly
16
+ * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
17
+ *
18
+ * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
19
+ */
20
+ const index_1 = require("./index");
21
+ module.exports = index_1.plugin;
@@ -8,13 +8,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.noEnvLogging = void 0;
9
9
  const eslint_devkit_1 = require("@interlace/eslint-devkit");
10
10
  // Logging function names
11
- const LOGGING_FUNCTIONS = ['log', 'info', 'warn', 'error', 'debug', 'trace'];
11
+ const LOGGING_FUNCTIONS = new Set(['log', 'info', 'warn', 'error', 'debug', 'trace']);
12
12
  exports.noEnvLogging = (0, eslint_devkit_1.createRule)({
13
13
  name: 'no-env-logging',
14
14
  meta: {
15
15
  type: 'problem',
16
16
  docs: {
17
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-lambda-security/docs/rules/no-env-logging.md',
17
18
  description: 'Detects logging of process.env which may expose secrets',
19
+ cwe: 'CWE-532',
20
+ cvss: 7.5,
18
21
  },
19
22
  hasSuggestions: true,
20
23
  messages: {
@@ -49,7 +52,7 @@ exports.noEnvLogging = (0, eslint_devkit_1.createRule)({
49
52
  defaultOptions: [{ allowInTests: true }],
50
53
  create(context, [options = {}]) {
51
54
  const { allowInTests = true } = options;
52
- const filename = context.filename || context.getFilename();
55
+ const filename = context.filename;
53
56
  const isTestFile = /\.(test|spec)\.(ts|tsx|js|jsx)$/.test(filename);
54
57
  if (allowInTests && isTestFile) {
55
58
  return {};
@@ -86,7 +89,7 @@ exports.noEnvLogging = (0, eslint_devkit_1.createRule)({
86
89
  if (prop.type !== eslint_devkit_1.AST_NODE_TYPES.Identifier)
87
90
  return false;
88
91
  const methodName = prop.name;
89
- if (!LOGGING_FUNCTIONS.includes(methodName))
92
+ if (!LOGGING_FUNCTIONS.has(methodName))
90
93
  return false;
91
94
  // console.log, console.info, etc.
92
95
  if (obj.type === eslint_devkit_1.AST_NODE_TYPES.Identifier && obj.name === 'console') {