eslint-plugin-express-security 1.1.1 โ†’ 1.2.1

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.
package/LICENSE CHANGED
@@ -19,3 +19,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+
package/README.md CHANGED
@@ -16,7 +16,8 @@
16
16
 
17
17
  ## Description
18
18
 
19
- This plugin offers comprehensive security rules tailored for Express.js applications, directly mapping to the OWASP Top 10 vulnerabilities. It proactively identifies security misconfigurations and unsafe coding patterns, helping you harden your server-side code against common attacks. Implementing these rules is an essential step in building secure, production-ready APIs and web services.
19
+ This plugin provides Comprehensive security rules for Express.js applications, mapping to OWASP Top 10.
20
+ By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.
20
21
 
21
22
  ## Philosophy
22
23
 
@@ -24,19 +25,18 @@ This plugin offers comprehensive security rules tailored for Express.js applicat
24
25
 
25
26
  ## Getting Started
26
27
 
27
- - To check out the [guide](https://eslint.interlace.tools/docs/express-security), visit [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
28
- - ่ฆๆŸฅ็œ‹ไธญๆ–‡ [ๆŒ‡ๅ—](https://eslint.interlace.tools/docs/express-security), ่ฏท่ฎฟ้—ฎ [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
29
- - [๊ฐ€์ด๋“œ](https://eslint.interlace.tools/docs/express-security) ๋ฌธ์„œ๋Š” [eslint.interlace.tools](https://eslint.interlace.tools)์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๐Ÿ“š
30
- - [ใ‚ฌใ‚คใƒ‰](https://eslint.interlace.tools/docs/express-security)ใฏ [eslint.interlace.tools](https://eslint.interlace.tools)ใงใ”็ขบ่ชใใ ใ•ใ„ใ€‚ ๐Ÿ“š
31
- - Para ver la [guรญa](https://eslint.interlace.tools/docs/express-security), visita [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
32
- - ู„ู„ุงุทู„ุงุน ุนู„ู‰ [ุงู„ุฏู„ูŠู„](https://eslint.interlace.tools/docs/express-security)ุŒ ู‚ู… ุจุฒูŠุงุฑุฉ [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
28
+ - To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-express-security), visit [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
29
+ - ่ฆๆŸฅ็œ‹ไธญๆ–‡ [ๆŒ‡ๅ—](https://eslint.interlace.tools/docs/security/plugin-express-security), ่ฏท่ฎฟ้—ฎ [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
30
+ - [๊ฐ€์ด๋“œ](https://eslint.interlace.tools/docs/security/plugin-express-security) ๋ฌธ์„œ๋Š” [eslint.interlace.tools](https://eslint.interlace.tools)์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๐Ÿ“š
31
+ - [ใ‚ฌใ‚คใƒ‰](https://eslint.interlace.tools/docs/security/plugin-express-security)ใฏ [eslint.interlace.tools](https://eslint.interlace.tools)ใงใ”็ขบ่ชใใ ใ•ใ„ใ€‚ ๐Ÿ“š
32
+ - Para ver la [guรญa](https://eslint.interlace.tools/docs/security/plugin-express-security), visita [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
33
+ - ู„ู„ุงุทู„ุงุน ุนู„ู‰ [ุงู„ุฏู„ูŠู„](https://eslint.interlace.tools/docs/security/plugin-express-security)ุŒ ู‚ู… ุจุฒูŠุงุฑุฉ [eslint.interlace.tools](https://eslint.interlace.tools). ๐Ÿ“š
33
34
 
34
35
  ```bash
35
36
  npm install eslint-plugin-express-security --save-dev
36
37
  ```
37
38
 
38
39
  ## โš™๏ธ Configuration Presets
39
-
40
40
  | Preset | Description |
41
41
  | :------------ | :---------------------------------------------------------------------- |
42
42
  | `recommended` | Balanced security for Express projects (critical as error, others warn) |
@@ -45,7 +45,6 @@ npm install eslint-plugin-express-security --save-dev
45
45
  | `graphql` | GraphQL-specific security rules only |
46
46
 
47
47
  ## ๐Ÿ“š Supported Libraries
48
-
49
48
  | Library | npm | Downloads | Detection |
50
49
  | :-------- | :---------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------- | :----------------------- |
51
50
  | `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 |
@@ -55,107 +54,53 @@ npm install eslint-plugin-express-security --save-dev
55
54
 
56
55
  ---
57
56
 
58
- ## ๐Ÿข Enterprise Integration Example
59
-
60
- ```javascript
61
- // eslint.config.js
62
- import expressSecurity from 'eslint-plugin-express-security';
63
-
64
- export default [
65
- // Baseline for all Express apps
66
- expressSecurity.configs.recommended,
67
-
68
- // Strict mode for payment/auth services
69
- {
70
- files: ['services/payments/**', 'services/auth/**'],
71
- ...expressSecurity.configs.strict,
72
- },
73
-
74
- // GraphQL security for GraphQL servers
75
- {
76
- files: ['services/graphql/**'],
77
- ...expressSecurity.configs.graphql,
78
- },
79
- ];
80
- ```
81
-
82
- ---
83
-
84
- ## AI-Optimized Messages
85
-
86
- This plugin is optimized for ESLint's [Model Context Protocol (MCP)](https://eslint.org/docs/latest/use/mcp), enabling AI assistants like **Cursor**, **GitHub Copilot**, and **Claude** to:
87
-
88
- - Understand the exact vulnerability type via CWE references
89
- - Apply the correct fix using structured guidance
90
- - Provide educational context to developers
91
-
92
- ```json
93
- // .cursor/mcp.json
94
- {
95
- "mcpServers": {
96
- "eslint": {
97
- "command": "npx",
98
- "args": ["@eslint/mcp@latest"]
99
- }
100
- }
101
- }
102
- ```
103
-
104
- By providing this structured context (CWE, OWASP, Fix), we enable AI tools to **reason** about the security flaw rather than hallucinating. This allows Copilot/Cursor to suggest the _exact_ correct fix immediately.
105
-
106
- ---
107
-
108
- ## ๐Ÿ”’ Privacy
109
-
110
- This plugin runs **100% locally**. No data ever leaves your machine.
111
-
112
- ---
113
-
114
57
  ## Rules
115
58
 
116
59
  **Legend**
117
60
 
118
- | Icon | Description |
119
- | :--: | :----------------------------------------------------------------- |
120
- | ๐Ÿ’ผ | **Recommended**: Included in the recommended preset. |
121
- | โš ๏ธ | **Warns**: Set towarn in recommended preset. |
122
- | ๐Ÿ”ง | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
123
- | ๐Ÿ’ก | **Suggestions**: Providing code suggestions in IDE. |
124
- | ๐Ÿšซ | **Deprecated**: This rule is deprecated. |
125
-
126
- | Rule | CWE | OWASP | CVSS | Description | ๐Ÿ’ผ | โš ๏ธ | ๐Ÿ”ง | ๐Ÿ’ก | ๐Ÿšซ |
127
- | :------------------------------------------------------------------------------------------------------------------------------------ | :------: | :---: | :--: | :-------------------------------------------------------------------------- | :-: | :-: | :-: | :-: | :-: |
128
- | [require-helmet](https://eslint.interlace.tools/docs/express-security/rules/require-helmet) | CWE-693 | | 7.1 | [require-helmet](#require-helmet) | ๐Ÿ’ผ | | | | |
129
- | [no-permissive-cors](https://eslint.interlace.tools/docs/express-security/rules/no-permissive-cors) | CWE-942 | | 9.1 | [no-permissive-cors](#no-permissive-cors) | ๐Ÿ’ผ | | | | |
130
- | [no-cors-credentials-wildcard](https://eslint.interlace.tools/docs/express-security/rules/no-cors-credentials-wildcard) | CWE-942 | | 9.1 | [no-cors-credentials-wildcard](#no-cors-credentials-wildcard) | ๐Ÿ’ผ | | | | |
131
- | [require-express-body-parser-limits](https://eslint.interlace.tools/docs/express-security/rules/require-express-body-parser-limits) | CWE-770 | | 7.5 | [require-express-body-parser-limits](#require-express-body-parser-limits) | ๐Ÿ’ผ | โš ๏ธ | | | |
132
- | [require-csrf-protection](https://eslint.interlace.tools/docs/express-security/rules/require-csrf-protection) | CWE-352 | | 8.8 | [require-csrf-protection](#require-csrf-protection) | ๐Ÿ’ผ | โš ๏ธ | | | |
133
- | [no-insecure-cookie-options](https://eslint.interlace.tools/docs/express-security/rules/no-insecure-cookie-options) | CWE-614 | | 5.3 | [no-insecure-cookie-options](#no-insecure-cookie-options) | ๐Ÿ’ผ | | | | |
134
- | [require-rate-limiting](https://eslint.interlace.tools/docs/express-security/rules/require-rate-limiting) | CWE-770 | | 7.5 | [require-rate-limiting](#require-rate-limiting) | ๐Ÿ’ผ | โš ๏ธ | | | |
135
- | [no-express-unsafe-regex-route](https://eslint.interlace.tools/docs/express-security/rules/no-express-unsafe-regex-route) | CWE-1333 | | 7.5 | [no-express-unsafe-regex-route](#no-express-unsafe-regex-route) | ๐Ÿ’ผ | | | | |
136
- | [no-graphql-introspection-production](https://eslint.interlace.tools/docs/express-security/rules/no-graphql-introspection-production) | CWE-200 | | 5.3 | [no-graphql-introspection-production](#no-graphql-introspection-production) | ๐Ÿ’ผ | โš ๏ธ | | | |
61
+ | Icon | Description |
62
+ | :---: | :--- |
63
+ | ๐Ÿ’ผ | **Recommended**: Included in the recommended preset. |
64
+ | โš ๏ธ | **Warns**: Set towarn in recommended preset. |
65
+ | ๐Ÿ”ง | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
66
+ | ๐Ÿ’ก | **Suggestions**: Providing code suggestions in IDE. |
67
+ | ๐Ÿšซ | **Deprecated**: This rule is deprecated. |
68
+
69
+ | Rule | CWE | OWASP | CVSS | Description | ๐Ÿ’ผ | โš ๏ธ | ๐Ÿ”ง | ๐Ÿ’ก | ๐Ÿšซ |
70
+ | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
71
+ | [no-cors-credentials-wildcard](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-cors-credentials-wildcard) | CWE-942 | | 9.1 | ESLint rule documentation for no-cors-credentials-wildcard | ๐Ÿ’ผ | | | | |
72
+ | [no-exposed-debug-endpoints](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-exposed-debug-endpoints) | | | | ESLint rule documentation for no-exposed-debug-endpoints | | | | | |
73
+ | [no-express-unsafe-regex-route](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-express-unsafe-regex-route) | CWE-1333 | | 7.5 | ESLint rule documentation for no-express-unsafe-regex-route | ๐Ÿ’ผ | | | | |
74
+ | [no-graphql-introspection-production](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-graphql-introspection-production) | CWE-200 | | 5.3 | ESLint rule documentation for no-graphql-introspection-production | ๐Ÿ’ผ | โš ๏ธ | | | |
75
+ | [no-insecure-cookie-options](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-insecure-cookie-options) | CWE-614 | | 5.3 | ESLint rule documentation for no-insecure-cookie-options | ๐Ÿ’ผ | | | | |
76
+ | [no-permissive-cors](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/no-permissive-cors) | CWE-942 | | 9.1 | ESLint rule documentation for no-permissive-cors | ๐Ÿ’ผ | | | | |
77
+ | [require-csrf-protection](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-csrf-protection) | CWE-352 | | 8.8 | ESLint rule documentation for require-csrf-protection | ๐Ÿ’ผ | โš ๏ธ | | | |
78
+ | [require-express-body-parser-limits](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-express-body-parser-limits) | CWE-770 | | 7.5 | ESLint rule documentation for require-express-body-parser-limits | ๐Ÿ’ผ | โš ๏ธ | | | |
79
+ | [require-helmet](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-helmet) | CWE-693 | | 7.1 | ESLint rule documentation for require-helmet | ๐Ÿ’ผ | | | | |
80
+ | [require-rate-limiting](https://eslint.interlace.tools/docs/security/plugin-express-security/rules/require-rate-limiting) | CWE-770 | | 7.5 | ESLint rule documentation for require-rate-limiting | ๐Ÿ’ผ | โš ๏ธ | | | |
137
81
 
138
82
  ## ๐Ÿ”— Related ESLint Plugins
139
83
 
140
84
  Part of the **Interlace ESLint Ecosystem** โ€” AI-native security plugins with LLM-optimized error messages:
141
85
 
142
- | Plugin | Downloads | Description |
143
- | :--------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------ |
144
- | [`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. |
145
- | [`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. |
146
- | [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-crypto.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-crypto) | NodeJS Cryptography security rules. |
147
- | [`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. |
148
- | [`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. |
149
- | [`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 rules. |
150
- | [`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. |
151
- | [`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. |
152
- | [`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. |
153
- | [`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. |
86
+ | Plugin | Downloads | Description |
87
+ | :--- | :---: | :--- |
88
+ | [`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. |
89
+ | [`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. |
90
+ | [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-crypto.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-crypto) | NodeJS Cryptography security rules. |
91
+ | [`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. |
92
+ | [`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. |
93
+ | [`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. |
94
+ | [`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. |
95
+ | [`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. |
96
+ | [`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. |
97
+ | [`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. |
98
+ | [`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. |
154
99
 
155
100
  ## ๐Ÿ“„ License
156
101
 
157
102
  MIT ยฉ [Ofri Peretz](https://github.com/ofri-peretz)
158
103
 
159
104
  <p align="center">
160
- <a href="https://eslint.interlace.tools/docs/express-security"><img src="https://eslint.interlace.tools/images/og-express-security.png" alt="ESLint Interlace Plugin" width="300" /></a>
161
- </p>
105
+ <a href="https://eslint.interlace.tools/docs/security/plugin-express-security"><img src="https://eslint.interlace.tools/images/og-express-security.png" alt="ESLint Interlace Plugin" width="100%" /></a>
106
+ </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-express-security",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
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.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -17,10 +17,10 @@
17
17
  },
18
18
  "author": "Ofri Peretz <ofriperetzdev@gmail.com>",
19
19
  "license": "MIT",
20
- "homepage": "https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-express-security/README.md",
20
+ "homepage": "https://github.com/ofri-peretz/eslint/tree/main/packages/eslint-plugin-express-security#readme",
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "git+https://github.com/ofri-peretz/eslint.git",
23
+ "url": "https://github.com/ofri-peretz/eslint",
24
24
  "directory": "packages/eslint-plugin-express-security"
25
25
  },
26
26
  "bugs": {
@@ -41,6 +41,7 @@
41
41
  "eslint",
42
42
  "eslint-plugin",
43
43
  "eslintplugin",
44
+ "interlace-security",
44
45
  "express",
45
46
  "expressjs",
46
47
  "security",
@@ -62,8 +63,8 @@
62
63
  "node": ">=18.0.0"
63
64
  },
64
65
  "dependencies": {
65
- "@interlace/eslint-devkit": "^1.2.1",
66
- "tslib": "^2.3.0"
66
+ "tslib": "^2.3.0",
67
+ "@interlace/eslint-devkit": "^1.2.1"
67
68
  },
68
69
  "peerDependencies": {},
69
70
  "peerDependenciesMeta": {
package/src/index.js CHANGED
@@ -20,6 +20,7 @@ const no_graphql_introspection_production_1 = require("./rules/no-graphql-intros
20
20
  const no_cors_credentials_wildcard_1 = require("./rules/no-cors-credentials-wildcard");
21
21
  const require_express_body_parser_limits_1 = require("./rules/require-express-body-parser-limits");
22
22
  const no_express_unsafe_regex_route_1 = require("./rules/no-express-unsafe-regex-route");
23
+ const no_exposed_debug_endpoints_1 = require("./rules/no-exposed-debug-endpoints");
23
24
  /**
24
25
  * Collection of all Express security ESLint rules
25
26
  */
@@ -38,6 +39,7 @@ exports.rules = {
38
39
  'no-cors-credentials-wildcard': no_cors_credentials_wildcard_1.noCorsCredentialsWildcard,
39
40
  'require-express-body-parser-limits': require_express_body_parser_limits_1.requireExpressBodyParserLimits,
40
41
  'no-express-unsafe-regex-route': no_express_unsafe_regex_route_1.noExpressUnsafeRegexRoute,
42
+ 'no-exposed-debug-endpoints': no_exposed_debug_endpoints_1.noExposedDebugEndpoints,
41
43
  };
42
44
  /**
43
45
  * ESLint Plugin object
@@ -67,6 +69,7 @@ const recommendedRules = {
67
69
  'express-security/no-cors-credentials-wildcard': 'error',
68
70
  'express-security/require-express-body-parser-limits': 'warn',
69
71
  'express-security/no-express-unsafe-regex-route': 'error',
72
+ 'express-security/no-exposed-debug-endpoints': 'error',
70
73
  };
71
74
  /**
72
75
  * Preset configurations for Express security rules
@@ -20,5 +20,7 @@ export interface Options {
20
20
  allowInTests?: boolean;
21
21
  }
22
22
  type RuleOptions = [Options?];
23
- export declare const noCorsCredentialsWildcard: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
23
+ export declare const noCorsCredentialsWildcard: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
+ name: string;
25
+ };
24
26
  export {};
@@ -0,0 +1,14 @@
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
+ export interface Options {
7
+ endpoints?: string[];
8
+ ignoreFiles?: string[];
9
+ }
10
+ type RuleOptions = [Options?];
11
+ export declare const noExposedDebugEndpoints: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
12
+ name: string;
13
+ };
14
+ export {};
@@ -0,0 +1,97 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.noExposedDebugEndpoints = void 0;
9
+ /**
10
+ * @fileoverview Detect debug endpoints without auth in Express applications
11
+ */
12
+ const eslint_devkit_1 = require("@interlace/eslint-devkit");
13
+ const DEFAULT_DEBUG_PATHS = ['/debug', '/__debug__', '/admin', '/_admin', '/test', '/health'];
14
+ exports.noExposedDebugEndpoints = (0, eslint_devkit_1.createRule)({
15
+ name: 'no-exposed-debug-endpoints',
16
+ meta: {
17
+ type: 'problem',
18
+ docs: {
19
+ description: 'Detect debug endpoints without auth in Express applications',
20
+ },
21
+ messages: {
22
+ violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
23
+ icon: eslint_devkit_1.MessageIcons.SECURITY,
24
+ issueName: 'Exposed Debug Endpoint',
25
+ cwe: 'CWE-489',
26
+ description: 'Debug endpoint exposed without authentication',
27
+ severity: 'HIGH',
28
+ fix: 'Remove debug endpoints from production or add authentication',
29
+ documentationLink: 'https://cwe.mitre.org/data/definitions/489.html',
30
+ })
31
+ },
32
+ schema: [
33
+ {
34
+ type: 'object',
35
+ properties: {
36
+ endpoints: {
37
+ type: 'array',
38
+ items: { type: 'string' },
39
+ description: 'Custom list of debug/admin endpoints to flag'
40
+ },
41
+ ignoreFiles: {
42
+ type: 'array',
43
+ items: { type: 'string' },
44
+ description: 'List of files or patterns to ignore'
45
+ }
46
+ },
47
+ additionalProperties: false
48
+ }
49
+ ],
50
+ },
51
+ defaultOptions: [{}],
52
+ create(context) {
53
+ const options = context.options[0] || {};
54
+ const debugPaths = options.endpoints || DEFAULT_DEBUG_PATHS;
55
+ const ignoreFiles = options.ignoreFiles || [];
56
+ const filename = context.filename;
57
+ // Check if current file should be ignored
58
+ if (ignoreFiles.some(pattern => filename.includes(pattern))) {
59
+ return {};
60
+ }
61
+ function report(node) {
62
+ context.report({ node, messageId: 'violationDetected' });
63
+ }
64
+ const isExpressRouteCall = (node) => {
65
+ return (node.callee.type === 'MemberExpression' &&
66
+ node.callee.object.type === 'Identifier' &&
67
+ ['app', 'router', 'express'].includes(node.callee.object.name) &&
68
+ node.callee.property.type === 'Identifier' &&
69
+ ['get', 'post', 'use'].includes(node.callee.property.name));
70
+ };
71
+ return {
72
+ CallExpression(node) {
73
+ if (isExpressRouteCall(node)) {
74
+ const pathArg = node.arguments[0];
75
+ if (pathArg && pathArg.type === 'Literal' && typeof pathArg.value === 'string') {
76
+ const path = pathArg.value.toLowerCase();
77
+ if (debugPaths.some(dp => path.includes(dp.toLowerCase()))) {
78
+ report(pathArg);
79
+ }
80
+ }
81
+ }
82
+ },
83
+ Literal(node) {
84
+ if (typeof node.value === 'string') {
85
+ const path = node.value.toLowerCase();
86
+ if (debugPaths.some(dp => path === dp.toLowerCase())) {
87
+ const parent = node.parent;
88
+ if (parent && parent.type === 'CallExpression' && isExpressRouteCall(parent) && parent.arguments[0] === node) {
89
+ return;
90
+ }
91
+ report(node);
92
+ }
93
+ }
94
+ },
95
+ };
96
+ },
97
+ });
@@ -21,5 +21,7 @@ export interface Options {
21
21
  allowInTests?: boolean;
22
22
  }
23
23
  type RuleOptions = [Options?];
24
- export declare const noExpressUnsafeRegexRoute: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
24
+ export declare const noExpressUnsafeRegexRoute: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
25
+ name: string;
26
+ };
25
27
  export {};
@@ -20,5 +20,7 @@ export interface Options {
20
20
  allowInDevelopment?: boolean;
21
21
  }
22
22
  type RuleOptions = [Options?];
23
- export declare const noGraphqlIntrospectionProduction: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
23
+ export declare const noGraphqlIntrospectionProduction: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
+ name: string;
25
+ };
24
26
  export {};
@@ -26,5 +26,7 @@ export interface Options {
26
26
  acceptableSameSiteValues?: string[];
27
27
  }
28
28
  type RuleOptions = [Options?];
29
- export declare const noInsecureCookieOptions: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
29
+ export declare const noInsecureCookieOptions: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
30
+ name: string;
31
+ };
30
32
  export {};
@@ -22,5 +22,7 @@ export interface Options {
22
22
  allowedOrigins?: string[];
23
23
  }
24
24
  type RuleOptions = [Options?];
25
- export declare const noPermissiveCors: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
25
+ export declare const noPermissiveCors: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
26
+ name: string;
27
+ };
26
28
  export {};
@@ -22,5 +22,7 @@ export interface Options {
22
22
  ignorePatterns?: string[];
23
23
  }
24
24
  type RuleOptions = [Options?];
25
- export declare const requireCsrfProtection: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
25
+ export declare const requireCsrfProtection: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
26
+ name: string;
27
+ };
26
28
  export {};
@@ -25,5 +25,7 @@ export interface Options {
25
25
  excessiveLimits?: string[];
26
26
  }
27
27
  type RuleOptions = [Options?];
28
- export declare const requireExpressBodyParserLimits: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
28
+ export declare const requireExpressBodyParserLimits: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
29
+ name: string;
30
+ };
29
31
  export {};
@@ -23,5 +23,7 @@ export interface Options {
23
23
  assumeHelmetMiddleware?: boolean;
24
24
  }
25
25
  type RuleOptions = [Options?];
26
- export declare const requireHelmet: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
26
+ export declare const requireHelmet: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
27
+ name: string;
28
+ };
27
29
  export {};
@@ -25,5 +25,7 @@ export interface Options {
25
25
  assumeRateLimiting?: boolean;
26
26
  }
27
27
  type RuleOptions = [Options?];
28
- export declare const requireRateLimiting: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
28
+ export declare const requireRateLimiting: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
29
+ name: string;
30
+ };
29
31
  export {};
package/AGENTS.md DELETED
@@ -1,100 +0,0 @@
1
- # AGENTS.md
2
-
3
- > Context for AI coding agents working on eslint-plugin-express-security
4
-
5
- ## Setup Commands
6
-
7
- ```bash
8
- # Install dependencies (from monorepo root)
9
- pnpm install
10
-
11
- # Build this package
12
- nx build eslint-plugin-express-security
13
-
14
- # Run tests
15
- nx test eslint-plugin-express-security
16
-
17
- # Run tests with coverage
18
- nx test eslint-plugin-express-security --coverage
19
-
20
- # Lint this package
21
- nx lint eslint-plugin-express-security
22
- ```
23
-
24
- ## Code Style
25
-
26
- - TypeScript strict mode with `@interlace/eslint-devkit` types
27
- - Use `AST_NODE_TYPES` constants, never string literals for node types
28
- - Use `formatLLMMessage()` for all rule error messages
29
- - Include CWE, CVSS, OWASP in every security message
30
- - Use `c8 ignore` comments with documented reasons for untestable code
31
- - Single-pass AST traversal patterns (O(n) complexity)
32
- - Detect Express objects through heuristics (variable naming, import analysis)
33
-
34
- ## Testing Instructions
35
-
36
- - Tests use `@typescript-eslint/rule-tester` with Vitest
37
- - Each rule has `index.ts` (implementation) and `*.test.ts` (tests) in same directory
38
- - Run specific rule test: `nx test eslint-plugin-express-security --testPathPattern="require-helmet"`
39
- - Coverage target: โ‰ฅ90% lines, โ‰ฅ95% functions
40
- - All tests must pass before committing
41
-
42
- ## Project Structure
43
-
44
- ```
45
- src/
46
- โ”œโ”€โ”€ index.ts # Plugin entry, exports rules and 4 configs
47
- โ”œโ”€โ”€ types/index.ts # Exported rule option types
48
- โ””โ”€โ”€ rules/ # 9 rule directories
49
- โ””โ”€โ”€ [rule-name]/
50
- โ”œโ”€โ”€ index.ts # Rule implementation
51
- โ””โ”€โ”€ *.test.ts # Rule tests
52
- docs/rules/ # Markdown documentation per rule
53
- ```
54
-
55
- ## Plugin Purpose
56
-
57
- Security-focused ESLint plugin with **9 rules** for Express.js applications. Covers security headers (helmet), CORS misconfigurations, CSRF protection, cookie security, rate limiting, ReDoS prevention, and GraphQL security.
58
-
59
- ## Rule Categories
60
-
61
- | Category | Rules | CWEs |
62
- | ------------------- | ------------------------------------------------------------------------------------------------------------ | ------------- |
63
- | Headers & CORS | `require-helmet`, `no-permissive-cors`, `no-cors-credentials-wildcard`, `require-express-body-parser-limits` | 693, 770, 942 |
64
- | CSRF & Cookies | `require-csrf-protection`, `no-insecure-cookie-options` | 352, 614 |
65
- | Rate Limiting & DoS | `require-rate-limiting`, `no-express-unsafe-regex-route` | 770, 1333 |
66
- | GraphQL | `no-graphql-introspection-production` | 200 |
67
-
68
- ## Common Fix Patterns
69
-
70
- ```typescript
71
- // Helmet
72
- // BAD: const app = express()
73
- // GOOD: const app = express(); app.use(helmet())
74
-
75
- // CORS
76
- // BAD: app.use(cors({ origin: '*' }))
77
- // GOOD: app.use(cors({ origin: ['https://your-app.com'] }))
78
-
79
- // CSRF
80
- // BAD: app.post('/api/transfer', handler)
81
- // GOOD: app.use(csurf({ cookie: true })); app.post('/api/transfer', handler)
82
-
83
- // Cookies
84
- // BAD: res.cookie('session', token)
85
- // GOOD: res.cookie('session', token, { httpOnly: true, secure: true, sameSite: 'strict' })
86
-
87
- // Rate limiting
88
- // BAD: app.post('/api/login', handler)
89
- // GOOD: app.use('/api/', rateLimit({ windowMs: 15*60*1000, max: 100 }))
90
-
91
- // Body parser limits
92
- // BAD: app.use(express.json())
93
- // GOOD: app.use(express.json({ limit: '100kb' }))
94
- ```
95
-
96
- ## Security Considerations
97
-
98
- - All rules map to OWASP Top 10 2021: A01, A03, A05, A07
99
- - CWE coverage: 200, 352, 614, 693, 770, 942, 1333
100
- - Middleware-aware detection: helmet, cors, csurf, express-rate-limit
package/CHANGELOG.md DELETED
@@ -1,57 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to `eslint-plugin-express-security` will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- ### Documentation
11
-
12
- - ๐Ÿ“˜ Launched new documentation site: [eslint.interlace.tools](https://eslint.interlace.tools/)
13
-
14
- ## [1.0.0] - 2025-12-29
15
-
16
- ### Added
17
-
18
- #### Headers & CORS Rules (4)
19
-
20
- - `require-helmet` - Require helmet middleware for security headers (CWE-693)
21
- - `no-permissive-cors` - Detect wildcard CORS origins (CWE-942)
22
- - `no-cors-credentials-wildcard` - Block credentials: true with wildcard origin (CWE-942)
23
- - `require-express-body-parser-limits` - Require body parser size limits (CWE-770)
24
-
25
- #### CSRF & Cookies Rules (2)
26
-
27
- - `require-csrf-protection` - Require CSRF middleware for state-changing routes (CWE-352)
28
- - `no-insecure-cookie-options` - Detect missing Secure/HttpOnly cookie attributes (CWE-614)
29
-
30
- #### Rate Limiting & DoS Rules (2)
31
-
32
- - `require-rate-limiting` - Require rate limiting middleware (CWE-770)
33
- - `no-express-unsafe-regex-route` - Detect ReDoS-vulnerable regex patterns (CWE-1333)
34
-
35
- #### GraphQL Rules (1)
36
-
37
- - `no-graphql-introspection-production` - Disable GraphQL introspection in production (CWE-200)
38
-
39
- #### Presets (4)
40
-
41
- - `recommended` - Balanced security defaults
42
- - `strict` - All 9 rules as errors
43
- - `api` - HTTP/API security rules only
44
- - `graphql` - GraphQL-specific rules only
45
-
46
- #### Features
47
-
48
- - LLM-optimized error messages with CWE references
49
- - OWASP Top 10 2021 alignment (A01, A03, A05, A07)
50
- - Middleware-aware detection (helmet, cors, csurf, express-rate-limit)
51
- - TypeScript support with exported option types
52
- - Comprehensive test coverage (132 tests, 93.15% line coverage)
53
-
54
- ### Security
55
-
56
- - Covers 6 CWEs: 200, 352, 614, 693, 770, 942, 1333
57
- - Maps to OWASP Top 10 2021: A01, A03, A05, A07