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-securityRules (10)
Browse all Express.js 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 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
- To check out the guide, visit eslint.interlace.tools. ๐
npm install eslint-plugin-express-security --save-devโ๏ธ Configuration Presets
| Preset | Description |
|---|---|
recommended | Balanced security for Express projects (critical as error, others warn) |
strict | Maximum security enforcement (all rules as errors) |
api | HTTP/API security rules only (CORS, CSRF, cookies, rate limiting) |
graphql | GraphQL-specific security rules only |
๐ Supported Libraries
| Library | npm | Downloads | Detection |
|---|---|---|---|
express | Misconfig, DoS | ||
helmet | Missing Security Headers | ||
cors | Permissive CORS | ||
csurf | Missing CSRF Protection |
๐ฆ 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-client-controlled-authorization | CWE-863 | A01:2021 | This rule detects access decisions taken on request-supplied role, permission or identity values โ the checโฆ | ๐ข | โ ๏ธ | |||||
| no-cors-credentials-wildcard | CWE-942 | The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance: | ๐ข | ๐ผ | ||||||
| no-disabled-helmet-protections | CWE-693 | A05:2021 | This rule detects helmet options that switch a shipped security-header default off, leaving a mounted helmeโฆ | ๐ข | ๐ผ | |||||
| no-error-details-in-response | CWE-209 | A04:2021 | Disallow sending caught error objects, stack traces, or spreads of them in HTTP responses. | ๐ข | ๐ผ | |||||
| no-exposed-debug-endpoints | CWE-489 | A05:2021 | Identifies potential debug, administration, or testing endpoints that are often left exposed in productionโฆ | ๐ข | ๐ผ | |||||
| no-express-unsafe-regex-route | CWE-1333 | This rule detects Regular Expression Denial of Service (ReDoS) vulnerabilities in Express route patterns | ๐ข | ๐ผ | ||||||
| no-graphql-introspection-production | CWE-200 | This rule detects GraphQL servers with introspection enabled in production | ๐ข | โ ๏ธ | ||||||
| no-host-header-in-links | CWE-640 | A07:2021 | Disallow building absolute URLs (password-reset and verification links) from the Host or X-Forwarded-Host rโฆ | ๐ข | ๐ผ | |||||
| no-idor-resource-access | CWE-639 | A01:2021 | This rule detects a resource fetched by an identifier taken straight from the request inside a handler thatโฆ | ๐ข | โ ๏ธ | |||||
| no-insecure-cookie-options | CWE-614 | The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance: | ๐ข | ๐ผ | ||||||
| no-missing-cors-check | CWE-346 | Detects missing CORS validation (wildcard CORS, missing origin check) | ๐ข | |||||||
| no-missing-csrf-protection | CWE-352 | Detects missing CSRF token validation in POST/PUT/DELETE requests | ๐ข | |||||||
| no-missing-security-headers | CWE-693 | Detects missing security headers in HTTP responses | ๐ข | |||||||
| no-permissive-cors | CWE-942 | Detects overly permissive CORS configurations in Express.js applications | ๐ข | ๐ผ | ||||||
| no-permissive-trust-proxy | CWE-348 | A05:2021 | This rule detects unconditional 'trust proxy' settings, which make req.ip whatever the caller says it is anโฆ | ๐ข | ๐ผ | |||||
| no-sensitive-data-in-query | CWE-598 | A04:2021 | Disallow reading sensitive-named parameters (password, token, secret, apiKey, ...) from req.query. | ๐ข | โ ๏ธ | |||||
| no-static-root-exposure | CWE-548 | A05:2021 | Disallow express.static() roots that expose the application directory and any serve-index usage | ๐ข | ๐ผ | |||||
| no-unsafe-csp-directives | CWE-79 | A03:2021 | This rule detects Content-Security-Policy directives that hand back the protection the header exists to proโฆ | ๐ข | ๐ผ | |||||
| no-user-controlled-redirect | CWE-601 | Disallow res.redirect() with values directly from req.query / req.body / req.params | ๐ข | ๐ผ | ||||||
| no-user-controlled-render-locals | CWE-73 | A03:2021 | Disallow res.render() with locals or view names sourced wholesale from req.body / req.query / req.params | ๐ข | ๐ผ | |||||
| require-case-insensitive-path-guard | CWE-178 | A01:2021 | This rule detects path-based authorization guards that compare req.path case-sensitively, which case-insensโฆ | ๐ข | โ ๏ธ | |||||
| require-csrf-protection | CWE-352 | The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance: | ๐ข | โ ๏ธ | ||||||
| require-express-body-parser-limits | CWE-400 | The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance: | ๐ข | โ ๏ธ | ||||||
| require-helmet | CWE-693 | This rule detects Express.js applications that are missing the helmet middleware | ๐ข | ๐ผ | ||||||
| require-query-type-guard | CWE-843 | A03:2021 | This rule detects string methods called on req.query values without a type guard โ Express query values canโฆ | ๐ข | โ ๏ธ | |||||
| require-rate-limiting | CWE-770 | This rule detects Express.js applications missing rate-limiting middleware | ๐ข | ๐ผ | ||||||
| require-route-authentication | CWE-306 | A07:2021 | This rule detects routes that expose a critical function โ credentials, accounts, payments, configuration โโฆ | ๐ข | โ ๏ธ | |||||
| require-strict-transport-security | CWE-319 | A02:2021 | This rule detects HSTS configurations that leave a downgrade window open โ the header disabled, a max-age bโฆ | ๐ข | ๐ผ |
๐ 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.