eslint-plugin-express-security 1.0.4 → 1.1.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.
- package/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/README.md +41 -32
- package/package.json +3 -12
- package/src/index.d.ts +5 -0
- package/src/index.js +3 -12
- package/src/rules/no-cors-credentials-wildcard/index.d.ts +20 -1
- package/src/rules/no-cors-credentials-wildcard/index.js +5 -0
- package/src/rules/no-express-unsafe-regex-route/index.d.ts +21 -1
- package/src/rules/no-express-unsafe-regex-route/index.js +5 -0
- package/src/rules/no-graphql-introspection-production/index.d.ts +18 -1
- package/src/rules/no-graphql-introspection-production/index.js +5 -0
- package/src/rules/no-insecure-cookie-options/index.d.ts +18 -1
- package/src/rules/no-insecure-cookie-options/index.js +5 -0
- package/src/rules/no-permissive-cors/index.d.ts +18 -1
- package/src/rules/no-permissive-cors/index.js +5 -0
- package/src/rules/require-csrf-protection/index.d.ts +18 -1
- package/src/rules/require-csrf-protection/index.js +5 -0
- package/src/rules/require-express-body-parser-limits/index.d.ts +21 -1
- package/src/rules/require-express-body-parser-limits/index.js +5 -0
- package/src/rules/require-helmet/index.d.ts +19 -1
- package/src/rules/require-helmet/index.js +5 -0
- package/src/rules/require-rate-limiting/index.d.ts +18 -1
- package/src/rules/require-rate-limiting/index.js +5 -0
- package/src/types/index.d.ts +5 -0
- package/src/types/index.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to `eslint-plugin-express-security` will be documented in th
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Documentation
|
|
11
|
+
|
|
12
|
+
- 📘 Launched new documentation site: [eslint.interlace.tools](https://eslint.interlace.tools/)
|
|
13
|
+
|
|
8
14
|
## [1.0.0] - 2025-12-29
|
|
9
15
|
|
|
10
16
|
### Added
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
# eslint-plugin-express-security
|
|
2
2
|
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img src="https://eslint.interlace.tools/images/og-backend.png" alt="ESLint Interlace - eslint-plugin-express-security" width="100%" />
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
> **📘 Full Documentation:** [https://eslint.interlace.tools/](https://eslint.interlace.tools/)
|
|
8
|
+
>
|
|
3
9
|
> 🔐 Security-focused ESLint plugin for Express.js applications. Detects CORS vulnerabilities, CSRF issues, insecure cookies, missing security headers, and rate limiting gaps with AI-optimized fix guidance.
|
|
4
10
|
|
|
5
11
|
[](https://www.npmjs.com/package/eslint-plugin-express-security)
|
|
6
12
|
[](https://www.npmjs.com/package/eslint-plugin-express-security)
|
|
7
13
|
[](https://opensource.org/licenses/MIT)
|
|
8
14
|
[](https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=express_security)
|
|
15
|
+
[](https://github.com/ofri-peretz/eslint)
|
|
9
16
|
|
|
10
17
|
> **Express-first security:** This plugin provides comprehensive security rules for **Express.js** applications.
|
|
11
18
|
> With **8 security rules** mapped to OWASP Top 10, CWE and CVSS, it transforms your linter into an Express security auditor that AI assistants can understand and fix.
|
|
@@ -42,12 +49,12 @@ src/app.ts
|
|
|
42
49
|
|
|
43
50
|
## 📊 OWASP Top 10 Coverage Matrix
|
|
44
51
|
|
|
45
|
-
| OWASP Category | Coverage |
|
|
46
|
-
|
|
|
47
|
-
| **A01:2021** Access Control |
|
|
48
|
-
| **A03:2021** Injection |
|
|
49
|
-
| **A05:2021** Misconfiguration |
|
|
50
|
-
| **A07:2021** Auth/Session |
|
|
52
|
+
| OWASP Category | Coverage | Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
53
|
+
| :---------------------------- | :------: | :--: | :-: | :---- | :--: | :---------: | :-: | :-: | :-: | --- | --- |
|
|
54
|
+
| **A01:2021** Access Control | | | | | | | | | |
|
|
55
|
+
| **A03:2021** Injection | | | | | | | | | |
|
|
56
|
+
| **A05:2021** Misconfiguration | | | | | | | | | |
|
|
57
|
+
| **A07:2021** Auth/Session | | | | | | | | | |
|
|
51
58
|
|
|
52
59
|
> [!TIP]
|
|
53
60
|
> For **complete OWASP coverage**, combine with [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) which provides 78 additional rules covering all OWASP categories.
|
|
@@ -60,32 +67,32 @@ src/app.ts
|
|
|
60
67
|
|
|
61
68
|
### Headers & CORS (4 rules)
|
|
62
69
|
|
|
63
|
-
| Rule |
|
|
64
|
-
|
|
|
65
|
-
| [require-helmet](#require-helmet) | CWE-693 |
|
|
66
|
-
| [no-permissive-cors](#no-permissive-cors) | CWE-942 |
|
|
67
|
-
| [no-cors-credentials-wildcard](#no-cors-credentials-wildcard) | CWE-942 |
|
|
68
|
-
| [require-express-body-parser-limits](#require-express-body-parser-limits) | CWE-770 |
|
|
70
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
71
|
+
| :------------------------------------------------------------------------ | :-----: | :---: | :--: | :------------------------------------- | :-: | :-: | :-: | :-: | :-: |
|
|
72
|
+
| [require-helmet](#require-helmet) | CWE-693 | A05 | 7.1 | Require helmet() middleware | 💼 | | | | |
|
|
73
|
+
| [no-permissive-cors](#no-permissive-cors) | CWE-942 | A05 | 9.1 | Detect wildcard CORS origins | 💼 | | | | |
|
|
74
|
+
| [no-cors-credentials-wildcard](#no-cors-credentials-wildcard) | CWE-942 | A05 | 9.1 | Block credentials: true + origin: "\*" | 💼 | | | | |
|
|
75
|
+
| [require-express-body-parser-limits](#require-express-body-parser-limits) | CWE-770 | A05 | 7.5 | Require body parser size limits | | ⚠️ | | | |
|
|
69
76
|
|
|
70
77
|
### CSRF & Cookies (2 rules)
|
|
71
78
|
|
|
72
|
-
| Rule |
|
|
73
|
-
|
|
|
74
|
-
| [require-csrf-protection](#require-csrf-protection) | CWE-352 |
|
|
75
|
-
| [no-insecure-cookie-options](#no-insecure-cookie-options) | CWE-614 |
|
|
79
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
80
|
+
| :-------------------------------------------------------- | :-----: | :---: | :--: | :----------------------------- | :-: | :-: | :-: | :-: | :-: |
|
|
81
|
+
| [require-csrf-protection](#require-csrf-protection) | CWE-352 | A07 | 8.8 | Require CSRF middleware | | ⚠️ | | | |
|
|
82
|
+
| [no-insecure-cookie-options](#no-insecure-cookie-options) | CWE-614 | A07 | 5.3 | Detect missing Secure/HttpOnly | 💼 | | | | |
|
|
76
83
|
|
|
77
84
|
### Rate Limiting & DoS (2 rules)
|
|
78
85
|
|
|
79
|
-
| Rule |
|
|
80
|
-
|
|
|
81
|
-
| [require-rate-limiting](#require-rate-limiting) | CWE-770 |
|
|
82
|
-
| [no-express-unsafe-regex-route](#no-express-unsafe-regex-route) | CWE-1333 |
|
|
86
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
87
|
+
| :-------------------------------------------------------------- | :------: | :---: | :--: | :------------------------------- | :-: | :-: | :-: | :-: | :-: |
|
|
88
|
+
| [require-rate-limiting](#require-rate-limiting) | CWE-770 | A05 | 7.5 | Require rate limiting middleware | | ⚠️ | | | |
|
|
89
|
+
| [no-express-unsafe-regex-route](#no-express-unsafe-regex-route) | CWE-1333 | A03 | 7.5 | Detect ReDoS in route patterns | 💼 | | | | |
|
|
83
90
|
|
|
84
91
|
### GraphQL (1 rule)
|
|
85
92
|
|
|
86
|
-
| Rule |
|
|
87
|
-
|
|
|
88
|
-
| [no-graphql-introspection-production](#no-graphql-introspection-production) | CWE-200 |
|
|
93
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
94
|
+
| :-------------------------------------------------------------------------- | :-----: | :---: | :--: | :------------------------------------ | :-: | :-: | :-: | :-: | :-: |
|
|
95
|
+
| [no-graphql-introspection-production](#no-graphql-introspection-production) | CWE-200 | A01 | 5.3 | Disable GraphQL introspection in prod | | ⚠️ | | | |
|
|
89
96
|
|
|
90
97
|
---
|
|
91
98
|
|
|
@@ -401,15 +408,17 @@ This plugin is optimized for ESLint's [Model Context Protocol (MCP)](https://esl
|
|
|
401
408
|
|
|
402
409
|
Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
|
|
403
410
|
|
|
404
|
-
| Plugin |
|
|
405
|
-
|
|
|
406
|
-
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) |
|
|
407
|
-
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) |
|
|
408
|
-
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) |
|
|
409
|
-
| [`eslint-plugin-
|
|
410
|
-
| [`eslint-plugin-
|
|
411
|
-
| [`eslint-plugin-
|
|
412
|
-
| [`eslint-plugin-
|
|
411
|
+
| Plugin | Downloads | Description | Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
412
|
+
| :--------------------------------------------------------------------------------------------------- | :-------: | :---------: | :--: | :-- | :---: | :--: | :---------: | :-: | :-: | --- | --- | --- |
|
|
413
|
+
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | | | | | | | | | |
|
|
414
|
+
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | | | | | | | | | |
|
|
415
|
+
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | | | | | | | | | |
|
|
416
|
+
| [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | | | | | | | | | |
|
|
417
|
+
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | | | | | | | | | |
|
|
418
|
+
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | | | | | | | | | |
|
|
419
|
+
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | | | | | | | | | |
|
|
420
|
+
| [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | | | | | | | | | |
|
|
421
|
+
| [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | | | | | | | | | |
|
|
413
422
|
|
|
414
423
|
---
|
|
415
424
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-express-security",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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",
|
|
@@ -63,9 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@interlace/eslint-devkit": "^1.2.1",
|
|
66
|
-
"tslib": "^2.3.0"
|
|
67
|
-
"vitest": "^4.0.6",
|
|
68
|
-
"@nx/vite": "^22.0.3"
|
|
66
|
+
"tslib": "^2.3.0"
|
|
69
67
|
},
|
|
70
68
|
"peerDependencies": {},
|
|
71
69
|
"peerDependenciesMeta": {
|
|
@@ -85,15 +83,8 @@
|
|
|
85
83
|
"optional": true
|
|
86
84
|
}
|
|
87
85
|
},
|
|
88
|
-
"scripts": {
|
|
89
|
-
"test": "vitest run",
|
|
90
|
-
"test:watch": "vitest watch",
|
|
91
|
-
"test:coverage": "vitest run --coverage"
|
|
92
|
-
},
|
|
93
86
|
"devDependencies": {
|
|
94
87
|
"@typescript-eslint/parser": "^8.46.2",
|
|
95
|
-
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
96
|
-
"@vitest/coverage-v8": "^4.0.6",
|
|
97
|
-
"vitest": "^4.0.6"
|
|
88
|
+
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
98
89
|
}
|
|
99
90
|
}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* with rules for detecting and preventing security vulnerabilities.
|
|
7
|
-
*
|
|
8
|
-
* Features:
|
|
9
|
-
* - LLM-optimized error messages with CWE references
|
|
10
|
-
* - OWASP Top 10 coverage
|
|
11
|
-
* - Express-specific security patterns
|
|
12
|
-
* - Framework-aware middleware detection
|
|
13
|
-
*
|
|
14
|
-
* @see https://github.com/ofri-peretz/eslint#readme
|
|
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.
|
|
15
6
|
*/
|
|
16
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
8
|
exports.configs = exports.plugin = exports.rules = void 0;
|
|
@@ -1,5 +1,24 @@
|
|
|
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 Rule: no-cors-credentials-wildcard
|
|
8
|
+
* Prevents dangerous CORS configurations with credentials: true and wildcard origin
|
|
9
|
+
*
|
|
10
|
+
* CVE-2024-25124 - CVSS 9.1 Critical
|
|
11
|
+
* CWE-942: Permissive Cross-domain Policy with Untrusted Domains
|
|
12
|
+
*
|
|
13
|
+
* @see https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-25124
|
|
14
|
+
* @see https://cwe.mitre.org/data/definitions/942.html
|
|
15
|
+
*/
|
|
16
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
17
|
+
type MessageIds = 'credentialsWildcard' | 'useExplicitOrigins';
|
|
1
18
|
export interface Options {
|
|
2
19
|
/** Allow in test files. Default: false */
|
|
3
20
|
allowInTests?: boolean;
|
|
4
21
|
}
|
|
5
|
-
|
|
22
|
+
type RuleOptions = [Options?];
|
|
23
|
+
export declare const noCorsCredentialsWildcard: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
24
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
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
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.noCorsCredentialsWildcard = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,25 @@
|
|
|
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 Rule: no-express-unsafe-regex-route
|
|
8
|
+
* Detects ReDoS-vulnerable regular expressions in Express.js route patterns
|
|
9
|
+
* CWE-1333: Inefficient Regular Expression Complexity
|
|
10
|
+
*
|
|
11
|
+
* Vulnerable patterns can cause catastrophic backtracking,
|
|
12
|
+
* leading to denial of service via CPU exhaustion.
|
|
13
|
+
*
|
|
14
|
+
* @see https://cwe.mitre.org/data/definitions/1333.html
|
|
15
|
+
* @see https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
|
|
16
|
+
*/
|
|
17
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
18
|
+
type MessageIds = 'unsafeRegexRoute' | 'unsafeParamPattern' | 'refactorRoute';
|
|
1
19
|
export interface Options {
|
|
2
20
|
/** Allow in test files. Default: false */
|
|
3
21
|
allowInTests?: boolean;
|
|
4
22
|
}
|
|
5
|
-
|
|
23
|
+
type RuleOptions = [Options?];
|
|
24
|
+
export declare const noExpressUnsafeRegexRoute: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
25
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
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
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.noExpressUnsafeRegexRoute = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,7 +1,24 @@
|
|
|
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 Rule: no-graphql-introspection-production
|
|
8
|
+
* Detects GraphQL servers with introspection enabled in production
|
|
9
|
+
* CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/200.html
|
|
12
|
+
* @see https://cheatsheetseries.owasp.org/cheatsheets/GraphQL_Cheat_Sheet.html
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'graphqlIntrospection' | 'disableIntrospection';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow introspection in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
/** Allow introspection in development. Default: true */
|
|
5
20
|
allowInDevelopment?: boolean;
|
|
6
21
|
}
|
|
7
|
-
|
|
22
|
+
type RuleOptions = [Options?];
|
|
23
|
+
export declare const noGraphqlIntrospectionProduction: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
24
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
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
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.noGraphqlIntrospectionProduction = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,3 +1,18 @@
|
|
|
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 Rule: no-insecure-cookie-options
|
|
8
|
+
* Detects cookies set without secure flags (httpOnly, secure, sameSite)
|
|
9
|
+
* CWE-614: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/614.html
|
|
12
|
+
* @see https://owasp.org/www-community/controls/SecureCookieAttribute
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'insecureCookie' | 'addSecureFlags';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow insecure cookies in test files. Default: false */
|
|
3
18
|
allowInTests?: boolean;
|
|
@@ -10,4 +25,6 @@ export interface Options {
|
|
|
10
25
|
/** Acceptable sameSite values. Default: ['strict', 'lax'] */
|
|
11
26
|
acceptableSameSiteValues?: string[];
|
|
12
27
|
}
|
|
13
|
-
|
|
28
|
+
type RuleOptions = [Options?];
|
|
29
|
+
export declare const noInsecureCookieOptions: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
30
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
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
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.noInsecureCookieOptions = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,3 +1,18 @@
|
|
|
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 Rule: no-permissive-cors
|
|
8
|
+
* Detects overly permissive CORS configurations in Express.js applications
|
|
9
|
+
* CWE-942: Permissive Cross-domain Policy with Untrusted Domains
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/942.html
|
|
12
|
+
* @see https://owasp.org/www-community/attacks/CORS_OriginHeaderScrutiny
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'permissiveCors' | 'useWhitelist';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow permissive CORS in test files. Default: false */
|
|
3
18
|
allowInTests?: boolean;
|
|
@@ -6,4 +21,6 @@ export interface Options {
|
|
|
6
21
|
/** Allowed origins that should not trigger warnings. Default: [] */
|
|
7
22
|
allowedOrigins?: string[];
|
|
8
23
|
}
|
|
9
|
-
|
|
24
|
+
type RuleOptions = [Options?];
|
|
25
|
+
export declare const noPermissiveCors: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
26
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
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
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.noPermissiveCors = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,3 +1,18 @@
|
|
|
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 Rule: require-csrf-protection
|
|
8
|
+
* Detects Express.js routes handling state-changing requests without CSRF protection
|
|
9
|
+
* CWE-352: Cross-Site Request Forgery (CSRF)
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/352.html
|
|
12
|
+
* @see https://owasp.org/www-community/attacks/csrf
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'missingCsrf' | 'addCsrf';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow missing CSRF in test files. Default: false */
|
|
3
18
|
allowInTests?: boolean;
|
|
@@ -6,4 +21,6 @@ export interface Options {
|
|
|
6
21
|
/** Route patterns to ignore (e.g., /api/webhook). Default: [] */
|
|
7
22
|
ignorePatterns?: string[];
|
|
8
23
|
}
|
|
9
|
-
|
|
24
|
+
type RuleOptions = [Options?];
|
|
25
|
+
export declare const requireCsrfProtection: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
26
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
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
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.requireCsrfProtection = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,3 +1,21 @@
|
|
|
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 Rule: require-express-body-parser-limits
|
|
8
|
+
* Detects Express.js body parsers missing or with excessive size limits
|
|
9
|
+
* CWE-400: Uncontrolled Resource Consumption
|
|
10
|
+
*
|
|
11
|
+
* CVE-2024-45590 highlights DoS vulnerabilities in body-parser.
|
|
12
|
+
* Without size limits, attackers can exhaust server memory.
|
|
13
|
+
*
|
|
14
|
+
* @see https://cwe.mitre.org/data/definitions/400.html
|
|
15
|
+
* @see https://expressjs.com/en/4x/api.html#express.json
|
|
16
|
+
*/
|
|
17
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
18
|
+
type MessageIds = 'missingLimit' | 'excessiveLimit' | 'addLimit';
|
|
1
19
|
export interface Options {
|
|
2
20
|
/** Allow in test files. Default: false */
|
|
3
21
|
allowInTests?: boolean;
|
|
@@ -6,4 +24,6 @@ export interface Options {
|
|
|
6
24
|
/** Limits that are considered excessive (as strings). Default: ['50mb', '100mb', '500mb', '1gb'] */
|
|
7
25
|
excessiveLimits?: string[];
|
|
8
26
|
}
|
|
9
|
-
|
|
27
|
+
type RuleOptions = [Options?];
|
|
28
|
+
export declare const requireExpressBodyParserLimits: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
29
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
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
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.requireExpressBodyParserLimits = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,3 +1,19 @@
|
|
|
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 Rule: require-helmet
|
|
8
|
+
* Detects Express.js applications missing helmet middleware for security headers
|
|
9
|
+
* CWE-693: Protection Mechanism Failure
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/693.html
|
|
12
|
+
* @see https://helmetjs.github.io/
|
|
13
|
+
* @see https://owasp.org/www-project-secure-headers/
|
|
14
|
+
*/
|
|
15
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
16
|
+
type MessageIds = 'missingHelmet' | 'addHelmet';
|
|
1
17
|
export interface Options {
|
|
2
18
|
/** Allow missing helmet in test files. Default: false */
|
|
3
19
|
allowInTests?: boolean;
|
|
@@ -6,4 +22,6 @@ export interface Options {
|
|
|
6
22
|
/** Skip rule if helmet/security headers are provided elsewhere (e.g., reverse proxy). Default: false */
|
|
7
23
|
assumeHelmetMiddleware?: boolean;
|
|
8
24
|
}
|
|
9
|
-
|
|
25
|
+
type RuleOptions = [Options?];
|
|
26
|
+
export declare const requireHelmet: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
27
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
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
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.requireHelmet = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,3 +1,18 @@
|
|
|
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 Rule: require-rate-limiting
|
|
8
|
+
* Detects Express.js applications missing rate limiting middleware
|
|
9
|
+
* CWE-770: Allocation of Resources Without Limits or Throttling
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/770.html
|
|
12
|
+
* @see https://owasp.org/www-community/controls/Blocking_Brute_Force_Attacks
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'missingRateLimiting' | 'addRateLimiting';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow missing rate limiting in test files. Default: false */
|
|
3
18
|
allowInTests?: boolean;
|
|
@@ -9,4 +24,6 @@ export interface Options {
|
|
|
9
24
|
*/
|
|
10
25
|
assumeRateLimiting?: boolean;
|
|
11
26
|
}
|
|
12
|
-
|
|
27
|
+
type RuleOptions = [Options?];
|
|
28
|
+
export declare const requireRateLimiting: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
29
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
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
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.requireRateLimiting = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
package/src/types/index.d.ts
CHANGED
package/src/types/index.js
CHANGED