eslint-plugin-lambda-security
AWS Lambda and Middy security rules for serverless applications
AI-Optimized Security
Every rule includes CWE, OWASP, and CVSS metadata for AI assistants to provide precise, context-aware fixes.
Install
npm install -D eslint-plugin-lambda-securityRules (14)
Browse all Lambda security rules with CWE/OWASP mapping
Changelog
View version history and updates
Live from GitHub
This content is fetched directly from README.md on GitHub and cached for 1 hour.
β If this plugin caught a real bug for you, star the repo β it's the signal that keeps these rules maintained.
Description
This plugin provides Security best practices for AWS Lambda functions (IAM, timeouts, environment).
- Why β a linter nobody reads protects nothing. We would rather miss a finding than spend your attention on one that was never real.
- How β evidence, not names. A rule fires on what the code does, resolved through the AST and ESLint's own scope analysis.
- What β every finding carries its fix, in prose for a human and as structured JSON for an agent. Security rules add a CWE mapping and, where assigned, a CVSS score.
That trade costs recall, and we measure it: methodology Β· results Β· a false positive is a bug.
Getting Started
- To check out the guide, visit eslint.interlace.tools. π
npm install eslint-plugin-lambda-security --save-devβοΈ Configuration Presets
| Preset | Description |
|---|---|
recommended | Balanced security for Lambda projects (critical as error, others warn) |
strict | Maximum security enforcement (all rules as errors) |
π Supported Libraries
| Library | npm | Downloads | Detection |
|---|---|---|---|
aws-lambda | IAM, Logging, Timeouts | ||
@aws-sdk/client-lambda | Credential Safety | ||
middy | Middleware Security |
π€ AI-Optimized Messages
Every security rule produces a structured 2-line error message:
src/handlers/api.ts
18:5 error π CWE-798 OWASP:SAS-2 CVSS:9.8 | Hardcoded AWS credentials detected | CRITICAL [SOC2,PCI-DSS]
Fix: Use credential provider chain or Lambda execution role | https://owasp.org/...Each message includes:
- π CWE reference - vulnerability classification
- π OWASP category - Serverless Top 10 mapping
- π CVSS score - severity rating (0.0-10.0)
- π’ Compliance tags - affected frameworks (SOC2, PCI-DSS, HIPAA)
- β Fix instruction - exact code to write
- π Documentation link - learn more
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.
π‘ What You Get
- Serverless-focused coverage: 5 rules targeting Lambda-specific vulnerabilities (credentials, CORS, secrets, logging).
- LLM-optimized & MCP-ready: Structured 2-line messages with CWE + OWASP + CVSS + concrete fixes so humans and AI auto-fixers stay aligned.
- Standards aligned: OWASP Serverless Top 10, CWE tagging, CVSS scoring in every finding for compliance mapping.
- Tiered presets:
recommended,strictfor fast policy rollout. - Framework-aware: Detects Middy middleware, API Gateway response patterns, AWS SDK v3 clients.
- Low false positive rate: Context-aware detection with production heuristics.
βοΈ Configuration Options
All rules accept these common options:
{
rules: {
'lambda-security/no-hardcoded-credentials-sdk': ['error', {
allowInTests: true // Default: true - skip test files
}],
'lambda-security/no-secrets-in-env': ['error', {
allowInTests: true,
additionalPatterns: ['CUSTOM_SECRET_*'] // Additional patterns to detect
}]
}
}π¦ Compatibility
| Package | Version |
|---|---|
| ESLint | ^8.40.0 || ^9.0.0 || ^10.0.0 |
| Node.js | >=18.0.0 |
See the ESLint Version Support Policy β current ecosystem share data, the 20% gate, and the forward-looking exception that covers v10.
Rules
Legend
| Icon | Description |
|---|---|
| πΌ | Recommended: Included in the recommended preset. |
| β οΈ | Warns: Set to warn in recommended preset. |
| π§ | Auto-fixable: Automatically fixable by the --fix CLI option. |
| π‘ | Suggestions: Providing code suggestions in IDE. |
| π« | Deprecated: This rule is deprecated. |
| π’ | Type-unaware: AST-only, runs in oxlint JS-plugin tier. |
| π‘ | Type-aware (refining): pure-AST primary path; types refine precision. |
| π | Type-aware (graceful): requires TS program; silent without it. |
| Rule | CWE | OWASP | CVSS | Description | π§ | πΌ | β οΈ | π§ | π‘ | π« |
|---|---|---|---|---|---|---|---|---|---|---|
| no-env-logging | CWE-532 | A09:2021 | Detect logging of process.env which may expose secrets | π’ | β οΈ | |||||
| no-error-swallowing | CWE-390 | A09:2021 | Detect empty catch blocks and missing error logging | π’ | β οΈ | |||||
| no-exposed-debug-endpoints | CWE-489 | A05:2021 | Detect debug endpoints without authentication in Lambda handlers | π’ | πΌ | |||||
| no-exposed-error-details | CWE-209 | A01:2021 | Detect Lambda handlers exposing internal error details in responses | π’ | β οΈ | |||||
| no-hardcoded-credentials-sdk | CWE-798 | Detects hardcoded AWS credentials in SDK client configurations | π’ | πΌ | ||||||
| no-missing-authorization-check | Security rule for lambda-security. This rule is part of eslint-plugin-lambda-security and provides LLM-optiβ¦ | π’ | β οΈ | |||||||
| no-overly-permissive-iam-policy | CWE-732 | Security rule for lambda-security. This rule is part of eslint-plugin-lambda-security and provides LLM-optiβ¦ | π’ | πΌ | ||||||
| no-permissive-cors-middy | CWE-942 | Detects permissive CORS configurations in Middy middleware | π’ | πΌ | ||||||
| no-permissive-cors-response | CWE-942 | Detects permissive CORS headers in Lambda API Gateway responses | π’ | πΌ | ||||||
| no-secrets-in-env | CWE-798 | Detects secrets defined directly in environment variable configurations | π’ | πΌ | ||||||
| no-unbounded-batch-processing | CWE-770 | Detect processing batch records without size validation | π’ | β οΈ | ||||||
| no-unvalidated-event-body | CWE-20 | A03:2021 | Detect Lambda handlers using event body without validation | π’ | β οΈ | |||||
| no-user-controlled-requests | CWE-918 | A10:2021 | Detect HTTP requests with user-controlled URLs (SSRF) | π’ | πΌ | |||||
| require-timeout-handling | CWE-400 | Require timeout handling in Lambda handlers with external calls | π’ | β οΈ |
π Related ESLint Plugins
Part of the Interlace ESLint ecosystem β AI-native rules with LLM-optimized error messages:
Security
Code quality
| Plugin | Downloads | Description |
|---|---|---|
eslint-plugin-conventions | Team-specific habits and styles. | |
eslint-plugin-import-next | Fast cycle + import-graph analysis. | |
eslint-plugin-maintainability | Cognitive load and clean-code patterns. | |
eslint-plugin-modernization | ESNext migration + syntax evolution. | |
eslint-plugin-modularity | Structural integrity and DDD patterns. | |
eslint-plugin-operability | Production readiness and resource health. | |
eslint-plugin-react-a11y | React accessibility / WCAG. | |
eslint-plugin-react-features | React best practices and optimization. | |
eslint-plugin-reliability | Runtime stability and error safety. |
β Support & follow
If this plugin caught a real bug for you, star the repo β stars are the signal that keeps the Interlace ESLint ecosystem maintained β and follow the writeups on Dev.to for the benchmarks and security research behind these rules.
π License
MIT Β© Ofri Peretz
View README.md on GitHub β
Building secure JavaScript with Interlace? Star the repo to get new rules and CWE coverage as we ship them β or follow the AI-code-security benchmarks behind them.