Skip to main content
interlace
Plugin: lambda-security

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-security

Live from GitHub

This content is fetched directly from README.md on GitHub and cached for 1 hour.

Live README from GitHubfrom eslint-plugin-lambda-security/README.md, cached for 1 hour.Edit on GitHub

⭐ 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

npm install eslint-plugin-lambda-security --save-dev

βš™οΈ Configuration Presets

PresetDescription
recommendedBalanced security for Lambda projects (critical as error, others warn)
strictMaximum security enforcement (all rules as errors)

πŸ“š Supported Libraries

LibrarynpmDownloadsDetection
aws-lambdanpmdownloadsIAM, Logging, Timeouts
@aws-sdk/client-lambdanpmdownloadsCredential Safety
middynpmdownloadsMiddleware 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, strict for 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

PackageVersion
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

IconDescription
πŸ’Ό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.
RuleCWEOWASPCVSSDescriptionπŸ§ πŸ’Όβš οΈπŸ”§πŸ’‘πŸš«
no-env-loggingCWE-532A09:2021Detect logging of process.env which may expose secrets🟒⚠️
no-error-swallowingCWE-390A09:2021Detect empty catch blocks and missing error logging🟒⚠️
no-exposed-debug-endpointsCWE-489A05:2021Detect debug endpoints without authentication in Lambda handlersπŸŸ’πŸ’Ό
no-exposed-error-detailsCWE-209A01:2021Detect Lambda handlers exposing internal error details in responses🟒⚠️
no-hardcoded-credentials-sdkCWE-798Detects hardcoded AWS credentials in SDK client configurationsπŸŸ’πŸ’Ό
no-missing-authorization-checkSecurity rule for lambda-security. This rule is part of eslint-plugin-lambda-security and provides LLM-optiβ€¦πŸŸ’βš οΈ
no-overly-permissive-iam-policyCWE-732Security rule for lambda-security. This rule is part of eslint-plugin-lambda-security and provides LLM-optiβ€¦πŸŸ’πŸ’Ό
no-permissive-cors-middyCWE-942Detects permissive CORS configurations in Middy middlewareπŸŸ’πŸ’Ό
no-permissive-cors-responseCWE-942Detects permissive CORS headers in Lambda API Gateway responsesπŸŸ’πŸ’Ό
no-secrets-in-envCWE-798Detects secrets defined directly in environment variable configurationsπŸŸ’πŸ’Ό
no-unbounded-batch-processingCWE-770Detect processing batch records without size validation🟒⚠️
no-unvalidated-event-bodyCWE-20A03:2021Detect Lambda handlers using event body without validation🟒⚠️
no-user-controlled-requestsCWE-918A10:2021Detect HTTP requests with user-controlled URLs (SSRF)πŸŸ’πŸ’Ό
require-timeout-handlingCWE-400Require timeout handling in Lambda handlers with external calls🟒⚠️

Part of the Interlace ESLint ecosystem β€” AI-native rules with LLM-optimized error messages:

Security

PluginDownloadsDescription
eslint-plugin-anthropic-securitydownloadsAnthropic SDK security.
eslint-plugin-browser-securitydownloadsXSS, DOM security.
eslint-plugin-drizzle-securitydownloadsDrizzle security.
eslint-plugin-express-securitydownloadsExpress middleware hardening.
eslint-plugin-gemini-securitydownloadsGoogle Gemini SDK security.
eslint-plugin-jwt-securitydownloadsToken security.
eslint-plugin-knex-securitydownloadsKnex security.
eslint-plugin-mcp-sdk-securitydownloadsMCP SDK security.
eslint-plugin-mongodb-securitydownloadsMongoDB injection.
eslint-plugin-mysql-securitydownloadsMySQL security.
eslint-plugin-nestjs-securitydownloadsNestJS framework hardening.
eslint-plugin-node-securitydownloadsServer-side patterns.
eslint-plugin-openai-securitydownloadsOpenAI SDK security.
eslint-plugin-postgresql-securitydownloadsPostgreSQL security.
eslint-plugin-prisma-securitydownloadsPrisma security.
eslint-plugin-secure-codingdownloadsInjection prevention.
eslint-plugin-sequelize-securitydownloadsSequelize ORM security.
eslint-plugin-sqlite-securitydownloadsSQLite security.
eslint-plugin-supabase-securitydownloadsSupabase security.
eslint-plugin-typeorm-securitydownloadsTypeORM security.
eslint-plugin-vercel-ai-securitydownloadsAI SDK security.

Code quality

PluginDownloadsDescription
eslint-plugin-conventionsdownloadsTeam-specific habits and styles.
eslint-plugin-import-nextdownloadsFast cycle + import-graph analysis.
eslint-plugin-maintainabilitydownloadsCognitive load and clean-code patterns.
eslint-plugin-modernizationdownloadsESNext migration + syntax evolution.
eslint-plugin-modularitydownloadsStructural integrity and DDD patterns.
eslint-plugin-operabilitydownloadsProduction readiness and resource health.
eslint-plugin-react-a11ydownloadsReact accessibility / WCAG.
eslint-plugin-react-featuresdownloadsReact best practices and optimization.
eslint-plugin-reliabilitydownloadsRuntime 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.

GitHub stars

πŸ“„ 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.