eslint-plugin-express-security 1.3.4 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +46 -27
  2. package/package.json +27 -18
  3. package/src/index.d.ts +17 -40
  4. package/src/index.js +47 -62
  5. package/src/oxlint.d.ts +17 -20
  6. package/src/oxlint.js +0 -18
  7. package/src/rules/no-client-controlled-authorization/index.js +194 -0
  8. package/src/rules/no-cors-credentials-wildcard/index.js +0 -22
  9. package/src/rules/no-disabled-helmet-protections/index.js +125 -0
  10. package/src/rules/no-error-details-in-response/index.js +176 -0
  11. package/src/rules/no-exposed-debug-endpoints/index.js +27 -32
  12. package/src/rules/no-express-unsafe-regex-route/index.js +1 -32
  13. package/src/rules/no-graphql-introspection-production/index.js +0 -21
  14. package/src/rules/no-host-header-in-links/index.js +235 -0
  15. package/src/rules/no-idor-resource-access/index.js +126 -0
  16. package/src/rules/no-insecure-cookie-options/index.js +0 -12
  17. package/src/rules/no-missing-cors-check/index.js +4 -54
  18. package/src/rules/no-missing-csrf-protection/index.js +0 -25
  19. package/src/rules/no-missing-security-headers/index.js +50 -69
  20. package/src/rules/no-permissive-cors/index.js +0 -27
  21. package/src/rules/no-permissive-trust-proxy/index.js +106 -0
  22. package/src/rules/no-sensitive-data-in-query/index.js +182 -0
  23. package/src/rules/no-static-root-exposure/index.js +267 -0
  24. package/src/rules/no-unsafe-csp-directives/index.js +264 -0
  25. package/src/rules/no-user-controlled-redirect/index.js +0 -26
  26. package/src/rules/no-user-controlled-render-locals/index.js +268 -0
  27. package/src/rules/require-case-insensitive-path-guard/index.js +180 -0
  28. package/src/rules/require-csrf-protection/index.js +0 -42
  29. package/src/rules/require-express-body-parser-limits/index.js +0 -24
  30. package/src/rules/require-helmet/index.js +1 -25
  31. package/src/rules/require-query-type-guard/index.js +258 -0
  32. package/src/rules/require-rate-limiting/index.js +0 -13
  33. package/src/rules/require-route-authentication/index.js +225 -0
  34. package/src/rules/require-strict-transport-security/index.js +171 -0
  35. package/src/types/index.js +0 -5
  36. package/src/utils/index.js +81 -0
  37. package/AGENTS.md +0 -100
  38. package/CHANGELOG.md +0 -149
  39. package/src/rules/no-cors-credentials-wildcard/index.d.ts +0 -26
  40. package/src/rules/no-exposed-debug-endpoints/index.d.ts +0 -14
  41. package/src/rules/no-express-unsafe-regex-route/index.d.ts +0 -27
  42. package/src/rules/no-graphql-introspection-production/index.d.ts +0 -26
  43. package/src/rules/no-insecure-cookie-options/index.d.ts +0 -39
  44. package/src/rules/no-missing-cors-check/index.d.ts +0 -28
  45. package/src/rules/no-missing-csrf-protection/index.d.ts +0 -30
  46. package/src/rules/no-missing-security-headers/index.d.ts +0 -26
  47. package/src/rules/no-permissive-cors/index.d.ts +0 -28
  48. package/src/rules/no-user-controlled-redirect/index.d.ts +0 -44
  49. package/src/rules/require-csrf-protection/index.d.ts +0 -28
  50. package/src/rules/require-express-body-parser-limits/index.d.ts +0 -31
  51. package/src/rules/require-helmet/index.d.ts +0 -29
  52. package/src/rules/require-rate-limiting/index.d.ts +0 -31
package/README.md CHANGED
@@ -40,6 +40,7 @@ npm install eslint-plugin-express-security --save-dev
40
40
  ```
41
41
 
42
42
  ## ⚙️ Configuration Presets
43
+
43
44
  | Preset | Description |
44
45
  | :------------ | :---------------------------------------------------------------------- |
45
46
  | `recommended` | Balanced security for Express projects (critical as error, others warn) |
@@ -48,6 +49,7 @@ npm install eslint-plugin-express-security --save-dev
48
49
  | `graphql` | GraphQL-specific security rules only |
49
50
 
50
51
  ## 📚 Supported Libraries
52
+
51
53
  | Library | npm | Downloads | Detection |
52
54
  | :-------- | :---------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------- | :----------------------- |
53
55
  | `express` | [![npm](https://img.shields.io/npm/v/express.svg?style=flat-square)](https://www.npmjs.com/package/express) | [![downloads](https://img.shields.io/npm/dt/express.svg?style=flat-square)](https://www.npmjs.com/package/express) | Misconfig, DoS |
@@ -58,10 +60,11 @@ npm install eslint-plugin-express-security --save-dev
58
60
  ---
59
61
 
60
62
  ## 📦 Compatibility
61
- | Package | Version |
62
- | :--- | :--- |
63
- | ESLint | `^8.0.0 \|\| ^9.0.0 \|\| ^10.0.0` |
64
- | Node.js | `>=18.0.0` |
63
+
64
+ | Package | Version |
65
+ | :------ | :-------------------------------- |
66
+ | ESLint | `^8.0.0 \|\| ^9.0.0 \|\| ^10.0.0` |
67
+ | Node.js | `>=18.0.0` |
65
68
 
66
69
  See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md) — current ecosystem share data, the 20% gate, and the forward-looking exception that covers v10.
67
70
 
@@ -69,50 +72,66 @@ See the [ESLint Version Support Policy](../../docs/ESLINT_VERSION_SUPPORT.md)
69
72
 
70
73
  **Legend**
71
74
 
72
- | Icon | Description |
73
- | :---: | :--- |
74
- | 💼 | **Recommended**: Included in the recommended preset. |
75
- | ⚠️ | **Warns**: Set to warn in recommended preset. |
76
- | 🔧 | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
77
- | 💡 | **Suggestions**: Providing code suggestions in IDE. |
78
- | 🚫 | **Deprecated**: This rule is deprecated. |
79
- | 🟢 | **Type-unaware**: AST-only, runs in oxlint JS-plugin tier. |
80
- | 🟡 | **Type-aware (refining)**: pure-AST primary path; types refine precision. |
81
- | 🟠 | **Type-aware (graceful)**: requires TS program; silent without it. |
75
+ | Icon | Description |
76
+ | :--: | :------------------------------------------------------------------------ |
77
+ | 💼 | **Recommended**: Included in the recommended preset. |
78
+ | ⚠️ | **Warns**: Set to warn in recommended preset. |
79
+ | 🔧 | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
80
+ | 💡 | **Suggestions**: Providing code suggestions in IDE. |
81
+ | 🚫 | **Deprecated**: This rule is deprecated. |
82
+ | 🟢 | **Type-unaware**: AST-only, runs in oxlint JS-plugin tier. |
83
+ | 🟡 | **Type-aware (refining)**: pure-AST primary path; types refine precision. |
84
+ | 🟠 | **Type-aware (graceful)**: requires TS program; silent without it. |
82
85
 
83
86
  <!-- AUTO-GENERATED:RULES_TABLE:START - Do not edit manually -->
84
87
  | Rule | CWE | OWASP | CVSS | Description | 🧠 | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
85
88
  | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
89
+ | [no-client-controlled-authorization](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-client-controlled-authorization?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-863 | A01:2021 | | This rule detects access decisions taken on request-supplied role, permission or identity values — the chec… | 🟢 | | | | | |
86
90
  | [no-cors-credentials-wildcard](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-cors-credentials-wildcard?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-942 | | | The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance: | 🟢 | | | | | |
91
+ | [no-disabled-helmet-protections](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-disabled-helmet-protections?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-693 | A05:2021 | | This rule detects helmet options that switch a shipped security-header default off, leaving a mounted helme… | 🟢 | 💼 | | | | |
92
+ | [no-error-details-in-response](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-error-details-in-response?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-209 | A04:2021 | | Disallow sending caught error objects, stack traces, or spreads of them in HTTP responses. | 🟢 | | | | | |
87
93
  | [no-exposed-debug-endpoints](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-exposed-debug-endpoints?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-489 | A05:2021 | | Identifies potential debug, administration, or testing endpoints that are often left exposed in production… | 🟢 | | | | | |
88
94
  | [no-express-unsafe-regex-route](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-express-unsafe-regex-route?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-1333 | | | This rule detects Regular Expression Denial of Service (ReDoS) vulnerabilities in Express route patterns | 🟢 | | | | | |
89
95
  | [no-graphql-introspection-production](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-graphql-introspection-production?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-200 | | | This rule detects GraphQL servers with introspection enabled in production | 🟢 | | | | | |
96
+ | [no-host-header-in-links](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-host-header-in-links?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-640 | A07:2021 | | Disallow building absolute URLs (password-reset and verification links) from the Host or X-Forwarded-Host r… | 🟢 | | | | | |
97
+ | [no-idor-resource-access](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-idor-resource-access?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-639 | A01:2021 | | This rule detects a resource fetched by an identifier taken straight from the request inside a handler that… | 🟢 | | | | | |
90
98
  | [no-insecure-cookie-options](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-insecure-cookie-options?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-614 | | | The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance: | 🟢 | 💼 | | | | |
91
99
  | [no-permissive-cors](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-permissive-cors?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-942 | | | Detects overly permissive CORS configurations in Express.js applications | 🟢 | 💼 | | | | |
100
+ | [no-permissive-trust-proxy](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-permissive-trust-proxy?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-348 | A05:2021 | | This rule detects unconditional 'trust proxy' settings, which make req.ip whatever the caller says it is an… | 🟢 | 💼 | | | | |
101
+ | [no-sensitive-data-in-query](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-sensitive-data-in-query?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-598 | A04:2021 | | Disallow reading sensitive-named parameters (password, token, secret, apiKey, ...) from req.query. | 🟢 | | | | | |
102
+ | [no-static-root-exposure](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-static-root-exposure?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-548 | A05:2021 | | Disallow express.static() roots that expose the application directory and any serve-index usage | 🟢 | | | | | |
103
+ | [no-unsafe-csp-directives](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-unsafe-csp-directives?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-79 | A03:2021 | | This rule detects Content-Security-Policy directives that hand back the protection the header exists to pro… | 🟢 | 💼 | | | | |
104
+ | [no-user-controlled-render-locals](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-user-controlled-render-locals?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-73 | A03:2021 | | Disallow res.render() with locals or view names sourced wholesale from req.body / req.query / req.params | 🟢 | | | | | |
105
+ | [require-case-insensitive-path-guard](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-case-insensitive-path-guard?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-178 | A01:2021 | | This rule detects path-based authorization guards that compare req.path case-sensitively, which case-insens… | 🟢 | | | | | |
92
106
  | [require-csrf-protection](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-csrf-protection?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-352 | | | The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance: | 🟢 | 💼 | | | | |
93
107
  | [require-express-body-parser-limits](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-express-body-parser-limits?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-400 | | | The rule provides LLM-optimized error messages (Compact 2-line format) with actionable security guidance: | 🟢 | | | | | |
94
108
  | [require-helmet](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-helmet?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-693 | | | This rule detects Express.js applications that are missing the helmet middleware | 🟢 | 💼 | | | | |
109
+ | [require-query-type-guard](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-query-type-guard?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-843 | A03:2021 | | This rule detects string methods called on req.query values without a type guard — Express query values can… | 🟢 | | | | | |
95
110
  | [require-rate-limiting](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-rate-limiting?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-770 | | | This rule detects Express.js applications missing rate limiting middleware | 🟢 | 💼 | | | | |
111
+ | [require-route-authentication](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-route-authentication?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-306 | A07:2021 | | This rule detects routes that expose a critical function — credentials, accounts, payments, configuration —… | 🟢 | | | | | |
112
+ | [require-strict-transport-security](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-strict-transport-security?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-express-security) | CWE-319 | A02:2021 | | This rule detects HSTS configurations that leave a downgrade window open — the header disabled, a max-age b… | 🟢 | 💼 | | | | |
96
113
  <!-- AUTO-GENERATED:RULES_TABLE:END -->
114
+
97
115
  ## 🔗 Related ESLint Plugins
98
116
 
99
117
  Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
100
118
 
101
- | Plugin | Downloads | Description |
102
- | :--- | :---: | :--- |
103
- | [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-secure-coding.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-secure-coding) | General security rules & OWASP guidelines. |
104
- | [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-pg.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL security & best practices. |
105
- | [`eslint-plugin-node-security`](https://www.npmjs.com/package/eslint-plugin-node-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-node-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-node-security) | Node.js core-module security (fs, child_process, vm, crypto, Buffer). |
106
- | [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-jwt.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
107
- | [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-browser-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-browser-security) | Browser-specific security & XSS prevention. |
108
- | [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-express-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-express-security) | Express.js security hardening rules. |
109
- | [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-lambda-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-lambda-security) | AWS Lambda security best practices. |
110
- | [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-nestjs-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | NestJS security rules & patterns. |
111
- | [`eslint-plugin-mongodb-security`](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-mongodb-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | MongoDB security best practices. |
112
- | [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-vercel-ai-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security hardening. |
113
- | [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-import-next.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-import-next) | Next-gen import sorting & architecture. |
119
+ | Plugin | Downloads | Description |
120
+ | :--------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------- |
121
+ | [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-secure-coding.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-secure-coding) | General security rules & OWASP guidelines. |
122
+ | [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-pg.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL security & best practices. |
123
+ | [`eslint-plugin-node-security`](https://www.npmjs.com/package/eslint-plugin-node-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-node-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-node-security) | Node.js core-module security (fs, child_process, vm, crypto, Buffer). |
124
+ | [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-jwt.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
125
+ | [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-browser-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-browser-security) | Browser-specific security & XSS prevention. |
126
+ | [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-express-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-express-security) | Express.js security hardening rules. |
127
+ | [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-lambda-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-lambda-security) | AWS Lambda security best practices. |
128
+ | [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-nestjs-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | NestJS security rules & patterns. |
129
+ | [`eslint-plugin-mongodb-security`](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-mongodb-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | MongoDB security best practices. |
130
+ | [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-vercel-ai-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security hardening. |
131
+ | [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-import-next.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-import-next) | Next-gen import sorting & architecture. |
114
132
 
115
133
  <!-- INTERLACE:STAR_CTA:START -->
134
+
116
135
  ## ⭐ Support & follow
117
136
 
118
137
  If this plugin caught a real bug for you, **[star the repo](https://github.com/ofri-peretz/eslint)** — stars are the signal that keeps the Interlace ESLint ecosystem maintained — and **[follow the writeups on Dev.to](https://dev.to/ofri-peretz)** for the benchmarks and security research behind these rules.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-express-security",
3
- "version": "1.3.4",
4
- "description": "Security-focused ESLint plugin for Express.js applications. Detects insecure cookies, missing security headers, CORS misconfigurations, CSRF vulnerabilities, GraphQL security issues, and more.",
3
+ "version": "1.5.0",
4
+ "description": "ESLint plugin for Express.js security — detects permissive CORS, missing CSRF protection, missing helmet headers, insecure cookies, and GraphQL introspection in production.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
7
7
  "types": "./src/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "homepage": "https://eslint.interlace.tools/docs/security/plugin-express-security?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-express-security",
25
25
  "repository": {
26
26
  "type": "git",
27
- "url": "https://github.com/ofri-peretz/eslint",
27
+ "url": "git+https://github.com/ofri-peretz/eslint.git",
28
28
  "directory": "packages/eslint-plugin-express-security"
29
29
  },
30
30
  "bugs": {
@@ -35,40 +35,49 @@
35
35
  },
36
36
  "files": [
37
37
  "src/",
38
- "dist/",
39
38
  "README.md",
40
- "LICENSE",
41
- "CHANGELOG.md",
42
- "AGENTS.md"
39
+ "LICENSE"
43
40
  ],
44
41
  "keywords": [
45
42
  "eslint",
46
- "eslint-plugin",
47
43
  "eslintplugin",
44
+ "eslint-plugin",
45
+ "static-analysis",
46
+ "linting",
47
+ "code-quality",
48
+ "security",
49
+ "sast",
50
+ "appsec",
51
+ "vulnerability",
52
+ "owasp",
53
+ "cwe",
48
54
  "interlace-security",
49
55
  "express",
50
56
  "expressjs",
51
- "security",
52
- "cookies",
53
- "helmet",
57
+ "node",
58
+ "nodejs",
59
+ "web-security",
60
+ "api-security",
54
61
  "cors",
55
62
  "csrf",
63
+ "cwe-352",
64
+ "cookies",
65
+ "helmet",
66
+ "security-headers",
56
67
  "graphql",
57
68
  "rate-limiting",
58
- "headers",
59
- "owasp",
60
- "cwe",
69
+ "redos",
70
+ "open-redirect",
61
71
  "llm-optimized",
62
72
  "ai-assistant",
63
- "typescript",
64
- "static-analysis"
73
+ "typescript"
65
74
  ],
66
75
  "engines": {
67
76
  "node": ">=18.0.0"
68
77
  },
69
78
  "dependencies": {
70
79
  "tslib": "^2.3.0",
71
- "@interlace/eslint-devkit": "^1.4.2"
80
+ "@interlace/eslint-devkit": "^1.6.0"
72
81
  },
73
82
  "peerDependencies": {
74
83
  "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
@@ -102,6 +111,6 @@
102
111
  },
103
112
  "funding": {
104
113
  "type": "github",
105
- "url": "https://github.com/ofri-peretz/eslint"
114
+ "url": "git+https://github.com/ofri-peretz/eslint.git"
106
115
  }
107
116
  }
package/src/index.d.ts CHANGED
@@ -1,40 +1,17 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * eslint-plugin-express-security
8
- *
9
- * A comprehensive security-focused ESLint plugin for Express.js applications
10
- * with rules for detecting and preventing security vulnerabilities.
11
- *
12
- * Features:
13
- * - LLM-optimized error messages with CWE references
14
- * - OWASP Top 10 coverage
15
- * - Express-specific security patterns
16
- * - Framework-aware middleware detection
17
- *
18
- * @see https://github.com/ofri-peretz/eslint#readme
19
- */
20
- import { TSESLint } from '@interlace/eslint-devkit';
21
- /**
22
- * Collection of all Express security ESLint rules
23
- */
24
- export declare const rules: Record<string, TSESLint.RuleModule<string, readonly unknown[]>>;
25
- /**
26
- * ESLint Plugin object
27
- */
28
- export declare const plugin: TSESLint.FlatConfig.Plugin;
29
- /**
30
- * Preset configurations for Express security rules
31
- */
32
- export declare const configs: Record<string, TSESLint.FlatConfig.Config>;
33
- /**
34
- * Default export for ESLint plugin
35
- */
36
- export default plugin;
37
- /**
38
- * Re-export all types from the types barrel
39
- */
40
- export type { RequireHelmetOptions, NoPermissiveCorsOptions, RequireCsrfProtectionOptions, NoInsecureCookieOptions, RequireRateLimitingOptions, NoGraphqlIntrospectionProductionOptions, NoCorsCredentialsWildcardOptions, RequireExpressBodyParserLimitsOptions, NoExpressUnsafeRegexRouteOptions, AllExpressSecurityRulesOptions, } from './types/index';
1
+ // Minimal declaration written by scripts/build-package.ts.
2
+ //
3
+ // tsc's generated entry declaration inlined every inferred rule-option type
4
+ // (up to 166 kB per plugin) for an API no consumer calls directly. This types
5
+ // what a flat config actually touches. Per-rule option types remain available
6
+ // from the "./types" subpath export where a plugin provides one.
7
+ import type { Linter, Rule } from 'eslint';
8
+
9
+ export declare const rules: Record<string, Rule.RuleModule>;
10
+ export declare const configs: Record<string, Linter.Config>;
11
+ export declare const plugin: {
12
+ meta: { name: string; version: string };
13
+ rules: Record<string, Rule.RuleModule>;
14
+ };
15
+
16
+ declare const _default: typeof plugin;
17
+ export default _default;
package/src/index.js CHANGED
@@ -1,114 +1,108 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2025 Ofri Peretz
4
- * Licensed under the MIT License. Use of this source code is governed by the
5
- * MIT license that can be found in the LICENSE file.
6
- */
7
2
  Object.defineProperty(exports, "__esModule", { value: true });
8
3
  exports.configs = exports.plugin = exports.rules = void 0;
9
- // Security rules - Headers & CORS
10
4
  const require_helmet_1 = require("./rules/require-helmet");
11
5
  const no_permissive_cors_1 = require("./rules/no-permissive-cors");
12
- // Security rules - CSRF & Cookies
13
6
  const require_csrf_protection_1 = require("./rules/require-csrf-protection");
14
7
  const no_insecure_cookie_options_1 = require("./rules/no-insecure-cookie-options");
15
- // Security rules - Rate Limiting
16
8
  const require_rate_limiting_1 = require("./rules/require-rate-limiting");
17
- // Security rules - GraphQL
18
9
  const no_graphql_introspection_production_1 = require("./rules/no-graphql-introspection-production");
19
- // Security rules - Critical CORS & DoS
20
10
  const no_cors_credentials_wildcard_1 = require("./rules/no-cors-credentials-wildcard");
21
11
  const require_express_body_parser_limits_1 = require("./rules/require-express-body-parser-limits");
22
12
  const no_express_unsafe_regex_route_1 = require("./rules/no-express-unsafe-regex-route");
23
13
  const no_exposed_debug_endpoints_1 = require("./rules/no-exposed-debug-endpoints");
24
- // Migrated from browser-security — these check server-side Express patterns, not browser APIs
25
14
  const no_missing_cors_check_1 = require("./rules/no-missing-cors-check");
26
15
  const no_missing_csrf_protection_1 = require("./rules/no-missing-csrf-protection");
27
16
  const no_missing_security_headers_1 = require("./rules/no-missing-security-headers");
28
- // Structural redirect safety — structural-api, enforcement-grade
29
17
  const no_user_controlled_redirect_1 = require("./rules/no-user-controlled-redirect");
30
- /**
31
- * Collection of all Express security ESLint rules
32
- */
18
+ const no_host_header_in_links_1 = require("./rules/no-host-header-in-links");
19
+ const no_error_details_in_response_1 = require("./rules/no-error-details-in-response");
20
+ const no_sensitive_data_in_query_1 = require("./rules/no-sensitive-data-in-query");
21
+ const no_user_controlled_render_locals_1 = require("./rules/no-user-controlled-render-locals");
22
+ const no_static_root_exposure_1 = require("./rules/no-static-root-exposure");
23
+ const require_case_insensitive_path_guard_1 = require("./rules/require-case-insensitive-path-guard");
24
+ const require_query_type_guard_1 = require("./rules/require-query-type-guard");
25
+ const no_disabled_helmet_protections_1 = require("./rules/no-disabled-helmet-protections");
26
+ const require_strict_transport_security_1 = require("./rules/require-strict-transport-security");
27
+ const no_unsafe_csp_directives_1 = require("./rules/no-unsafe-csp-directives");
28
+ const no_permissive_trust_proxy_1 = require("./rules/no-permissive-trust-proxy");
29
+ const require_route_authentication_1 = require("./rules/require-route-authentication");
30
+ const no_client_controlled_authorization_1 = require("./rules/no-client-controlled-authorization");
31
+ const no_idor_resource_access_1 = require("./rules/no-idor-resource-access");
33
32
  exports.rules = {
34
- // Headers & CORS
35
33
  'require-helmet': require_helmet_1.requireHelmet,
36
34
  'no-permissive-cors': no_permissive_cors_1.noPermissiveCors,
37
- // CSRF & Cookies
38
35
  'require-csrf-protection': require_csrf_protection_1.requireCsrfProtection,
39
36
  'no-insecure-cookie-options': no_insecure_cookie_options_1.noInsecureCookieOptions,
40
- // Rate Limiting
41
37
  'require-rate-limiting': require_rate_limiting_1.requireRateLimiting,
42
- // GraphQL
43
38
  'no-graphql-introspection-production': no_graphql_introspection_production_1.noGraphqlIntrospectionProduction,
44
- // Critical CORS & DoS (P0)
45
39
  'no-cors-credentials-wildcard': no_cors_credentials_wildcard_1.noCorsCredentialsWildcard,
46
40
  'require-express-body-parser-limits': require_express_body_parser_limits_1.requireExpressBodyParserLimits,
47
41
  'no-express-unsafe-regex-route': no_express_unsafe_regex_route_1.noExpressUnsafeRegexRoute,
48
42
  'no-exposed-debug-endpoints': no_exposed_debug_endpoints_1.noExposedDebugEndpoints,
49
- // Migrated from browser-security (server-side Express checks)
50
43
  'no-missing-cors-check': no_missing_cors_check_1.noMissingCorsCheck,
51
44
  'no-missing-csrf-protection': no_missing_csrf_protection_1.noMissingCsrfProtection,
52
45
  'no-missing-security-headers': no_missing_security_headers_1.noMissingSecurityHeaders,
53
- // Open redirect — structural-api (fires on res.redirect(req.query.*) AST shape)
54
46
  'no-user-controlled-redirect': no_user_controlled_redirect_1.noUserControlledRedirect,
47
+ 'no-host-header-in-links': no_host_header_in_links_1.noHostHeaderInLinks,
48
+ 'no-error-details-in-response': no_error_details_in_response_1.noErrorDetailsInResponse,
49
+ 'no-sensitive-data-in-query': no_sensitive_data_in_query_1.noSensitiveDataInQuery,
50
+ 'no-user-controlled-render-locals': no_user_controlled_render_locals_1.noUserControlledRenderLocals,
51
+ 'no-static-root-exposure': no_static_root_exposure_1.noStaticRootExposure,
52
+ 'require-case-insensitive-path-guard': require_case_insensitive_path_guard_1.requireCaseInsensitivePathGuard,
53
+ 'require-query-type-guard': require_query_type_guard_1.requireQueryTypeGuard,
54
+ 'no-disabled-helmet-protections': no_disabled_helmet_protections_1.noDisabledHelmetProtections,
55
+ 'require-strict-transport-security': require_strict_transport_security_1.requireStrictTransportSecurity,
56
+ 'no-unsafe-csp-directives': no_unsafe_csp_directives_1.noUnsafeCspDirectives,
57
+ 'no-permissive-trust-proxy': no_permissive_trust_proxy_1.noPermissiveTrustProxy,
58
+ 'require-route-authentication': require_route_authentication_1.requireRouteAuthentication,
59
+ 'no-client-controlled-authorization': no_client_controlled_authorization_1.noClientControlledAuthorization,
60
+ 'no-idor-resource-access': no_idor_resource_access_1.noIdorResourceAccess,
55
61
  };
56
- /**
57
- * ESLint Plugin object
58
- */
59
62
  exports.plugin = {
60
63
  meta: {
61
64
  name: 'eslint-plugin-express-security',
62
- version: '1.3.4',
65
+ version: '1.5.0',
63
66
  },
64
67
  rules: exports.rules,
65
68
  };
66
- /**
67
- * Recommended configuration - balanced security enforcement
68
- */
69
69
  const recommendedRules = {
70
- // Critical - Security Headers
71
70
  'express-security/require-helmet': 'error',
72
71
  'express-security/no-permissive-cors': 'error',
73
- // High - CSRF & Cookies
74
72
  'express-security/require-csrf-protection': 'warn',
75
73
  'express-security/no-insecure-cookie-options': 'error',
76
- // High - DDoS Protection
77
74
  'express-security/require-rate-limiting': 'warn',
78
- // Medium - GraphQL
79
75
  'express-security/no-graphql-introspection-production': 'warn',
80
- // Critical - CORS & DoS (P0)
81
76
  'express-security/no-cors-credentials-wildcard': 'error',
82
77
  'express-security/require-express-body-parser-limits': 'warn',
83
78
  'express-security/no-express-unsafe-regex-route': 'error',
84
79
  'express-security/no-exposed-debug-endpoints': 'error',
85
- // Migrated from browser-security
86
80
  'express-security/no-missing-cors-check': 'warn',
87
81
  'express-security/no-missing-csrf-protection': 'warn',
88
82
  'express-security/no-missing-security-headers': 'warn',
89
- // Open redirect — structural, CWE-601
90
83
  'express-security/no-user-controlled-redirect': 'error',
84
+ 'express-security/no-host-header-in-links': 'error',
85
+ 'express-security/no-error-details-in-response': 'error',
86
+ 'express-security/no-sensitive-data-in-query': 'warn',
87
+ 'express-security/no-user-controlled-render-locals': 'error',
88
+ 'express-security/no-static-root-exposure': 'error',
89
+ 'express-security/require-case-insensitive-path-guard': 'warn',
90
+ 'express-security/require-query-type-guard': 'warn',
91
+ 'express-security/no-disabled-helmet-protections': 'error',
92
+ 'express-security/require-strict-transport-security': 'error',
93
+ 'express-security/no-unsafe-csp-directives': 'error',
94
+ 'express-security/no-permissive-trust-proxy': 'error',
95
+ 'express-security/require-route-authentication': 'warn',
96
+ 'express-security/no-client-controlled-authorization': 'warn',
97
+ 'express-security/no-idor-resource-access': 'warn',
91
98
  };
92
- /**
93
- * Preset configurations for Express security rules
94
- */
95
99
  exports.configs = {
96
- /**
97
- * Recommended security configuration
98
- *
99
- * Enables all security rules with sensible severity levels
100
- */
101
100
  recommended: {
102
101
  plugins: {
103
102
  'express-security': exports.plugin,
104
103
  },
105
104
  rules: recommendedRules,
106
105
  },
107
- /**
108
- * Strict security configuration
109
- *
110
- * All security rules set to 'error' for maximum protection
111
- */
112
106
  strict: {
113
107
  plugins: {
114
108
  'express-security': exports.plugin,
@@ -118,28 +112,22 @@ exports.configs = {
118
112
  'error',
119
113
  ])),
120
114
  },
121
- /**
122
- * API security configuration
123
- *
124
- * HTTP/API security rules only
125
- */
126
115
  api: {
127
116
  plugins: {
128
117
  'express-security': exports.plugin,
129
118
  },
130
119
  rules: {
131
120
  'express-security/require-helmet': 'error',
121
+ 'express-security/no-disabled-helmet-protections': 'error',
122
+ 'express-security/require-strict-transport-security': 'error',
123
+ 'express-security/no-unsafe-csp-directives': 'error',
124
+ 'express-security/no-permissive-trust-proxy': 'error',
132
125
  'express-security/no-permissive-cors': 'error',
133
126
  'express-security/require-csrf-protection': 'error',
134
127
  'express-security/no-insecure-cookie-options': 'error',
135
128
  'express-security/require-rate-limiting': 'error',
136
129
  },
137
130
  },
138
- /**
139
- * GraphQL security configuration
140
- *
141
- * GraphQL-specific security rules only
142
- */
143
131
  graphql: {
144
132
  plugins: {
145
133
  'express-security': exports.plugin,
@@ -149,7 +137,4 @@ exports.configs = {
149
137
  },
150
138
  },
151
139
  };
152
- /**
153
- * Default export for ESLint plugin
154
- */
155
140
  exports.default = exports.plugin;
package/src/oxlint.d.ts CHANGED
@@ -1,20 +1,17 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * oxlint sub-export.
8
- *
9
- * Consumers wire oxlint to this entry via:
10
- * { "jsPlugins": ["eslint-plugin-express-security/oxlint"] }
11
- *
12
- * oxlint's JS plugin loader does `require('eslint-plugin-express-security/oxlint')` and reads
13
- * `.rules` off the result. The compiled output of `export = plugin` is
14
- * `module.exports = plugin`, which gives oxlint the plugin object directly
15
- * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
16
- *
17
- * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
18
- */
19
- import { plugin } from './index';
20
- export = plugin;
1
+ // Minimal declaration written by scripts/build-package.ts.
2
+ //
3
+ // tsc's generated entry declaration inlined every inferred rule-option type
4
+ // (up to 166 kB per plugin) for an API no consumer calls directly. This types
5
+ // what a flat config actually touches. Per-rule option types remain available
6
+ // from the "./types" subpath export where a plugin provides one.
7
+ import type { Linter, Rule } from 'eslint';
8
+
9
+ export declare const rules: Record<string, Rule.RuleModule>;
10
+ export declare const configs: Record<string, Linter.Config>;
11
+ export declare const plugin: {
12
+ meta: { name: string; version: string };
13
+ rules: Record<string, Rule.RuleModule>;
14
+ };
15
+
16
+ declare const _default: typeof plugin;
17
+ export default _default;
package/src/oxlint.js CHANGED
@@ -1,21 +1,3 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2025 Ofri Peretz
4
- * Licensed under the MIT License. Use of this source code is governed by the
5
- * MIT license that can be found in the LICENSE file.
6
- */
7
- /**
8
- * oxlint sub-export.
9
- *
10
- * Consumers wire oxlint to this entry via:
11
- * { "jsPlugins": ["eslint-plugin-express-security/oxlint"] }
12
- *
13
- * oxlint's JS plugin loader does `require('eslint-plugin-express-security/oxlint')` and reads
14
- * `.rules` off the result. The compiled output of `export = plugin` is
15
- * `module.exports = plugin`, which gives oxlint the plugin object directly
16
- * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
17
- *
18
- * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
19
- */
20
2
  const index_1 = require("./index");
21
3
  module.exports = index_1.plugin;