JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 164
  • Score
    100M100P100Q78152F
  • License MIT

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.

Package Exports

  • eslint-plugin-lambda-security
  • eslint-plugin-lambda-security/types

Readme

ESLint Interlace Logo

Security best practices for AWS Lambda functions (IAM, timeouts, environment).

NPM Version NPM Downloads Package License Codecov Since Dec 2025

Description

This plugin provides Security best practices for AWS Lambda functions (IAM, timeouts, environment). By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.

Philosophy

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.

Getting Started

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

๐Ÿ’ก 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.

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

โš™๏ธ 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 npm downloads IAM, Logging, Timeouts
@aws-sdk/client-lambda npm downloads Credential Safety
middy npm downloads Middleware Security

โš™๏ธ 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
    }]
  }
}

Rules

Legend

Icon Description
๐Ÿ’ผ Recommended: Included in the recommended preset.
โš ๏ธ Warns: Set towarn in recommended preset.
๐Ÿ”ง Auto-fixable: Automatically fixable by the --fix CLI option.
๐Ÿ’ก Suggestions: Providing code suggestions in IDE.
๐Ÿšซ Deprecated: This rule is deprecated.
Rule CWE OWASP CVSS Description ๐Ÿ’ผ โš ๏ธ ๐Ÿ”ง ๐Ÿ’ก ๐Ÿšซ
no-env-logging CWE-532 7.5 ESLint rule documentation for no-env-logging ๐Ÿ’ผ โš ๏ธ
no-error-swallowing CWE-391 7.5 ESLint rule documentation for no-error-swallowing ๐Ÿ’ผ โš ๏ธ
no-exposed-debug-endpoints ESLint rule documentation for no-exposed-debug-endpoints
no-exposed-error-details CWE-209 7.5 ESLint rule documentation for no-exposed-error-details ๐Ÿ’ผ โš ๏ธ
no-hardcoded-credentials-sdk CWE-798 9.8 ESLint rule documentation for no-hardcoded-credentials-sdk ๐Ÿ’ผ
no-missing-authorization-check CWE-862 7.5 ESLint rule documentation for no-missing-authorization-check ๐Ÿ’ผ โš ๏ธ
no-overly-permissive-iam-policy CWE-732 9.8 ESLint rule documentation for no-overly-permissive-iam-policy ๐Ÿ’ผ
no-permissive-cors-middy CWE-942 9.1 ESLint rule documentation for no-permissive-cors-middy ๐Ÿ’ผ
no-permissive-cors-response CWE-942 9.1 ESLint rule documentation for no-permissive-cors-response ๐Ÿ’ผ ๐Ÿ”ง
no-secrets-in-env CWE-522 9.8 ESLint rule documentation for no-secrets-in-env ๐Ÿ’ผ
no-unbounded-batch-processing CWE-400 7.5 ESLint rule documentation for no-unbounded-batch-processing ๐Ÿ’ผ โš ๏ธ
no-unvalidated-event-body CWE-20 7.5 ESLint rule documentation for no-unvalidated-event-body ๐Ÿ’ผ โš ๏ธ
no-user-controlled-requests CWE-918 9.8 ESLint rule documentation for no-user-controlled-requests ๐Ÿ’ผ
require-timeout-handling CWE-703 7.5 ESLint rule documentation for require-timeout-handling ๐Ÿ’ผ โš ๏ธ

Part of the Interlace ESLint Ecosystem โ€” AI-native security plugins with LLM-optimized error messages:

Plugin Downloads Description
eslint-plugin-secure-coding downloads General security rules & OWASP guidelines.
eslint-plugin-pg downloads PostgreSQL security & best practices.
eslint-plugin-crypto downloads NodeJS Cryptography security rules.
eslint-plugin-jwt downloads JWT security & best practices.
eslint-plugin-browser-security downloads Browser-specific security & XSS prevention.
eslint-plugin-express-security downloads Express.js security hardening rules.
eslint-plugin-lambda-security downloads AWS Lambda security best practices.
eslint-plugin-nestjs-security downloads NestJS security rules & patterns.
eslint-plugin-mongodb-security downloads MongoDB security best practices.
eslint-plugin-vercel-ai-security downloads Vercel AI SDK security hardening.
eslint-plugin-import-next downloads Next-gen import sorting & architecture.

๐Ÿ“„ License

MIT ยฉ Ofri Peretz

ESLint Interlace Plugin