eslint-plugin-express-security 1.0.3 → 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/README.md +40 -34
- package/package.json +1 -1
- 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/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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)
|
|
@@ -43,12 +49,12 @@ src/app.ts
|
|
|
43
49
|
|
|
44
50
|
## 📊 OWASP Top 10 Coverage Matrix
|
|
45
51
|
|
|
46
|
-
| OWASP Category | Coverage |
|
|
47
|
-
|
|
|
48
|
-
| **A01:2021** Access Control |
|
|
49
|
-
| **A03:2021** Injection |
|
|
50
|
-
| **A05:2021** Misconfiguration |
|
|
51
|
-
| **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 | | | | | | | | | |
|
|
52
58
|
|
|
53
59
|
> [!TIP]
|
|
54
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.
|
|
@@ -61,32 +67,32 @@ src/app.ts
|
|
|
61
67
|
|
|
62
68
|
### Headers & CORS (4 rules)
|
|
63
69
|
|
|
64
|
-
| Rule |
|
|
65
|
-
|
|
|
66
|
-
| [require-helmet](#require-helmet) | CWE-693 |
|
|
67
|
-
| [no-permissive-cors](#no-permissive-cors) | CWE-942 |
|
|
68
|
-
| [no-cors-credentials-wildcard](#no-cors-credentials-wildcard) | CWE-942 |
|
|
69
|
-
| [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 | | ⚠️ | | | |
|
|
70
76
|
|
|
71
77
|
### CSRF & Cookies (2 rules)
|
|
72
78
|
|
|
73
|
-
| Rule |
|
|
74
|
-
|
|
|
75
|
-
| [require-csrf-protection](#require-csrf-protection) | CWE-352 |
|
|
76
|
-
| [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 | 💼 | | | | |
|
|
77
83
|
|
|
78
84
|
### Rate Limiting & DoS (2 rules)
|
|
79
85
|
|
|
80
|
-
| Rule |
|
|
81
|
-
|
|
|
82
|
-
| [require-rate-limiting](#require-rate-limiting) | CWE-770 |
|
|
83
|
-
| [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 | 💼 | | | | |
|
|
84
90
|
|
|
85
91
|
### GraphQL (1 rule)
|
|
86
92
|
|
|
87
|
-
| Rule |
|
|
88
|
-
|
|
|
89
|
-
| [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 | | ⚠️ | | | |
|
|
90
96
|
|
|
91
97
|
---
|
|
92
98
|
|
|
@@ -402,17 +408,17 @@ This plugin is optimized for ESLint's [Model Context Protocol (MCP)](https://esl
|
|
|
402
408
|
|
|
403
409
|
Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
|
|
404
410
|
|
|
405
|
-
| Plugin |
|
|
406
|
-
|
|
|
407
|
-
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) |
|
|
408
|
-
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) |
|
|
409
|
-
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) |
|
|
410
|
-
| [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) |
|
|
411
|
-
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) |
|
|
412
|
-
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) |
|
|
413
|
-
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) |
|
|
414
|
-
| [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) |
|
|
415
|
-
| [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) |
|
|
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) | | | | | | | | | |
|
|
416
422
|
|
|
417
423
|
---
|
|
418
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",
|
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