eslint-plugin-express-security 1.2.0 โ 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 +23 -0
- package/README.md +43 -99
- package/package.json +3 -3
- package/AGENTS.md +0 -100
- package/CHANGELOG.md +0 -57
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
|
package/README.md
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
## Description
|
|
18
18
|
|
|
19
|
-
This plugin
|
|
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` | [](https://www.npmjs.com/package/express) | [](https://www.npmjs.com/package/express) | Misconfig, DoS |
|
|
@@ -55,108 +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
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
125
|
-
|
|
126
|
-
| Rule
|
|
127
|
-
|
|
|
128
|
-
| [
|
|
129
|
-
| [no-
|
|
130
|
-
| [no-
|
|
131
|
-
| [
|
|
132
|
-
| [
|
|
133
|
-
| [no-
|
|
134
|
-
| [require-
|
|
135
|
-
| [
|
|
136
|
-
| [
|
|
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
|
|
143
|
-
|
|
|
144
|
-
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding)
|
|
145
|
-
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg)
|
|
146
|
-
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto)
|
|
147
|
-
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt)
|
|
148
|
-
| [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security)
|
|
149
|
-
| [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security)
|
|
150
|
-
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security)
|
|
151
|
-
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security)
|
|
152
|
-
| [`eslint-plugin-mongodb-security`](https://www.npmjs.com/package/eslint-plugin-mongodb-security)
|
|
153
|
-
| [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security hardening.
|
|
154
|
-
| [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next)
|
|
86
|
+
| Plugin | Downloads | Description |
|
|
87
|
+
| :--- | :---: | :--- |
|
|
88
|
+
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [](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) | [](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL security & best practices. |
|
|
90
|
+
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [](https://www.npmjs.com/package/eslint-plugin-crypto) | NodeJS Cryptography security rules. |
|
|
91
|
+
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [](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) | [](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) | [](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) | [](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) | [](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) | [](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) | [](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) | [](https://www.npmjs.com/package/eslint-plugin-import-next) | Next-gen import sorting & architecture. |
|
|
155
99
|
|
|
156
100
|
## ๐ License
|
|
157
101
|
|
|
158
102
|
MIT ยฉ [Ofri Peretz](https://github.com/ofri-peretz)
|
|
159
103
|
|
|
160
104
|
<p align="center">
|
|
161
|
-
<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="
|
|
162
|
-
</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.2.
|
|
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/
|
|
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": "
|
|
23
|
+
"url": "https://github.com/ofri-peretz/eslint",
|
|
24
24
|
"directory": "packages/eslint-plugin-express-security"
|
|
25
25
|
},
|
|
26
26
|
"bugs": {
|
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
|