Skip to main content
interlace
Plugin: express-security

eslint-plugin-express-security

Express.js security hardening - cookies, CORS, CSRF, rate limiting, and Helmet

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-express-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-express-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 Comprehensive security rules for Express.js applications, mapping to OWASP Top 10.

  • 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-express-security --save-dev

โš™๏ธ Configuration Presets

PresetDescription
recommendedBalanced security for Express projects (critical as error, others warn)
strictMaximum security enforcement (all rules as errors)
apiHTTP/API security rules only (CORS, CSRF, cookies, rate limiting)
graphqlGraphQL-specific security rules only

๐Ÿ“š Supported Libraries

LibrarynpmDownloadsDetection
expressnpmdownloadsMisconfig, DoS
helmetnpmdownloadsMissing Security Headers
corsnpmdownloadsPermissive CORS
csurfnpmdownloadsMissing CSRF Protection

๐Ÿ“ฆ 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-client-controlled-authorizationCWE-863A01:2021This rule detects access decisions taken on request-supplied role, permission or identity values โ€” the checโ€ฆ๐ŸŸขโš ๏ธ
no-cors-credentials-wildcardCWE-942The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance:๐ŸŸข๐Ÿ’ผ
no-disabled-helmet-protectionsCWE-693A05:2021This rule detects helmet options that switch a shipped security-header default off, leaving a mounted helmeโ€ฆ๐ŸŸข๐Ÿ’ผ
no-error-details-in-responseCWE-209A04:2021Disallow sending caught error objects, stack traces, or spreads of them in HTTP responses.๐ŸŸข๐Ÿ’ผ
no-exposed-debug-endpointsCWE-489A05:2021Identifies potential debug, administration, or testing endpoints that are often left exposed in productionโ€ฆ๐ŸŸข๐Ÿ’ผ
no-express-unsafe-regex-routeCWE-1333This rule detects Regular Expression Denial of Service (ReDoS) vulnerabilities in Express route patterns๐ŸŸข๐Ÿ’ผ
no-graphql-introspection-productionCWE-200This rule detects GraphQL servers with introspection enabled in production๐ŸŸขโš ๏ธ
no-host-header-in-linksCWE-640A07:2021Disallow building absolute URLs (password-reset and verification links) from the Host or X-Forwarded-Host rโ€ฆ๐ŸŸข๐Ÿ’ผ
no-idor-resource-accessCWE-639A01:2021This rule detects a resource fetched by an identifier taken straight from the request inside a handler thatโ€ฆ๐ŸŸขโš ๏ธ
no-insecure-cookie-optionsCWE-614The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance:๐ŸŸข๐Ÿ’ผ
no-missing-cors-checkCWE-346Detects missing CORS validation (wildcard CORS, missing origin check)๐ŸŸข
no-missing-csrf-protectionCWE-352Detects missing CSRF token validation in POST/PUT/DELETE requests๐ŸŸข
no-missing-security-headersCWE-693Detects missing security headers in HTTP responses๐ŸŸข
no-permissive-corsCWE-942Detects overly permissive CORS configurations in Express.js applications๐ŸŸข๐Ÿ’ผ
no-permissive-trust-proxyCWE-348A05:2021This rule detects unconditional 'trust proxy' settings, which make req.ip whatever the caller says it is anโ€ฆ๐ŸŸข๐Ÿ’ผ
no-sensitive-data-in-queryCWE-598A04:2021Disallow reading sensitive-named parameters (password, token, secret, apiKey, ...) from req.query.๐ŸŸขโš ๏ธ
no-static-root-exposureCWE-548A05:2021Disallow express.static() roots that expose the application directory and any serve-index usage๐ŸŸข๐Ÿ’ผ
no-unsafe-csp-directivesCWE-79A03:2021This rule detects Content-Security-Policy directives that hand back the protection the header exists to proโ€ฆ๐ŸŸข๐Ÿ’ผ
no-user-controlled-redirectCWE-601Disallow res.redirect() with values directly from req.query / req.body / req.params๐ŸŸข๐Ÿ’ผ
no-user-controlled-render-localsCWE-73A03:2021Disallow res.render() with locals or view names sourced wholesale from req.body / req.query / req.params๐ŸŸข๐Ÿ’ผ
require-case-insensitive-path-guardCWE-178A01:2021This rule detects path-based authorization guards that compare req.path case-sensitively, which case-insensโ€ฆ๐ŸŸขโš ๏ธ
require-csrf-protectionCWE-352The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance:๐ŸŸขโš ๏ธ
require-express-body-parser-limitsCWE-400The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance:๐ŸŸขโš ๏ธ
require-helmetCWE-693This rule detects Express.js applications that are missing the helmet middleware๐ŸŸข๐Ÿ’ผ
require-query-type-guardCWE-843A03:2021This rule detects string methods called on req.query values without a type guard โ€” Express query values canโ€ฆ๐ŸŸขโš ๏ธ
require-rate-limitingCWE-770This rule detects Express.js applications missing rate-limiting middleware๐ŸŸข๐Ÿ’ผ
require-route-authenticationCWE-306A07:2021This rule detects routes that expose a critical function โ€” credentials, accounts, payments, configuration โ€”โ€ฆ๐ŸŸขโš ๏ธ
require-strict-transport-securityCWE-319A02:2021This rule detects HSTS configurations that leave a downgrade window open โ€” the header disabled, a max-age bโ€ฆ๐ŸŸข๐Ÿ’ผ

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-gemini-securitydownloadsGoogle Gemini SDK security.
eslint-plugin-jwt-securitydownloadsToken security.
eslint-plugin-knex-securitydownloadsKnex security.
eslint-plugin-lambda-securitydownloadsAWS Lambda hardening.
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.