eslint-plugin-lambda-security 3.0.3 → 3.0.5
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 +91 -0
- package/README.md +24 -38
- package/package.json +3 -2
- package/src/index.js +1 -1
package/AGENTS.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<!-- Generated by scripts/generate-plugin-agents-md.ts from package.json and the plugin exports. Do not edit by hand; run `npm run agents-md`. -->
|
|
2
|
+
|
|
3
|
+
# eslint-plugin-lambda-security
|
|
4
|
+
|
|
5
|
+
Guide for AI coding assistants using this plugin in a project. To change the plugin's own source, read https://github.com/ofri-peretz/eslint/blob/main/AGENTS.md instead.
|
|
6
|
+
|
|
7
|
+
> ESLint Lambda security rules for AWS Lambda — detects overly permissive IAM policies and CORS, unvalidated event bodies, secrets in env vars, and leaked error details.
|
|
8
|
+
|
|
9
|
+
## Enable it
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install --save-dev eslint-plugin-lambda-security
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires ESLint ^8.40.0 || ^9.0.0 || ^10.0.0 and Node >=22.13.0.
|
|
16
|
+
|
|
17
|
+
Flat config files (`eslint.config.*`) are found by ESLint 8.57 and newer; on ESLint 9 and 10 they are the default.
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
// eslint.config.mjs
|
|
21
|
+
import lambdaSecurity from 'eslint-plugin-lambda-security';
|
|
22
|
+
|
|
23
|
+
export default [lambdaSecurity.configs.recommended];
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Each preset is one flat config object: put it in the array as an element, do not spread it. Rule ids are prefixed `lambda-security/`. Add it to the config you already have; do not remove other plugins. TypeScript files need a TypeScript parser in the config (`typescript-eslint`).
|
|
27
|
+
|
|
28
|
+
Use it alongside `eslint-plugin-security`, not instead of it: keep that plugin if the project has it. Measured overlap and the limits of both: https://eslint.interlace.tools/docs/getting-started/with-eslint-plugin-security
|
|
29
|
+
|
|
30
|
+
## Presets
|
|
31
|
+
|
|
32
|
+
| Preset | Rules | Errors | Warnings |
|
|
33
|
+
| ------------- | ----- | ------ | -------- |
|
|
34
|
+
| `recommended` | 14 | 7 | 7 |
|
|
35
|
+
| `strict` | 14 | 14 | 0 |
|
|
36
|
+
|
|
37
|
+
### `recommended`
|
|
38
|
+
|
|
39
|
+
14 rules:
|
|
40
|
+
|
|
41
|
+
- `no-hardcoded-credentials-sdk` (error): Detects hardcoded AWS credentials in SDK client configurations.
|
|
42
|
+
- `no-permissive-cors-response` (error): Detects permissive CORS (Access-Control-Allow-Origin: *) in Lambda response headers.
|
|
43
|
+
- `no-permissive-cors-middy` (error): Detects @middy/http-cors middleware with permissive origin (*).
|
|
44
|
+
- `no-secrets-in-env` (error): Detects secrets directly assigned to environment variables.
|
|
45
|
+
- `no-user-controlled-requests` (error): Detects HTTP requests with user-controlled URLs (SSRF vulnerability).
|
|
46
|
+
- `no-overly-permissive-iam-policy` (error): Detects IAM policies with overly broad permissions (wildcards).
|
|
47
|
+
- `no-unvalidated-event-body` (warn): Detects Lambda handlers using event body/params without validation.
|
|
48
|
+
- `no-missing-authorization-check` (warn): Detects Lambda handlers without authorization checks.
|
|
49
|
+
- `no-exposed-error-details` (warn): Detects Lambda handlers exposing internal error details in responses.
|
|
50
|
+
- `no-exposed-debug-endpoints` (error): Detect debug endpoints without auth in AWS Lambda handlers.
|
|
51
|
+
- `no-env-logging` (warn): Detects logging of process.env which may expose secrets.
|
|
52
|
+
- `no-error-swallowing` (warn): Detects empty catch blocks and missing error logging in Lambda handlers.
|
|
53
|
+
- `require-timeout-handling` (warn): Warns when Lambda handlers with external calls lack timeout handling.
|
|
54
|
+
- `no-unbounded-batch-processing` (warn): Detects processing batch records without size validation.
|
|
55
|
+
|
|
56
|
+
### `strict`
|
|
57
|
+
|
|
58
|
+
Same rules as `recommended`.
|
|
59
|
+
|
|
60
|
+
## Other Interlace plugins by dependency
|
|
61
|
+
|
|
62
|
+
If the project also depends on one of these, add the matching plugin the same way:
|
|
63
|
+
|
|
64
|
+
- `express`, `fastify`, `koa`, `@hapi/hapi`, `restify`, `hono`, `next`, `@nestjs/core`, `@nestjs/common`, `aws-lambda`, `@types/aws-lambda`, `@middy/core`, `commander`, `yargs`, `@oclif/core`, `@modelcontextprotocol/*`: `eslint-plugin-node-security`
|
|
65
|
+
- `express`: `eslint-plugin-express-security`
|
|
66
|
+
- `@nestjs/common`, `@nestjs/core`: `eslint-plugin-nestjs-security`
|
|
67
|
+
- `react`, `react-dom`, `preact`, `vue`, `svelte`, `@angular/core`, `solid-js`, `lit`, `next`, `nuxt`: `eslint-plugin-browser-security`
|
|
68
|
+
- `jsonwebtoken`, `jose`, `express-jwt`, `@nestjs/jwt`, `jwks-rsa`, `jwt-decode`: `eslint-plugin-jwt-security`
|
|
69
|
+
- `pg`, `pg-pool`, `pg-promise`, `postgres`, `slonik`: `eslint-plugin-postgresql-security`
|
|
70
|
+
- `mysql2`, `mysql`: `eslint-plugin-mysql-security`
|
|
71
|
+
- `mongodb`, `mongoose`: `eslint-plugin-mongodb-security`
|
|
72
|
+
- `better-sqlite3`, `sqlite3`: `eslint-plugin-sqlite-security`
|
|
73
|
+
- `knex`: `eslint-plugin-knex-security`
|
|
74
|
+
- `@prisma/client`, `prisma`: `eslint-plugin-prisma-security`
|
|
75
|
+
- `drizzle-orm`: `eslint-plugin-drizzle-security`
|
|
76
|
+
- `sequelize`: `eslint-plugin-sequelize-security`
|
|
77
|
+
- `typeorm`: `eslint-plugin-typeorm-security`
|
|
78
|
+
- `@supabase/supabase-js`: `eslint-plugin-supabase-security`
|
|
79
|
+
- `@modelcontextprotocol/*`: `eslint-plugin-mcp-sdk-security`
|
|
80
|
+
- `openai`, `@openai/agents`: `eslint-plugin-openai-security`
|
|
81
|
+
- `@anthropic-ai/sdk`, `@anthropic-ai/claude-agent-sdk`: `eslint-plugin-anthropic-security`
|
|
82
|
+
- `@google/genai`: `eslint-plugin-gemini-security`
|
|
83
|
+
- `ai`: `eslint-plugin-vercel-ai-security`
|
|
84
|
+
|
|
85
|
+
The full stack-to-plugin playbook (with config rendering and a proof step) is the `security-linting` skill: https://github.com/ofri-peretz/eslint/tree/main/skills/security-linting
|
|
86
|
+
|
|
87
|
+
## More
|
|
88
|
+
|
|
89
|
+
- Docs: https://eslint.interlace.tools/docs/security/plugin-lambda-security
|
|
90
|
+
- README.md in this package: every rule with examples.
|
|
91
|
+
- `eslint-plugin-lambda-security/oxlint` is an entry point for oxlint's JS plugin support; see the README.
|
package/README.md
CHANGED
|
@@ -22,7 +22,28 @@
|
|
|
22
22
|
<a href="https://scorecard.dev/viewer/?uri=github.com/ofri-peretz/eslint" target="_blank"><img src="https://api.securityscorecards.dev/projects/github.com/ofri-peretz/eslint/badge" alt="OpenSSF Scorecard" /></a>
|
|
23
23
|
</p>
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
## Getting Started
|
|
26
|
+
|
|
27
|
+
- 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). 📚
|
|
28
|
+
|
|
29
|
+
<!-- AUTO-GENERATED:INSTALL:START - Do not edit manually -->
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install --save-dev eslint eslint-plugin-lambda-security
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
// eslint.config.mjs
|
|
37
|
+
import { configs } from 'eslint-plugin-lambda-security';
|
|
38
|
+
|
|
39
|
+
export default [configs.recommended];
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`recommended` is the preset to start with. The others are listed under Configuration Presets below.
|
|
43
|
+
|
|
44
|
+
Using oxlint or Vite+? Install `oxlint-plugin-lambda-security`: the same rules under the same `lambda-security/<rule>` IDs, without ESLint. Its [page](https://www.npmjs.com/package/oxlint-plugin-lambda-security) has the setup.
|
|
45
|
+
|
|
46
|
+
<!-- AUTO-GENERATED:INSTALL:END -->
|
|
26
47
|
|
|
27
48
|
## Description
|
|
28
49
|
|
|
@@ -44,40 +65,6 @@ That trade costs recall, and we measure it:
|
|
|
44
65
|
|
|
45
66
|
<!-- AUTO-GENERATED:DOCTRINE:END -->
|
|
46
67
|
|
|
47
|
-
## Getting Started
|
|
48
|
-
|
|
49
|
-
- 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). 📚
|
|
50
|
-
|
|
51
|
-
<!-- AUTO-GENERATED:INSTALL:START - Do not edit manually -->
|
|
52
|
-
|
|
53
|
-
**oxlint / Vite+** — the same rules under the same `lambda-security/<rule>` IDs, without ESLint:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm install oxlint-plugin-lambda-security --save-dev
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
```jsonc
|
|
60
|
-
// .oxlintrc.json
|
|
61
|
-
{ "jsPlugins": ["oxlint-plugin-lambda-security"] }
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
```ts
|
|
65
|
-
// vite.config.ts
|
|
66
|
-
import { defineConfig } from 'vite-plus';
|
|
67
|
-
|
|
68
|
-
export default defineConfig({
|
|
69
|
-
lint: { jsPlugins: ['oxlint-plugin-lambda-security'] },
|
|
70
|
-
});
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
**ESLint:**
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
npm install eslint-plugin-lambda-security --save-dev
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
<!-- AUTO-GENERATED:INSTALL:END -->
|
|
80
|
-
|
|
81
68
|
## ⚙️ Configuration Presets
|
|
82
69
|
| Preset | Description |
|
|
83
70
|
| :------------ | :--------------------------------------------------------------------- |
|
|
@@ -226,11 +213,10 @@ Part of the **Interlace ESLint ecosystem** — AI-native rules with LLM-optimize
|
|
|
226
213
|
<!-- AUTO-GENERATED:ECOSYSTEM_TABLE:END -->
|
|
227
214
|
|
|
228
215
|
<!-- INTERLACE:STAR_CTA:START -->
|
|
229
|
-
## ⭐ Support & follow
|
|
230
216
|
|
|
231
|
-
|
|
217
|
+
## Support
|
|
232
218
|
|
|
233
|
-
[
|
|
219
|
+
Found a false positive? [Open an issue](https://github.com/ofri-peretz/eslint/issues): that is a bug. If the plugin helped, a star on [ofri-peretz/eslint](https://github.com/ofri-peretz/eslint) helps others find it.
|
|
234
220
|
|
|
235
221
|
<!-- INTERLACE:STAR_CTA:END -->
|
|
236
222
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-lambda-security",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "ESLint Lambda security rules for AWS Lambda — detects overly permissive IAM policies and CORS, unvalidated event bodies, secrets in env vars, and leaked error details.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"files": [
|
|
34
34
|
"src/",
|
|
35
35
|
"README.md",
|
|
36
|
-
"LICENSE"
|
|
36
|
+
"LICENSE",
|
|
37
|
+
"AGENTS.md"
|
|
37
38
|
],
|
|
38
39
|
"keywords": [
|
|
39
40
|
"eslint",
|
package/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"no-hardcoded-credentials-sdk"(){return require("./rules/no-hardcoded-credentials-sdk").noHardcodedCredentialsSdk},get"no-permissive-cors-response"(){return require("./rules/no-permissive-cors-response").noPermissiveCorsResponse},get"no-permissive-cors-middy"(){return require("./rules/no-permissive-cors-middy").noPermissiveCorsMidly},get"no-secrets-in-env"(){return require("./rules/no-secrets-in-env").noSecretsInEnv},get"no-env-logging"(){return require("./rules/no-env-logging").noEnvLogging},get"no-unvalidated-event-body"(){return require("./rules/no-unvalidated-event-body").noUnvalidatedEventBody},get"no-missing-authorization-check"(){return require("./rules/no-missing-authorization-check").noMissingAuthorizationCheck},get"no-overly-permissive-iam-policy"(){return require("./rules/no-overly-permissive-iam-policy").noOverlyPermissiveIamPolicy},get"no-error-swallowing"(){return require("./rules/no-error-swallowing").noErrorSwallowing},get"require-timeout-handling"(){return require("./rules/require-timeout-handling").requireTimeoutHandling},get"no-unbounded-batch-processing"(){return require("./rules/no-unbounded-batch-processing").noUnboundedBatchProcessing},get"no-user-controlled-requests"(){return require("./rules/no-user-controlled-requests").noUserControlledRequests},get"no-exposed-error-details"(){return require("./rules/no-exposed-error-details").noExposedErrorDetails},get"no-exposed-debug-endpoints"(){return require("./rules/no-exposed-debug-endpoints").noExposedDebugEndpoints}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-lambda-security",exports.rules);exports.plugin={meta:{name:"eslint-plugin-lambda-security",version:"3.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"no-hardcoded-credentials-sdk"(){return require("./rules/no-hardcoded-credentials-sdk").noHardcodedCredentialsSdk},get"no-permissive-cors-response"(){return require("./rules/no-permissive-cors-response").noPermissiveCorsResponse},get"no-permissive-cors-middy"(){return require("./rules/no-permissive-cors-middy").noPermissiveCorsMidly},get"no-secrets-in-env"(){return require("./rules/no-secrets-in-env").noSecretsInEnv},get"no-env-logging"(){return require("./rules/no-env-logging").noEnvLogging},get"no-unvalidated-event-body"(){return require("./rules/no-unvalidated-event-body").noUnvalidatedEventBody},get"no-missing-authorization-check"(){return require("./rules/no-missing-authorization-check").noMissingAuthorizationCheck},get"no-overly-permissive-iam-policy"(){return require("./rules/no-overly-permissive-iam-policy").noOverlyPermissiveIamPolicy},get"no-error-swallowing"(){return require("./rules/no-error-swallowing").noErrorSwallowing},get"require-timeout-handling"(){return require("./rules/require-timeout-handling").requireTimeoutHandling},get"no-unbounded-batch-processing"(){return require("./rules/no-unbounded-batch-processing").noUnboundedBatchProcessing},get"no-user-controlled-requests"(){return require("./rules/no-user-controlled-requests").noUserControlledRequests},get"no-exposed-error-details"(){return require("./rules/no-exposed-error-details").noExposedErrorDetails},get"no-exposed-debug-endpoints"(){return require("./rules/no-exposed-debug-endpoints").noExposedDebugEndpoints}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-lambda-security",exports.rules);exports.plugin={meta:{name:"eslint-plugin-lambda-security",version:"3.0.5"},rules:exports.rules};exports.configs={recommended:{plugins:{"lambda-security":exports.plugin},rules:{"lambda-security/no-hardcoded-credentials-sdk":"error","lambda-security/no-permissive-cors-response":"error","lambda-security/no-permissive-cors-middy":"error","lambda-security/no-secrets-in-env":"error","lambda-security/no-user-controlled-requests":"error","lambda-security/no-overly-permissive-iam-policy":"error","lambda-security/no-unvalidated-event-body":"warn","lambda-security/no-missing-authorization-check":"warn","lambda-security/no-exposed-error-details":"warn","lambda-security/no-exposed-debug-endpoints":"error","lambda-security/no-env-logging":"warn","lambda-security/no-error-swallowing":"warn","lambda-security/require-timeout-handling":"warn","lambda-security/no-unbounded-batch-processing":"warn"}},strict:{plugins:{"lambda-security":exports.plugin},rules:{"lambda-security/no-hardcoded-credentials-sdk":"error","lambda-security/no-permissive-cors-response":"error","lambda-security/no-permissive-cors-middy":"error","lambda-security/no-secrets-in-env":"error","lambda-security/no-env-logging":"error","lambda-security/no-unvalidated-event-body":"error","lambda-security/no-missing-authorization-check":"error","lambda-security/no-overly-permissive-iam-policy":"error","lambda-security/no-error-swallowing":"error","lambda-security/require-timeout-handling":"error","lambda-security/no-unbounded-batch-processing":"error","lambda-security/no-user-controlled-requests":"error","lambda-security/no-exposed-error-details":"error","lambda-security/no-exposed-debug-endpoints":"error"}}};exports.default=exports.plugin;
|