eslint-plugin-lambda-security 1.1.0 โ†’ 1.2.0

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 CHANGED
@@ -1,21 +1,39 @@
1
- # eslint-plugin-lambda-security
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>
3
+ </p>
2
4
 
3
- <div align="center">
4
- <img src="https://eslint.interlace.tools/images/interlace-hero.png" alt="ESLint Interlace - eslint-plugin-lambda-security" width="100%" />
5
- </div>
5
+ <p align="center">
6
+ Security best practices for AWS Lambda functions (IAM, timeouts, environment).
7
+ </p>
6
8
 
7
- > ๐Ÿ” Security-focused ESLint plugin for AWS Lambda and serverless applications. Detects hardcoded credentials, permissive CORS, environment secrets, and logging issues with AI-optimized fix guidance.
9
+ <p align="center">
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
+ <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
+ <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>
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
+ </p>
8
16
 
9
- [![npm version](https://img.shields.io/npm/v/eslint-plugin-lambda-security.svg)](https://www.npmjs.com/package/eslint-plugin-lambda-security)
10
- [![npm downloads](https://img.shields.io/npm/dm/eslint-plugin-lambda-security.svg)](https://www.npmjs.com/package/eslint-plugin-lambda-security)
11
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
12
- [![codecov](https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?component=lambda_security)](https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=lambda_security)
13
- [![Dec 2025](https://img.shields.io/badge/Dec_2025-blue?logo=rocket&logoColor=white)](https://github.com/ofri-peretz/eslint)
17
+ ## Description
14
18
 
15
- > **Serverless-first security:** This plugin provides security rules for **AWS Lambda**, **Middy.js**, **Serverless Framework**, **AWS SAM**, and **AWS SDK v3**.
16
- > With **5 security rules** mapped to OWASP Serverless Top 10, CWE and CVSS, it transforms your linter into a serverless security auditor that AI assistants can understand and fix.
19
+ This plugin secures your AWS Lambda functions by enforcing best practices related to IAM permissions, timeout configurations, and environment variable management. It proactively detects vulnerabilities such as over-permissive policies and insecure logging practices, helping you adhere to the Principle of Least Privilege. Implementing these checks ensures that your serverless architecture remains resilient and compliant with strict security standards.
17
20
 
18
- ---
21
+ ## Philosophy
22
+
23
+ **Interlace** fosters **strength through integration**. Instead of stacking isolated rules, we **interlace** security directly into your workflow to create a resilient fabric of code. We believe tools should **guide rather than gatekeep**, providing educational feedback that strengthens the developer with every interaction.
24
+
25
+ ## Getting Started
26
+
27
+ - To check out the [guide](https://eslint.interlace.tools/docs/lambda-security), visit [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
28
+ - ่ฆๆŸฅ็œ‹ไธญๆ–‡ [ๆŒ‡ๅ—](https://eslint.interlace.tools/docs/lambda-security), ่ฏท่ฎฟ้—ฎ [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
29
+ - [๊ฐ€์ด๋“œ](https://eslint.interlace.tools/docs/lambda-security) ๋ฌธ์„œ๋Š” [eslint.interlace.tools](https://eslint.interlace.tools)์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๐Ÿ“š
30
+ - [ใ‚ฌใ‚คใƒ‰](https://eslint.interlace.tools/docs/lambda-security)ใฏ [eslint.interlace.tools](https://eslint.interlace.tools)ใงใ”็ขบ่ชใใ ใ•ใ„ใ€‚ ๐Ÿ“š
31
+ - Para ver la [guรญa](https://eslint.interlace.tools/docs/lambda-security), visita [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
32
+ - ู„ู„ุงุทู„ุงุน ุนู„ู‰ [ุงู„ุฏู„ูŠู„](https://eslint.interlace.tools/docs/lambda-security)ุŒ ู‚ู… ุจุฒูŠุงุฑุฉ [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
33
+
34
+ ```bash
35
+ npm install eslint-plugin-lambda-security --save-dev
36
+ ```
19
37
 
20
38
  ## ๐Ÿ’ก What you get
21
39
 
@@ -43,244 +61,20 @@ src/handlers/api.ts
43
61
  - โœ… **Fix instruction** - exact code to write
44
62
  - ๐Ÿ“š **Documentation link** - learn more
45
63
 
46
- ---
47
-
48
- ## ๐Ÿ“Š OWASP Serverless Top 10 Coverage Matrix
49
-
50
- | OWASP Category | Coverage | Rule | CWE | OWASP | CVSS | Description | ๐Ÿ’ผ | โš ๏ธ | ๐Ÿ”ง | ๐Ÿ’ก | ๐Ÿšซ |
51
- | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
52
- | **SAS-1: Injection** | | | | | | | | | |
53
- | **SAS-2: Broken Authentication** | | | | | | | | | |
54
- | **SAS-3: Sensitive Data Exposure** | | | | | | | | | |
55
- | **SAS-4: Security Misconfiguration** | | | | | | | | | |
56
- | **SAS-5: Broken Access Control** | | | | | | | | | |
57
- | **SAS-6: Insufficient Logging** | | | | | | | | | |
58
- | **SAS-7: Denial of Service** | | | | | | | | | |
59
- | **SAS-8: Server-Side Request Forgery** | | | | | | | | | |
60
- | **SAS-9: Functions Misconfiguration** | | | | | | | | | |
61
- | **SAS-10: Improper Crypto** | | | | | | | | | |
62
- ---
63
-
64
- ## ๐Ÿ” 13 Security Rules
65
-
66
- ๐Ÿ’ผ = Set in `recommended` | โš ๏ธ = Warns in `recommended` | ๐Ÿ”ง = Auto-fixable | ๐Ÿ’ก = Suggestions
67
-
68
- ### Credential & Secrets Protection (3 rules)
69
-
70
- | Rule | CWE | OWASP | CVSS | Description | ๐Ÿ’ผ | โš ๏ธ | ๐Ÿ”ง | ๐Ÿ’ก | ๐Ÿšซ |
71
- | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
72
- | [no-hardcoded-credentials-sdk](#no-hardcoded-credentials-sdk) | CWE-798 | SAS-2 | 9.8 | Hardcoded AWS credentials in SDK v3 clients | ๐Ÿ’ผ | | | | |
73
- | [no-secrets-in-env](#no-secrets-in-env) | CWE-798 | SAS-3 | 9.8 | Secrets hardcoded in environment variables | ๐Ÿ’ผ | | | | |
74
- | [no-env-logging](#no-env-logging) | CWE-532 | SAS-3 | 7.5 | Logging entire `process.env` object | | โš ๏ธ | | | |
75
- ### CORS Security (2 rules)
76
-
77
- | Rule | CWE | OWASP | CVSS | Description | ๐Ÿ’ผ | โš ๏ธ | ๐Ÿ”ง | ๐Ÿ’ก | ๐Ÿšซ |
78
- | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
79
- | [no-permissive-cors-response](#no-permissive-cors-response) | CWE-942 | SAS-4 | 9.1 | Wildcard CORS in Lambda response headers | ๐Ÿ’ผ | | ๐Ÿ”ง | | |
80
- | [no-permissive-cors-middy](#no-permissive-cors-middy) | CWE-942 | SAS-4 | 9.1 | Permissive CORS in @middy/http-cors middleware | ๐Ÿ’ผ | | | | |
81
- ### Input Validation & Access Control (4 rules)
82
-
83
- | Rule | CWE | OWASP | CVSS | Description | ๐Ÿ’ผ | โš ๏ธ | ๐Ÿ”ง | ๐Ÿ’ก | ๐Ÿšซ |
84
- | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
85
- | no-unvalidated-event-body | CWE-20 | SAS-1 | 8.0 | Lambda handlers using event body without validation | | โš ๏ธ | | ๐Ÿ’ก | |
86
- | no-missing-authorization-check | CWE-862 | SAS-5 | 7.5 | Lambda handlers without authorization checks | | โš ๏ธ | | ๐Ÿ’ก | |
87
- | no-overly-permissive-iam-policy | CWE-732 | SAS-5 | 6.5 | IAM policies with wildcard permissions | ๐Ÿ’ผ | | | ๐Ÿ’ก | |
88
- | no-user-controlled-requests | CWE-918 | SAS-8 | 9.1 | HTTP requests with user-controlled URLs (SSRF) | ๐Ÿ’ผ | | | ๐Ÿ’ก | |
89
- ### Security Operations (4 rules)
90
-
91
- | Rule | CWE | OWASP | CVSS | Description | ๐Ÿ’ผ | โš ๏ธ | ๐Ÿ”ง | ๐Ÿ’ก | ๐Ÿšซ |
92
- | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
93
- | no-error-swallowing | CWE-390 | SAS-6 | 5.0 | Empty catch blocks and missing error logging | | โš ๏ธ | | ๐Ÿ’ก | |
94
- | require-timeout-handling | CWE-400 | SAS-7 | 6.0 | External calls without timeout handling | | โš ๏ธ | | ๐Ÿ’ก | |
95
- | no-unbounded-batch-processing | CWE-770 | SAS-7 | 5.5 | Processing batch records without size limits | | โš ๏ธ | | ๐Ÿ’ก | |
96
- | no-exposed-error-details | CWE-209 | SAS-9 | 4.3 | Exposing internal error details in responses | | โš ๏ธ | | ๐Ÿ’ก | |
97
- ---
98
-
99
- ## ๐Ÿ” Rule Details
64
+ ## โš™๏ธ Configuration Presets
100
65
 
101
- ### `no-hardcoded-credentials-sdk`
66
+ | Preset | Description |
67
+ | :------------ | :--------------------------------------------------------------------- |
68
+ | `recommended` | Balanced security for Lambda projects (critical as error, others warn) |
69
+ | `strict` | Maximum security enforcement (all rules as errors) |
102
70
 
103
- Detects hardcoded AWS credentials in AWS SDK v3 client configurations.
71
+ ## ๐Ÿ“š Supported Libraries
104
72
 
105
- **โŒ Incorrect**
106
-
107
- ```javascript
108
- // Hardcoded credentials - NEVER do this!
109
- const client = new S3Client({
110
- credentials: {
111
- accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
112
- secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
113
- },
114
- });
115
- ```
116
-
117
- **โœ… Correct**
118
-
119
- ```javascript
120
- // Use credential provider chain
121
- import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
122
-
123
- const client = new S3Client({
124
- credentials: fromNodeProviderChain(),
125
- });
126
-
127
- // Or let SDK use default chain (recommended for Lambda)
128
- const client = new S3Client({ region: 'us-east-1' });
129
- ```
130
-
131
- **Detection Patterns:**
132
-
133
- - Real AWS access key patterns (AKIA*, ASIA*)
134
- - Secret access keys with 20+ characters
135
- - Session tokens with 15+ characters
136
- - Template literal credential construction
137
-
138
- ---
139
-
140
- ### `no-permissive-cors-response`
141
-
142
- Detects wildcard CORS (`Access-Control-Allow-Origin: '*'`) in Lambda response headers.
143
-
144
- **โŒ Incorrect**
145
-
146
- ```javascript
147
- return {
148
- statusCode: 200,
149
- headers: { 'Access-Control-Allow-Origin': '*' },
150
- body: JSON.stringify(data),
151
- };
152
- ```
153
-
154
- **โœ… Correct**
155
-
156
- ```javascript
157
- return {
158
- statusCode: 200,
159
- headers: { 'Access-Control-Allow-Origin': 'https://your-app.com' },
160
- body: JSON.stringify(data),
161
- };
162
-
163
- // Or use dynamic origin from request
164
- return {
165
- statusCode: 200,
166
- headers: { 'Access-Control-Allow-Origin': event.headers.origin },
167
- body: JSON.stringify(data),
168
- };
169
- ```
170
-
171
- ---
172
-
173
- ### `no-permissive-cors-middy`
174
-
175
- Detects permissive CORS configuration in Middy http-cors middleware.
176
-
177
- **โŒ Incorrect**
178
-
179
- ```javascript
180
- // Default is permissive!
181
- middy(handler).use(httpCors());
182
-
183
- // Explicit wildcard
184
- middy(handler).use(httpCors({ origin: '*' }));
185
- ```
186
-
187
- **โœ… Correct**
188
-
189
- ```javascript
190
- middy(handler).use(
191
- httpCors({
192
- origins: ['https://your-app.com', 'https://app.your-domain.com'],
193
- }),
194
- );
195
- ```
196
-
197
- ---
198
-
199
- ### `no-secrets-in-env`
200
-
201
- Detects secrets hardcoded in environment variable assignments.
202
-
203
- **โŒ Incorrect**
204
-
205
- ```javascript
206
- process.env.DB_PASSWORD = 'my-secret-password-12345';
207
-
208
- const envConfig = {
209
- API_KEY: 'sk-1234567890abcdef1234567890abcdef',
210
- };
211
- ```
212
-
213
- **โœ… Correct**
214
-
215
- ```javascript
216
- // Read from process.env (populated by Lambda)
217
- const password = process.env.DB_PASSWORD;
218
-
219
- // Use AWS Secrets Manager
220
- import {
221
- SecretsManagerClient,
222
- GetSecretValueCommand,
223
- } from '@aws-sdk/client-secrets-manager';
224
-
225
- const secret = await client.send(
226
- new GetSecretValueCommand({ SecretId: 'my-secret' }),
227
- );
228
- ```
229
-
230
- ---
231
-
232
- ### `no-env-logging`
233
-
234
- Detects logging of the entire `process.env` object, which may expose secrets.
235
-
236
- **โŒ Incorrect**
237
-
238
- ```javascript
239
- console.log(process.env);
240
- console.log(JSON.stringify(process.env));
241
- logger.info(process.env);
242
- ```
243
-
244
- **โœ… Correct**
245
-
246
- ```javascript
247
- // Log specific, non-sensitive values
248
- console.log('Region:', process.env.AWS_REGION);
249
- console.log('Environment:', process.env.NODE_ENV);
250
- ```
251
-
252
- ---
253
-
254
- ## ๐Ÿš€ Quick Start
255
-
256
- ### ESLint Flat Config (Recommended)
257
-
258
- ```javascript
259
- // eslint.config.js
260
- import lambdaSecurity from 'eslint-plugin-lambda-security';
261
-
262
- export default [
263
- lambdaSecurity.configs.recommended,
264
- // ... other configs
265
- ];
266
- ```
267
-
268
- ### Strict Mode
269
-
270
- ```javascript
271
- import lambdaSecurity from 'eslint-plugin-lambda-security';
272
-
273
- export default [lambdaSecurity.configs.strict];
274
- ```
275
-
276
- ---
277
-
278
- ## ๐Ÿ“‹ Available Presets
279
-
280
- | Preset | Description |
281
- | ----------------- | ---------------------------------------------------------------------- |
282
- | **`recommended`** | Balanced security for Lambda projects (critical as error, others warn) |
283
- | **`strict`** | Maximum security enforcement (all rules as errors) |
73
+ | Library | npm | Downloads | Detection |
74
+ | :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------- |
75
+ | `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 |
76
+ | `@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 |
77
+ | `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 |
284
78
 
285
79
  ---
286
80
 
@@ -324,7 +118,37 @@ export default [
324
118
 
325
119
  ---
326
120
 
327
- ## ๐Ÿค– LLM & AI Integration
121
+ ## Rules
122
+
123
+ **Legend**
124
+
125
+ | Icon | Description |
126
+ | :--: | :----------------------------------------------------------------- |
127
+ | ๐Ÿ’ผ | **Recommended**: Included in the recommended preset. |
128
+ | โš ๏ธ | **Warns**: Set towarn in recommended preset. |
129
+ | ๐Ÿ”ง | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
130
+ | ๐Ÿ’ก | **Suggestions**: Providing code suggestions in IDE. |
131
+ | ๐Ÿšซ | **Deprecated**: This rule is deprecated. |
132
+
133
+ | Rule | CWE | OWASP | CVSS | Description | ๐Ÿ’ผ | โš ๏ธ | ๐Ÿ”ง | ๐Ÿ’ก | ๐Ÿšซ |
134
+ | :--------------------------------------------------------------------------------------------------------------------------- | :-----: | :----: | :--: | :------------------------------------------------------------------ | :-: | :-: | :-: | :-: | :-: |
135
+ | [no-hardcoded-credentials-sdk](https://eslint.interlace.tools/docs/lambda-security/rules/no-hardcoded-credentials-sdk) | CWE-798 | SAS-02 | 9.8 | [no-hardcoded-credentials-sdk](#no-hardcoded-credentials-sdk) | ๐Ÿ’ผ | | | | |
136
+ | [no-permissive-cors-response](https://eslint.interlace.tools/docs/lambda-security/rules/no-permissive-cors-response) | CWE-942 | SAS-04 | 9.1 | [no-permissive-cors-response](#no-permissive-cors-response) | ๐Ÿ’ผ | | ๐Ÿ”ง | | |
137
+ | [no-permissive-cors-middy](https://eslint.interlace.tools/docs/lambda-security/rules/no-permissive-cors-middy) | CWE-942 | SAS-04 | 9.1 | [no-permissive-cors-middy](#no-permissive-cors-middy) | ๐Ÿ’ผ | | | | |
138
+ | [no-secrets-in-env](https://eslint.interlace.tools/docs/lambda-security/rules/no-secrets-in-env) | CWE-522 | SAS-03 | 9.8 | [no-secrets-in-env](#no-secrets-in-env) | ๐Ÿ’ผ | | | | |
139
+ | [no-env-logging](https://eslint.interlace.tools/docs/lambda-security/rules/no-env-logging) | CWE-532 | SAS-03 | 7.5 | [no-env-logging](#no-env-logging) | ๐Ÿ’ผ | โš ๏ธ | | | |
140
+ | [no-error-swallowing](https://eslint.interlace.tools/docs/lambda-security/rules/no-error-swallowing) | CWE-391 | SAS-06 | 7.5 | [no-error-swallowing](#no-error-swallowing) | ๐Ÿ’ผ | โš ๏ธ | | | |
141
+ | [require-timeout-handling](https://eslint.interlace.tools/docs/lambda-security/rules/require-timeout-handling) | CWE-703 | SAS-07 | 7.5 | [require-timeout-handling](#require-timeout-handling) | ๐Ÿ’ผ | โš ๏ธ | | | |
142
+ | [no-unbounded-batch-processing](https://eslint.interlace.tools/docs/lambda-security/rules/no-unbounded-batch-processing) | CWE-400 | SAS-07 | 7.5 | [no-unbounded-batch-processing](#no-unbounded-batch-processing) | ๐Ÿ’ผ | โš ๏ธ | | | |
143
+ | [no-unvalidated-event-body](https://eslint.interlace.tools/docs/lambda-security/rules/no-unvalidated-event-body) | CWE-20 | SAS-01 | 7.5 | [no-unvalidated-event-body](#no-unvalidated-event-body) | ๐Ÿ’ผ | โš ๏ธ | | | |
144
+ | [no-missing-authorization-check](https://eslint.interlace.tools/docs/lambda-security/rules/no-missing-authorization-check) | CWE-862 | SAS-05 | 7.5 | [no-missing-authorization-check](#no-missing-authorization-check) | ๐Ÿ’ผ | โš ๏ธ | | | |
145
+ | [no-exposed-error-details](https://eslint.interlace.tools/docs/lambda-security/rules/no-exposed-error-details) | CWE-209 | SAS-09 | 7.5 | [no-exposed-error-details](#no-exposed-error-details) | ๐Ÿ’ผ | โš ๏ธ | | | |
146
+ | [no-user-controlled-requests](https://eslint.interlace.tools/docs/lambda-security/rules/no-user-controlled-requests) | CWE-918 | SAS-08 | 9.8 | [no-user-controlled-requests](#no-user-controlled-requests) | ๐Ÿ’ผ | | | | |
147
+ | [no-overly-permissive-iam-policy](https://eslint.interlace.tools/docs/lambda-security/rules/no-overly-permissive-iam-policy) | CWE-732 | SAS-05 | 9.8 | [no-overly-permissive-iam-policy](#no-overly-permissive-iam-policy) | ๐Ÿ’ผ | | | | |
148
+
149
+ ---
150
+
151
+ ## AI-Optimized Messages
328
152
 
329
153
  This plugin is optimized for ESLint's [Model Context Protocol (MCP)](https://eslint.org/docs/latest/use/mcp), enabling AI assistants like **Cursor**, **GitHub Copilot**, and **Claude** to:
330
154
 
@@ -332,6 +156,12 @@ This plugin is optimized for ESLint's [Model Context Protocol (MCP)](https://esl
332
156
  - Apply the correct fix using structured guidance
333
157
  - Provide educational context to developers
334
158
 
159
+ ```bash
160
+ src/handlers/api.ts
161
+ 18:5 error ๐Ÿ”’ CWE-798 OWASP:SAS-2 CVSS:9.8 | Hardcoded AWS credentials detected | CRITICAL [SOC2,PCI-DSS]
162
+ Fix: Use credential provider chain or Lambda execution role | https://owasp.org/...
163
+ ```
164
+
335
165
  ```json
336
166
  // .cursor/mcp.json
337
167
  {
@@ -344,31 +174,36 @@ This plugin is optimized for ESLint's [Model Context Protocol (MCP)](https://esl
344
174
  }
345
175
  ```
346
176
 
347
- ---
348
-
349
- ## ๐Ÿ”— Related ESLint Plugins
177
+ 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.
350
178
 
351
- Part of the **Interlace ESLint Ecosystem** โ€” AI-native security plugins with LLM-optimized error messages:
352
-
353
- | Plugin | Downloads | Description | Rule | CWE | OWASP | CVSS | Description | ๐Ÿ’ผ | โš ๏ธ | ๐Ÿ”ง | ๐Ÿ’ก | ๐Ÿšซ |
354
- | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
355
- | [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | | | | | | | | | |
356
- | [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | | | | | | | | | |
357
- | [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | | | | | | | | | |
358
- | [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | | | | | | | | | |
359
- | [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | | | | | | | | | |
360
- | [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | | | | | | | | | |
361
- | [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | | | | | | | | | |
362
- | [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | | | | | | | | | |
363
- | [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | | | | | | | | | |
364
179
  ---
365
180
 
366
181
  ## ๐Ÿ”’ Privacy
367
182
 
368
183
  This plugin runs **100% locally**. No data ever leaves your machine.
369
184
 
370
- ---
185
+ ## ๐Ÿ”— Related ESLint Plugins
186
+
187
+ Part of the **Interlace ESLint Ecosystem** โ€” AI-native security plugins with LLM-optimized error messages:
188
+
189
+ | Plugin | Downloads | Description |
190
+ | :--------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------ |
191
+ | [`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. |
192
+ | [`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. |
193
+ | [`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. |
194
+ | [`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. |
195
+ | [`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. |
196
+ | [`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. |
197
+ | [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-lambda-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-lambda-security) | AWS Lambda security best practices. |
198
+ | [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-nestjs-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | NestJS security rules & patterns. |
199
+ | [`eslint-plugin-mongodb-security`](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-mongodb-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | MongoDB security best practices. |
200
+ | [`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. |
201
+ | [`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. |
371
202
 
372
203
  ## ๐Ÿ“„ License
373
204
 
374
205
  MIT ยฉ [Ofri Peretz](https://github.com/ofri-peretz)
206
+
207
+ <p align="center">
208
+ <a href="https://eslint.interlace.tools/docs/lambda-security"><img src="https://eslint.interlace.tools/images/og-lambda-security.png" alt="ESLint Interlace Plugin" width="300" /></a>
209
+ </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-lambda-security",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
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",
@@ -41,6 +41,7 @@
41
41
  "eslint",
42
42
  "eslint-plugin",
43
43
  "eslintplugin",
44
+ "interlace-security",
44
45
  "aws",
45
46
  "lambda",
46
47
  "aws-lambda",
@@ -62,8 +63,8 @@
62
63
  "node": ">=18.0.0"
63
64
  },
64
65
  "dependencies": {
65
- "@interlace/eslint-devkit": "^1.2.1",
66
- "tslib": "^2.3.0"
66
+ "tslib": "^2.3.0",
67
+ "@interlace/eslint-devkit": "^1.2.1"
67
68
  },
68
69
  "peerDependencies": {},
69
70
  "peerDependenciesMeta": {
package/src/index.d.ts CHANGED
@@ -3,101 +3,28 @@
3
3
  * Licensed under the MIT License. Use of this source code is governed by the
4
4
  * MIT license that can be found in the LICENSE file.
5
5
  */
6
- declare const _default: {
7
- rules: {
8
- 'no-hardcoded-credentials-sdk': import("@typescript-eslint/utils/ts-eslint").RuleModule<"hardcodedCredentials" | "useCredentialProvider", [import("./rules/no-hardcoded-credentials-sdk").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
9
- 'no-permissive-cors-response': import("@typescript-eslint/utils/ts-eslint").RuleModule<"permissiveCors" | "useSpecificOrigin", [import("./rules/no-permissive-cors-response").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
10
- 'no-permissive-cors-middy': import("@typescript-eslint/utils/ts-eslint").RuleModule<"permissiveCors" | "useSpecificOrigins", [import("./rules/no-permissive-cors-middy").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
11
- 'no-secrets-in-env': import("@typescript-eslint/utils/ts-eslint").RuleModule<"secretsInEnv" | "useSecretsManager", [import("./rules/no-secrets-in-env").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
12
- 'no-env-logging': import("@typescript-eslint/utils/ts-eslint").RuleModule<"envLogging" | "removeEnvLogging", [import("./rules/no-env-logging").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
13
- 'no-unvalidated-event-body': import("@typescript-eslint/utils/ts-eslint").RuleModule<"unvalidatedInput" | "useValidation", [import("./rules/no-unvalidated-event-body").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
14
- 'no-missing-authorization-check': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingAuthCheck" | "addAuthCheck", [import("./rules/no-missing-authorization-check").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
15
- 'no-overly-permissive-iam-policy': import("@typescript-eslint/utils/ts-eslint").RuleModule<"permissivePolicy" | "useLeastPrivilege", [import("./rules/no-overly-permissive-iam-policy").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
16
- 'no-error-swallowing': import("@typescript-eslint/utils/ts-eslint").RuleModule<"emptyCatchBlock" | "addErrorLogging", [import("./rules/no-error-swallowing").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
17
- 'require-timeout-handling': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingTimeoutHandling" | "addTimeoutCheck", [import("./rules/require-timeout-handling").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
18
- 'no-unbounded-batch-processing': import("@typescript-eslint/utils/ts-eslint").RuleModule<"unboundedBatch" | "addBatchLimit", [import("./rules/no-unbounded-batch-processing").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
19
- 'no-user-controlled-requests': import("@typescript-eslint/utils/ts-eslint").RuleModule<"ssrfVulnerability" | "useAllowlist", [import("./rules/no-user-controlled-requests").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
20
- 'no-exposed-error-details': import("@typescript-eslint/utils/ts-eslint").RuleModule<"exposedErrorDetails" | "sanitizeError", [import("./rules/no-exposed-error-details").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
21
- };
22
- configs: {
23
- recommended: {
24
- name: string;
25
- plugins: {
26
- 'lambda-security': {
27
- rules: {
28
- 'no-hardcoded-credentials-sdk': import("@typescript-eslint/utils/ts-eslint").RuleModule<"hardcodedCredentials" | "useCredentialProvider", [import("./rules/no-hardcoded-credentials-sdk").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
29
- 'no-permissive-cors-response': import("@typescript-eslint/utils/ts-eslint").RuleModule<"permissiveCors" | "useSpecificOrigin", [import("./rules/no-permissive-cors-response").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
30
- 'no-permissive-cors-middy': import("@typescript-eslint/utils/ts-eslint").RuleModule<"permissiveCors" | "useSpecificOrigins", [import("./rules/no-permissive-cors-middy").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
31
- 'no-secrets-in-env': import("@typescript-eslint/utils/ts-eslint").RuleModule<"secretsInEnv" | "useSecretsManager", [import("./rules/no-secrets-in-env").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
32
- 'no-env-logging': import("@typescript-eslint/utils/ts-eslint").RuleModule<"envLogging" | "removeEnvLogging", [import("./rules/no-env-logging").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
33
- 'no-unvalidated-event-body': import("@typescript-eslint/utils/ts-eslint").RuleModule<"unvalidatedInput" | "useValidation", [import("./rules/no-unvalidated-event-body").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
34
- 'no-missing-authorization-check': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingAuthCheck" | "addAuthCheck", [import("./rules/no-missing-authorization-check").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
35
- 'no-overly-permissive-iam-policy': import("@typescript-eslint/utils/ts-eslint").RuleModule<"permissivePolicy" | "useLeastPrivilege", [import("./rules/no-overly-permissive-iam-policy").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
36
- 'no-error-swallowing': import("@typescript-eslint/utils/ts-eslint").RuleModule<"emptyCatchBlock" | "addErrorLogging", [import("./rules/no-error-swallowing").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
37
- 'require-timeout-handling': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingTimeoutHandling" | "addTimeoutCheck", [import("./rules/require-timeout-handling").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
38
- 'no-unbounded-batch-processing': import("@typescript-eslint/utils/ts-eslint").RuleModule<"unboundedBatch" | "addBatchLimit", [import("./rules/no-unbounded-batch-processing").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
39
- 'no-user-controlled-requests': import("@typescript-eslint/utils/ts-eslint").RuleModule<"ssrfVulnerability" | "useAllowlist", [import("./rules/no-user-controlled-requests").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
40
- 'no-exposed-error-details': import("@typescript-eslint/utils/ts-eslint").RuleModule<"exposedErrorDetails" | "sanitizeError", [import("./rules/no-exposed-error-details").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
41
- };
42
- };
43
- };
44
- rules: {
45
- 'lambda-security/no-hardcoded-credentials-sdk': string;
46
- 'lambda-security/no-permissive-cors-response': string;
47
- 'lambda-security/no-permissive-cors-middy': string;
48
- 'lambda-security/no-secrets-in-env': string;
49
- 'lambda-security/no-user-controlled-requests': string;
50
- 'lambda-security/no-overly-permissive-iam-policy': string;
51
- 'lambda-security/no-unvalidated-event-body': string;
52
- 'lambda-security/no-missing-authorization-check': string;
53
- 'lambda-security/no-exposed-error-details': string;
54
- 'lambda-security/no-env-logging': string;
55
- 'lambda-security/no-error-swallowing': string;
56
- 'lambda-security/require-timeout-handling': string;
57
- 'lambda-security/no-unbounded-batch-processing': string;
58
- };
59
- };
60
- strict: {
61
- name: string;
62
- plugins: {
63
- 'lambda-security': {
64
- rules: {
65
- 'no-hardcoded-credentials-sdk': import("@typescript-eslint/utils/ts-eslint").RuleModule<"hardcodedCredentials" | "useCredentialProvider", [import("./rules/no-hardcoded-credentials-sdk").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
66
- 'no-permissive-cors-response': import("@typescript-eslint/utils/ts-eslint").RuleModule<"permissiveCors" | "useSpecificOrigin", [import("./rules/no-permissive-cors-response").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
67
- 'no-permissive-cors-middy': import("@typescript-eslint/utils/ts-eslint").RuleModule<"permissiveCors" | "useSpecificOrigins", [import("./rules/no-permissive-cors-middy").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
68
- 'no-secrets-in-env': import("@typescript-eslint/utils/ts-eslint").RuleModule<"secretsInEnv" | "useSecretsManager", [import("./rules/no-secrets-in-env").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
69
- 'no-env-logging': import("@typescript-eslint/utils/ts-eslint").RuleModule<"envLogging" | "removeEnvLogging", [import("./rules/no-env-logging").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
70
- 'no-unvalidated-event-body': import("@typescript-eslint/utils/ts-eslint").RuleModule<"unvalidatedInput" | "useValidation", [import("./rules/no-unvalidated-event-body").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
71
- 'no-missing-authorization-check': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingAuthCheck" | "addAuthCheck", [import("./rules/no-missing-authorization-check").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
72
- 'no-overly-permissive-iam-policy': import("@typescript-eslint/utils/ts-eslint").RuleModule<"permissivePolicy" | "useLeastPrivilege", [import("./rules/no-overly-permissive-iam-policy").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
73
- 'no-error-swallowing': import("@typescript-eslint/utils/ts-eslint").RuleModule<"emptyCatchBlock" | "addErrorLogging", [import("./rules/no-error-swallowing").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
74
- 'require-timeout-handling': import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingTimeoutHandling" | "addTimeoutCheck", [import("./rules/require-timeout-handling").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
75
- 'no-unbounded-batch-processing': import("@typescript-eslint/utils/ts-eslint").RuleModule<"unboundedBatch" | "addBatchLimit", [import("./rules/no-unbounded-batch-processing").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
76
- 'no-user-controlled-requests': import("@typescript-eslint/utils/ts-eslint").RuleModule<"ssrfVulnerability" | "useAllowlist", [import("./rules/no-user-controlled-requests").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
77
- 'no-exposed-error-details': import("@typescript-eslint/utils/ts-eslint").RuleModule<"exposedErrorDetails" | "sanitizeError", [import("./rules/no-exposed-error-details").Options?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
78
- };
79
- };
80
- };
81
- rules: {
82
- 'lambda-security/no-hardcoded-credentials-sdk': string;
83
- 'lambda-security/no-permissive-cors-response': string;
84
- 'lambda-security/no-permissive-cors-middy': string;
85
- 'lambda-security/no-secrets-in-env': string;
86
- 'lambda-security/no-env-logging': string;
87
- 'lambda-security/no-unvalidated-event-body': string;
88
- 'lambda-security/no-missing-authorization-check': string;
89
- 'lambda-security/no-overly-permissive-iam-policy': string;
90
- 'lambda-security/no-error-swallowing': string;
91
- 'lambda-security/require-timeout-handling': string;
92
- 'lambda-security/no-unbounded-batch-processing': string;
93
- 'lambda-security/no-user-controlled-requests': string;
94
- 'lambda-security/no-exposed-error-details': string;
95
- };
96
- };
97
- };
98
- meta: {
99
- name: string;
100
- version: string;
101
- };
102
- };
103
- export = _default;
6
+ /**
7
+ * eslint-plugin-lambda-security
8
+ * Security-focused ESLint rules for AWS Lambda and Middy applications
9
+ *
10
+ * Detects insecure API Gateway responses, missing security headers,
11
+ * CORS misconfigurations, input validation issues, authorization gaps,
12
+ * SSRF vulnerabilities, and more.
13
+ *
14
+ * OWASP Serverless Top 10 Coverage:
15
+ * - SAS-1: Injection โœ… (no-unvalidated-event-body)
16
+ * - SAS-2: Broken Authentication โœ… (no-hardcoded-credentials-sdk)
17
+ * - SAS-3: Sensitive Data Exposure โœ… (no-env-logging, no-secrets-in-env)
18
+ * - SAS-4: Security Misconfiguration โœ… (no-permissive-cors-*)
19
+ * - SAS-5: Broken Access Control โœ… (no-missing-authorization-check, no-overly-permissive-iam-policy)
20
+ * - SAS-6: Insufficient Logging โœ… (no-error-swallowing)
21
+ * - SAS-7: Denial of Service โœ… (require-timeout-handling, no-unbounded-batch-processing)
22
+ * - SAS-8: Server-Side Request Forgery โœ… (no-user-controlled-requests)
23
+ * - SAS-9: Functions Misconfiguration โœ… (no-exposed-error-details)
24
+ * - SAS-10: Improper Crypto โžก๏ธ (Use eslint-plugin-crypto)
25
+ */
26
+ import type { TSESLint } from '@interlace/eslint-devkit';
27
+ export declare const rules: Record<string, TSESLint.RuleModule<string, readonly unknown[]>>;
28
+ export declare const plugin: TSESLint.FlatConfig.Plugin;
29
+ export declare const configs: Record<string, TSESLint.FlatConfig.Config>;
30
+ export default plugin;
package/src/index.js CHANGED
@@ -4,26 +4,8 @@
4
4
  * Licensed under the MIT License. Use of this source code is governed by the
5
5
  * MIT license that can be found in the LICENSE file.
6
6
  */
7
- /**
8
- * eslint-plugin-lambda-security
9
- * Security-focused ESLint rules for AWS Lambda and Middy applications
10
- *
11
- * Detects insecure API Gateway responses, missing security headers,
12
- * CORS misconfigurations, input validation issues, authorization gaps,
13
- * SSRF vulnerabilities, and more.
14
- *
15
- * OWASP Serverless Top 10 Coverage:
16
- * - SAS-1: Injection โœ… (no-unvalidated-event-body)
17
- * - SAS-2: Broken Authentication โœ… (no-hardcoded-credentials-sdk)
18
- * - SAS-3: Sensitive Data Exposure โœ… (no-env-logging, no-secrets-in-env)
19
- * - SAS-4: Security Misconfiguration โœ… (no-permissive-cors-*)
20
- * - SAS-5: Broken Access Control โœ… (no-missing-authorization-check, no-overly-permissive-iam-policy)
21
- * - SAS-6: Insufficient Logging โœ… (no-error-swallowing)
22
- * - SAS-7: Denial of Service โœ… (require-timeout-handling, no-unbounded-batch-processing)
23
- * - SAS-8: Server-Side Request Forgery โœ… (no-user-controlled-requests)
24
- * - SAS-9: Functions Misconfiguration โœ… (no-exposed-error-details)
25
- * - SAS-10: Improper Crypto โžก๏ธ (Use eslint-plugin-crypto)
26
- */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.configs = exports.plugin = exports.rules = void 0;
27
9
  // Original P0 Critical Rules
28
10
  const no_hardcoded_credentials_sdk_1 = require("./rules/no-hardcoded-credentials-sdk");
29
11
  const no_permissive_cors_response_1 = require("./rules/no-permissive-cors-response");
@@ -44,7 +26,8 @@ const no_unbounded_batch_processing_1 = require("./rules/no-unbounded-batch-proc
44
26
  const no_user_controlled_requests_1 = require("./rules/no-user-controlled-requests");
45
27
  // SAS-9: Functions Misconfiguration
46
28
  const no_exposed_error_details_1 = require("./rules/no-exposed-error-details");
47
- const rules = {
29
+ const no_exposed_debug_endpoints_1 = require("./rules/no-exposed-debug-endpoints");
30
+ exports.rules = {
48
31
  // Original rules
49
32
  'no-hardcoded-credentials-sdk': no_hardcoded_credentials_sdk_1.noHardcodedCredentialsSdk,
50
33
  'no-permissive-cors-response': no_permissive_cors_response_1.noPermissiveCorsResponse,
@@ -65,12 +48,19 @@ const rules = {
65
48
  'no-user-controlled-requests': no_user_controlled_requests_1.noUserControlledRequests,
66
49
  // SAS-9: Functions Misconfiguration
67
50
  'no-exposed-error-details': no_exposed_error_details_1.noExposedErrorDetails,
51
+ 'no-exposed-debug-endpoints': no_exposed_debug_endpoints_1.noExposedDebugEndpoints,
52
+ };
53
+ exports.plugin = {
54
+ meta: {
55
+ name: 'eslint-plugin-lambda-security',
56
+ version: '1.1.0',
57
+ },
58
+ rules: exports.rules,
68
59
  };
69
- const configs = {
60
+ exports.configs = {
70
61
  recommended: {
71
- name: 'lambda-security/recommended',
72
62
  plugins: {
73
- 'lambda-security': { rules },
63
+ 'lambda-security': exports.plugin,
74
64
  },
75
65
  rules: {
76
66
  // Critical: Always error
@@ -84,6 +74,7 @@ const configs = {
84
74
  'lambda-security/no-unvalidated-event-body': 'warn',
85
75
  'lambda-security/no-missing-authorization-check': 'warn',
86
76
  'lambda-security/no-exposed-error-details': 'warn',
77
+ 'lambda-security/no-exposed-debug-endpoints': 'error',
87
78
  // Medium: Warn in recommended
88
79
  'lambda-security/no-env-logging': 'warn',
89
80
  'lambda-security/no-error-swallowing': 'warn',
@@ -92,9 +83,8 @@ const configs = {
92
83
  },
93
84
  },
94
85
  strict: {
95
- name: 'lambda-security/strict',
96
86
  plugins: {
97
- 'lambda-security': { rules },
87
+ 'lambda-security': exports.plugin,
98
88
  },
99
89
  rules: {
100
90
  // All rules as errors in strict mode
@@ -111,14 +101,8 @@ const configs = {
111
101
  'lambda-security/no-unbounded-batch-processing': 'error',
112
102
  'lambda-security/no-user-controlled-requests': 'error',
113
103
  'lambda-security/no-exposed-error-details': 'error',
104
+ 'lambda-security/no-exposed-debug-endpoints': 'error',
114
105
  },
115
106
  },
116
107
  };
117
- module.exports = {
118
- rules,
119
- configs,
120
- meta: {
121
- name: 'eslint-plugin-lambda-security',
122
- version: '1.1.0',
123
- },
124
- };
108
+ exports.default = exports.plugin;
@@ -17,5 +17,7 @@ export interface Options {
17
17
  allowInTests?: boolean;
18
18
  }
19
19
  type RuleOptions = [Options?];
20
- export declare const noEnvLogging: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
20
+ export declare const noEnvLogging: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
21
+ name: string;
22
+ };
21
23
  export {};
@@ -20,5 +20,7 @@ export interface Options {
20
20
  allowWithComment?: boolean;
21
21
  }
22
22
  type RuleOptions = [Options?];
23
- export declare const noErrorSwallowing: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
23
+ export declare const noErrorSwallowing: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
+ name: string;
25
+ };
24
26
  export {};
@@ -0,0 +1,14 @@
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
+ export interface Options {
7
+ endpoints?: string[];
8
+ ignoreFiles?: string[];
9
+ }
10
+ type RuleOptions = [Options?];
11
+ export declare const noExposedDebugEndpoints: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
12
+ name: string;
13
+ };
14
+ export {};
@@ -0,0 +1,130 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.noExposedDebugEndpoints = void 0;
9
+ /**
10
+ * @fileoverview Detect debug endpoints without auth in AWS Lambda handlers
11
+ */
12
+ const eslint_devkit_1 = require("@interlace/eslint-devkit");
13
+ const DEFAULT_DEBUG_PATHS = ['/debug', '/__debug__', '/admin', '/_admin', '/test', '/health'];
14
+ exports.noExposedDebugEndpoints = (0, eslint_devkit_1.createRule)({
15
+ name: 'no-exposed-debug-endpoints',
16
+ meta: {
17
+ type: 'problem',
18
+ docs: {
19
+ description: 'Detect debug endpoints without auth in AWS Lambda handlers',
20
+ },
21
+ messages: {
22
+ violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
23
+ icon: eslint_devkit_1.MessageIcons.SECURITY,
24
+ issueName: 'Exposed Debug Endpoint',
25
+ cwe: 'CWE-489',
26
+ description: 'Debug endpoint exposed without authentication',
27
+ severity: 'HIGH',
28
+ fix: 'Remove debug endpoints from production or add authentication',
29
+ documentationLink: 'https://cwe.mitre.org/data/definitions/489.html',
30
+ })
31
+ },
32
+ schema: [
33
+ {
34
+ type: 'object',
35
+ properties: {
36
+ endpoints: {
37
+ type: 'array',
38
+ items: { type: 'string' },
39
+ description: 'Custom list of debug/admin endpoints to flag'
40
+ },
41
+ ignoreFiles: {
42
+ type: 'array',
43
+ items: { type: 'string' },
44
+ description: 'List of files or patterns to ignore'
45
+ }
46
+ },
47
+ additionalProperties: false
48
+ }
49
+ ],
50
+ },
51
+ defaultOptions: [{}],
52
+ create(context) {
53
+ const options = context.options[0] || {};
54
+ const debugPaths = options.endpoints || DEFAULT_DEBUG_PATHS;
55
+ const ignoreFiles = options.ignoreFiles || [];
56
+ const filename = context.filename;
57
+ if (ignoreFiles.some(pattern => filename.includes(pattern))) {
58
+ return {};
59
+ }
60
+ function report(node) {
61
+ context.report({ node, messageId: 'violationDetected' });
62
+ }
63
+ return {
64
+ Property(node) {
65
+ if (node.key.type === 'Identifier' && node.key.name === 'path' &&
66
+ node.value.type === 'Literal' && typeof node.value.value === 'string') {
67
+ const path = node.value.value.toLowerCase();
68
+ if (debugPaths.some(dp => path.includes(dp.toLowerCase()))) {
69
+ // Check if it's inside an 'http' or 'httpApi' block
70
+ let parent = node.parent;
71
+ while (parent) {
72
+ if (parent.type === 'Property' && parent.key.type === 'Identifier' &&
73
+ ['http', 'httpApi'].includes(parent.key.name)) {
74
+ report(node.value);
75
+ return;
76
+ }
77
+ parent = parent.parent;
78
+ }
79
+ }
80
+ }
81
+ },
82
+ BinaryExpression(node) {
83
+ // Detect event.path === '/debug' or event.rawPath.includes('/admin')
84
+ if (node.operator === '===' || node.operator === '==' || node.operator === '!==' || node.operator === '!=') {
85
+ const checkNode = (side) => {
86
+ if (side.type === 'Literal' && typeof side.value === 'string') {
87
+ const val = side.value.toLowerCase();
88
+ if (debugPaths.some(dp => val.includes(dp.toLowerCase()))) {
89
+ // Check if the other side is an event property
90
+ const other = side === node.left ? node.right : node.left;
91
+ if (other.type === 'MemberExpression' &&
92
+ other.object.type === 'Identifier' &&
93
+ (other.object.name === 'event' || other.object.name === 'evt') &&
94
+ other.property.type === 'Identifier' &&
95
+ ['path', 'rawPath', 'resource', 'routeKey'].includes(other.property.name)) {
96
+ report(side);
97
+ }
98
+ }
99
+ }
100
+ };
101
+ checkNode(node.left);
102
+ checkNode(node.right);
103
+ }
104
+ },
105
+ Literal(node) {
106
+ if (typeof node.value === 'string') {
107
+ const path = node.value.toLowerCase();
108
+ if (debugPaths.some(dp => path === dp.toLowerCase())) {
109
+ // Avoid double reporting if it's already in a BinaryExpression path check
110
+ const parent = node.parent;
111
+ if (parent && parent.type === 'BinaryExpression' &&
112
+ (parent.left === node || parent.right === node)) {
113
+ const other = parent.left === node ? parent.right : parent.left;
114
+ if (other.type === 'MemberExpression' &&
115
+ other.object.type === 'Identifier' &&
116
+ (other.object.name === 'event' || other.object.name === 'evt')) {
117
+ return;
118
+ }
119
+ }
120
+ // Avoid double reporting for Serverless config check handled by Property listener
121
+ if (parent && parent.type === 'Property' && parent.key.type === 'Identifier' && parent.key.name === 'path') {
122
+ return;
123
+ }
124
+ report(node);
125
+ }
126
+ }
127
+ },
128
+ };
129
+ },
130
+ });
@@ -18,5 +18,7 @@ export interface Options {
18
18
  allowInTests?: boolean;
19
19
  }
20
20
  type RuleOptions = [Options?];
21
- export declare const noExposedErrorDetails: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
21
+ export declare const noExposedErrorDetails: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
+ name: string;
23
+ };
22
24
  export {};
@@ -18,5 +18,7 @@ export interface Options {
18
18
  allowInTests?: boolean;
19
19
  }
20
20
  type RuleOptions = [Options?];
21
- export declare const noHardcodedCredentialsSdk: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
21
+ export declare const noHardcodedCredentialsSdk: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
+ name: string;
23
+ };
22
24
  export {};
@@ -20,5 +20,7 @@ export interface Options {
20
20
  handlerPatterns?: string[];
21
21
  }
22
22
  type RuleOptions = [Options?];
23
- export declare const noMissingAuthorizationCheck: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
23
+ export declare const noMissingAuthorizationCheck: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
+ name: string;
25
+ };
24
26
  export {};
@@ -18,5 +18,7 @@ export interface Options {
18
18
  allowInTests?: boolean;
19
19
  }
20
20
  type RuleOptions = [Options?];
21
- export declare const noOverlyPermissiveIamPolicy: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
21
+ export declare const noOverlyPermissiveIamPolicy: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
+ name: string;
23
+ };
22
24
  export {};
@@ -18,5 +18,7 @@ export interface Options {
18
18
  allowInTests?: boolean;
19
19
  }
20
20
  type RuleOptions = [Options?];
21
- export declare const noPermissiveCorsMidly: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
21
+ export declare const noPermissiveCorsMidly: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
+ name: string;
23
+ };
22
24
  export {};
@@ -20,5 +20,7 @@ export interface Options {
20
20
  allowedOrigins?: string[];
21
21
  }
22
22
  type RuleOptions = [Options?];
23
- export declare const noPermissiveCorsResponse: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
23
+ export declare const noPermissiveCorsResponse: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
+ name: string;
25
+ };
24
26
  export {};
@@ -20,5 +20,7 @@ export interface Options {
20
20
  additionalPatterns?: string[];
21
21
  }
22
22
  type RuleOptions = [Options?];
23
- export declare const noSecretsInEnv: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
23
+ export declare const noSecretsInEnv: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
+ name: string;
25
+ };
24
26
  export {};
@@ -20,5 +20,7 @@ export interface Options {
20
20
  maxBatchSize?: number;
21
21
  }
22
22
  type RuleOptions = [Options?];
23
- export declare const noUnboundedBatchProcessing: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
23
+ export declare const noUnboundedBatchProcessing: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
+ name: string;
25
+ };
24
26
  export {};
@@ -20,5 +20,7 @@ export interface Options {
20
20
  additionalProperties?: string[];
21
21
  }
22
22
  type RuleOptions = [Options?];
23
- export declare const noUnvalidatedEventBody: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
23
+ export declare const noUnvalidatedEventBody: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
+ name: string;
25
+ };
24
26
  export {};
@@ -18,5 +18,7 @@ export interface Options {
18
18
  allowInTests?: boolean;
19
19
  }
20
20
  type RuleOptions = [Options?];
21
- export declare const noUserControlledRequests: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
21
+ export declare const noUserControlledRequests: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
+ name: string;
23
+ };
22
24
  export {};
@@ -18,5 +18,7 @@ export interface Options {
18
18
  allowInTests?: boolean;
19
19
  }
20
20
  type RuleOptions = [Options?];
21
- export declare const requireTimeoutHandling: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
21
+ export declare const requireTimeoutHandling: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
+ name: string;
23
+ };
22
24
  export {};
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Ofri Peretz
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.