Getting Started
npm install --save-dev eslint eslint-plugin-express-security
// eslint.config.mjs
import { configs } from 'eslint-plugin-express-security';
export default [configs.recommended];
recommended is the preset to start with. The others are listed under Configuration Presets below.
Using oxlint or Vite+? Install oxlint-plugin-express-security: the same rules under the same express-security/<rule> IDs, without ESLint. Its page has the setup.
Description
This plugin provides ESLint rules that flag permissive CORS, missing CSRF protection, missing helmet headers and insecure cookies in Express apps.
- 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.
⚙️ 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 |
>=22.13.0 |
See the ESLint Version Support Policy — current ecosystem share data, the 20% gate, and the forward-looking exception that covers v10.
Supported library versions
The library ranges the rules were written against, as previously declared in peerDependencies. They are documentation only: this package installs and requires none of these libraries, and npm no longer warns on a mismatch.
express: ^4.0.0 || ^5.0.0
helmet: ^6.0.0 || ^7.0.0 || ^8.0.0
cors: ^2.0.0
csurf: ^1.0.0
express-rate-limit: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0
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. |