eslint-plugin-browser-security 1.0.4 → 1.1.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/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/README.md +93 -123
- package/package.json +2 -11
- package/src/index.d.ts +5 -0
- package/src/index.js +3 -16
- package/src/rules/no-cookie-auth-tokens/index.d.ts +17 -1
- package/src/rules/no-cookie-auth-tokens/index.js +5 -0
- package/src/rules/no-dynamic-service-worker-url/index.d.ts +17 -1
- package/src/rules/no-dynamic-service-worker-url/index.js +5 -0
- package/src/rules/no-eval/index.d.ts +18 -1
- package/src/rules/no-eval/index.js +5 -0
- package/src/rules/no-filereader-innerhtml/index.d.ts +18 -1
- package/src/rules/no-filereader-innerhtml/index.js +5 -0
- package/src/rules/no-innerhtml/index.d.ts +18 -1
- package/src/rules/no-innerhtml/index.js +5 -0
- package/src/rules/no-jwt-in-storage/index.d.ts +18 -1
- package/src/rules/no-jwt-in-storage/index.js +5 -0
- package/src/rules/no-postmessage-innerhtml/index.d.ts +18 -1
- package/src/rules/no-postmessage-innerhtml/index.js +5 -0
- package/src/rules/no-postmessage-wildcard-origin/index.d.ts +18 -1
- package/src/rules/no-postmessage-wildcard-origin/index.js +5 -0
- package/src/rules/no-sensitive-cookie-js/index.d.ts +18 -1
- package/src/rules/no-sensitive-cookie-js/index.js +5 -0
- package/src/rules/no-sensitive-indexeddb/index.d.ts +17 -1
- package/src/rules/no-sensitive-indexeddb/index.js +5 -0
- package/src/rules/no-sensitive-localstorage/index.d.ts +18 -1
- package/src/rules/no-sensitive-localstorage/index.js +5 -0
- package/src/rules/no-sensitive-sessionstorage/index.d.ts +17 -1
- package/src/rules/no-sensitive-sessionstorage/index.js +5 -0
- package/src/rules/no-unsafe-eval-csp/index.d.ts +18 -1
- package/src/rules/no-unsafe-eval-csp/index.js +5 -0
- package/src/rules/no-unsafe-inline-csp/index.d.ts +18 -1
- package/src/rules/no-unsafe-inline-csp/index.js +5 -0
- package/src/rules/no-websocket-eval/index.d.ts +18 -1
- package/src/rules/no-websocket-eval/index.js +5 -0
- package/src/rules/no-websocket-innerhtml/index.d.ts +18 -1
- package/src/rules/no-websocket-innerhtml/index.js +5 -0
- package/src/rules/no-worker-message-innerhtml/index.d.ts +18 -1
- package/src/rules/no-worker-message-innerhtml/index.js +5 -0
- package/src/rules/require-blob-url-revocation/index.d.ts +18 -1
- package/src/rules/require-blob-url-revocation/index.js +5 -0
- package/src/rules/require-cookie-secure-attrs/index.d.ts +17 -1
- package/src/rules/require-cookie-secure-attrs/index.js +5 -0
- package/src/rules/require-postmessage-origin-check/index.d.ts +18 -1
- package/src/rules/require-postmessage-origin-check/index.js +5 -0
- package/src/rules/require-websocket-wss/index.d.ts +18 -1
- package/src/rules/require-websocket-wss/index.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to `eslint-plugin-browser-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,10 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://eslint.interlace.tools" target="blank"><img src="https://eslint.interlace.tools/eslint-interlace-logo-light.svg" alt="ESLint Interlace Logo" width="120" /></a>
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
>
|
|
5
|
+
<p align="center">
|
|
6
|
+
Browser-specific security rules to prevent XSS and other client-side attacks.
|
|
7
|
+
</p>
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/eslint-plugin-browser-security" target="_blank"><img src="https://img.shields.io/npm/v/eslint-plugin-browser-security.svg" alt="NPM Version" /></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/eslint-plugin-browser-security" target="_blank"><img src="https://img.shields.io/npm/dm/eslint-plugin-browser-security.svg" alt="NPM Downloads" /></a>
|
|
12
|
+
<a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="Package License" /></a>
|
|
13
|
+
<a href="https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=browser-security" target="_blank"><img src="https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?component=browser-security" alt="Codecov" /></a>
|
|
14
|
+
<a href="https://github.com/ofri-peretz/eslint" target="_blank"><img src="https://img.shields.io/badge/Since-Dec_2025-blue?logo=rocket&logoColor=white" alt="Since Dec 2025" /></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
## Description
|
|
18
|
+
|
|
19
|
+
This plugin provides a suite of browser-specific security rules designed to prevent Cross-Site Scripting (XSS) and other client-side vulnerabilities. It scans your code for dangerous patterns, such as unsafe DOM manipulation and insecure storage practices, offering real-time feedback to developers. Using this plugin ensures that your frontend applications adhere to modern security standards and protect user data effectively.
|
|
20
|
+
|
|
21
|
+
## Philosophy
|
|
22
|
+
|
|
23
|
+
**Interlace** fosters **strength through integration**. Instead of stacking isolated rules, we **interlace** security directly into your workflow to create a resilient fabric of code. We believe tools should **guide rather than gatekeep**, providing educational feedback that strengthens the developer with every interaction.
|
|
24
|
+
|
|
25
|
+
## Getting Started
|
|
26
|
+
|
|
27
|
+
- To check out the [guide](https://eslint.interlace.tools/docs/browser-security), visit [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
28
|
+
- 要查看中文 [指南](https://eslint.interlace.tools/docs/browser-security), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
29
|
+
- [가이드](https://eslint.interlace.tools/docs/browser-security) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools)에서 확인하실 수 있습니다. 📚
|
|
30
|
+
- [ガイド](https://eslint.interlace.tools/docs/browser-security)は [eslint.interlace.tools](https://eslint.interlace.tools)でご確認ください。 📚
|
|
31
|
+
- Para ver la [guía](https://eslint.interlace.tools/docs/browser-security), visita [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
32
|
+
- للاطلاع على [الدليل](https://eslint.interlace.tools/docs/browser-security)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools). 📚
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install eslint-plugin-browser-security --save-dev
|
|
36
|
+
```
|
|
8
37
|
|
|
9
38
|
## 💡 What You Get
|
|
10
39
|
|
|
@@ -25,108 +54,6 @@ Modern browser applications face unique security challenges across storage APIs,
|
|
|
25
54
|
- **Cookie Security**: Identifies insecure cookie handling in JavaScript
|
|
26
55
|
- **LLM-Optimized**: All rules include AI-friendly remediation guidance
|
|
27
56
|
|
|
28
|
-
## 📦 Installation
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm install eslint-plugin-browser-security --save-dev
|
|
32
|
-
# or
|
|
33
|
-
pnpm add -D eslint-plugin-browser-security
|
|
34
|
-
# or
|
|
35
|
-
yarn add -D eslint-plugin-browser-security
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## 🚀 Quick Start
|
|
39
|
-
|
|
40
|
-
### Flat Config (ESLint 9+)
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
// eslint.config.js
|
|
44
|
-
import browserSecurity from 'eslint-plugin-browser-security';
|
|
45
|
-
|
|
46
|
-
export default [
|
|
47
|
-
{
|
|
48
|
-
plugins: {
|
|
49
|
-
'browser-security': browserSecurity,
|
|
50
|
-
},
|
|
51
|
-
rules: {
|
|
52
|
-
'browser-security/no-eval': 'error',
|
|
53
|
-
'browser-security/no-innerhtml': 'error',
|
|
54
|
-
'browser-security/no-sensitive-localstorage': 'error',
|
|
55
|
-
'browser-security/require-postmessage-origin-check': 'error',
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### Using Recommended Config
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
// eslint.config.js
|
|
65
|
-
import browserSecurity from 'eslint-plugin-browser-security';
|
|
66
|
-
|
|
67
|
-
export default [browserSecurity.configs.recommended];
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## 🔐 Rules (21 total)
|
|
71
|
-
|
|
72
|
-
💼 = Set in `recommended` | 🔧 = Auto-fixable | 💡 = Has suggestions
|
|
73
|
-
|
|
74
|
-
### XSS Prevention
|
|
75
|
-
|
|
76
|
-
| Rule | CWE | OWASP | Description | 💼 | 🔧 | 💡 |
|
|
77
|
-
| -------------------------------------------- | ------ | -------- | ----------------------------------------------------- | --- | --- | --- |
|
|
78
|
-
| [no-eval](./docs/rules/no-eval.md) | CWE-95 | A03:2021 | Prevent code injection via `eval()`, `new Function()` | 💼 | | 💡 |
|
|
79
|
-
| [no-innerhtml](./docs/rules/no-innerhtml.md) | CWE-79 | A03:2021 | Prevent XSS via `innerHTML`, `outerHTML` | 💼 | | 💡 |
|
|
80
|
-
|
|
81
|
-
### postMessage Security
|
|
82
|
-
|
|
83
|
-
| Rule | CWE | OWASP | Description | 💼 | 🔧 | 💡 |
|
|
84
|
-
| ------------------------------------------------------------------------------------ | ------- | -------- | ------------------------------------------------- | --- | --- | --- |
|
|
85
|
-
| [require-postmessage-origin-check](./docs/rules/require-postmessage-origin-check.md) | CWE-346 | A01:2021 | Require origin validation in postMessage handlers | 💼 | | 💡 |
|
|
86
|
-
| [no-postmessage-wildcard-origin](./docs/rules/no-postmessage-wildcard-origin.md) | CWE-346 | A01:2021 | Prevent wildcard targetOrigin in postMessage | 💼 | | 💡 |
|
|
87
|
-
| [no-postmessage-innerhtml](./docs/rules/no-postmessage-innerhtml.md) | CWE-79 | A03:2021 | Prevent XSS via innerHTML in postMessage handlers | 💼 | | 💡 |
|
|
88
|
-
|
|
89
|
-
### Storage Security
|
|
90
|
-
|
|
91
|
-
| Rule | CWE | OWASP | Description | 💼 | 🔧 | 💡 |
|
|
92
|
-
| -------------------------------------------------------------------------- | ------- | -------- | ---------------------------------------- | --- | --- | --- |
|
|
93
|
-
| [no-sensitive-localstorage](./docs/rules/no-sensitive-localstorage.md) | CWE-922 | A02:2021 | Prevent sensitive data in localStorage | 💼 | | 💡 |
|
|
94
|
-
| [no-sensitive-sessionstorage](./docs/rules/no-sensitive-sessionstorage.md) | CWE-922 | A02:2021 | Prevent sensitive data in sessionStorage | 💼 | | 💡 |
|
|
95
|
-
| [no-sensitive-indexeddb](./docs/rules/no-sensitive-indexeddb.md) | CWE-922 | A02:2021 | Prevent sensitive data in IndexedDB | 💼 | | 💡 |
|
|
96
|
-
| [no-jwt-in-storage](./docs/rules/no-jwt-in-storage.md) | CWE-922 | A02:2021 | Prevent JWT tokens in browser storage | 💼 | | 💡 |
|
|
97
|
-
|
|
98
|
-
### Cookie Security
|
|
99
|
-
|
|
100
|
-
| Rule | CWE | OWASP | Description | 💼 | 🔧 | 💡 |
|
|
101
|
-
| -------------------------------------------------------------------------- | -------- | -------- | -------------------------------------------- | --- | --- | --- |
|
|
102
|
-
| [no-sensitive-cookie-js](./docs/rules/no-sensitive-cookie-js.md) | CWE-1004 | A02:2021 | Prevent sensitive data in cookies via JS | 💼 | | 💡 |
|
|
103
|
-
| [no-cookie-auth-tokens](./docs/rules/no-cookie-auth-tokens.md) | CWE-1004 | A02:2021 | Prevent auth tokens in JS-accessible cookies | 💼 | | 💡 |
|
|
104
|
-
| [require-cookie-secure-attrs](./docs/rules/require-cookie-secure-attrs.md) | CWE-614 | A05:2021 | Require Secure and SameSite attributes | 💼 | | 💡 |
|
|
105
|
-
|
|
106
|
-
### WebSocket Security
|
|
107
|
-
|
|
108
|
-
| Rule | CWE | OWASP | Description | 💼 | 🔧 | 💡 |
|
|
109
|
-
| ---------------------------------------------------------------- | ------- | -------- | --------------------------------- | --- | --- | --- |
|
|
110
|
-
| [require-websocket-wss](./docs/rules/require-websocket-wss.md) | CWE-319 | A02:2021 | Require secure WebSocket (wss://) | 💼 | | 💡 |
|
|
111
|
-
| [no-websocket-innerhtml](./docs/rules/no-websocket-innerhtml.md) | CWE-79 | A03:2021 | Prevent XSS in WebSocket handlers | 💼 | | 💡 |
|
|
112
|
-
| [no-websocket-eval](./docs/rules/no-websocket-eval.md) | CWE-95 | A03:2021 | Prevent RCE in WebSocket handlers | 💼 | | 💡 |
|
|
113
|
-
|
|
114
|
-
### File API & Workers Security
|
|
115
|
-
|
|
116
|
-
| Rule | CWE | OWASP | Description | 💼 | 🔧 | 💡 |
|
|
117
|
-
| ------------------------------------------------------------------------------ | ------- | -------- | ----------------------------------- | --- | --- | --- |
|
|
118
|
-
| [no-filereader-innerhtml](./docs/rules/no-filereader-innerhtml.md) | CWE-79 | A03:2021 | Prevent XSS with FileReader data | 💼 | | 💡 |
|
|
119
|
-
| [require-blob-url-revocation](./docs/rules/require-blob-url-revocation.md) | CWE-401 | A04:2021 | Require revoking Blob URLs | 💼 | | 💡 |
|
|
120
|
-
| [no-dynamic-service-worker-url](./docs/rules/no-dynamic-service-worker-url.md) | CWE-829 | A08:2021 | Prevent dynamic service worker URLs | 💼 | | 💡 |
|
|
121
|
-
| [no-worker-message-innerhtml](./docs/rules/no-worker-message-innerhtml.md) | CWE-79 | A03:2021 | Prevent XSS in Worker handlers | 💼 | | 💡 |
|
|
122
|
-
|
|
123
|
-
### CSP Security
|
|
124
|
-
|
|
125
|
-
| Rule | CWE | OWASP | Description | 💼 | 🔧 | 💡 |
|
|
126
|
-
| ------------------------------------------------------------ | ------ | -------- | ------------------------------- | --- | --- | --- |
|
|
127
|
-
| [no-unsafe-inline-csp](./docs/rules/no-unsafe-inline-csp.md) | CWE-79 | A03:2021 | Disallow 'unsafe-inline' in CSP | 💼 | | 💡 |
|
|
128
|
-
| [no-unsafe-eval-csp](./docs/rules/no-unsafe-eval-csp.md) | CWE-95 | A03:2021 | Disallow 'unsafe-eval' in CSP | 💼 | | 💡 |
|
|
129
|
-
|
|
130
57
|
## 🔍 Detection Examples
|
|
131
58
|
|
|
132
59
|
### ❌ Vulnerable Code
|
|
@@ -166,14 +93,12 @@ window.addEventListener('message', (event) => {
|
|
|
166
93
|
});
|
|
167
94
|
```
|
|
168
95
|
|
|
169
|
-
##
|
|
96
|
+
## ⚙️ Configuration Presets
|
|
170
97
|
|
|
171
|
-
|
|
|
172
|
-
|
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `no-sensitive-localstorage` | A02: Cryptographic Failures | Sensitive Data Exposure |
|
|
176
|
-
| `require-postmessage-origin-check` | A01: Broken Access Control | Origin Validation |
|
|
98
|
+
| Preset | Description |
|
|
99
|
+
| :------------ | :-------------------------------------------------- |
|
|
100
|
+
| `recommended` | Recommended security configuration |
|
|
101
|
+
| `strict` | Strict security configuration - all rules as errors |
|
|
177
102
|
|
|
178
103
|
## 🤖 LLM-Optimized Messages
|
|
179
104
|
|
|
@@ -198,19 +123,64 @@ All rules include structured remediation guidance designed for AI assistants:
|
|
|
198
123
|
• OWASP XSS Prevention: https://owasp.org/...
|
|
199
124
|
```
|
|
200
125
|
|
|
201
|
-
|
|
126
|
+
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.
|
|
127
|
+
|
|
128
|
+
## Rules
|
|
129
|
+
|
|
130
|
+
**Legend**
|
|
131
|
+
|
|
132
|
+
| Icon | Description |
|
|
133
|
+
| :--: | :----------------------------------------------------------------- |
|
|
134
|
+
| 💼 | **Recommended**: Included in the recommended preset. |
|
|
135
|
+
| ⚠️ | **Warns**: Set towarn in recommended preset. |
|
|
136
|
+
| 🔧 | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
|
|
137
|
+
| 💡 | **Suggestions**: Providing code suggestions in IDE. |
|
|
138
|
+
| 🚫 | **Deprecated**: This rule is deprecated. |
|
|
139
|
+
|
|
140
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
141
|
+
| :------------------------------------------------------------------------------------------------------------------------------ | :------: | :------: | :--: | :----------------------------------------------------------------------------------- | :-: | :-: | :-: | :-: | :-: |
|
|
142
|
+
| [no-eval](https://eslint.interlace.tools/docs/browser-security/rules/no-eval) | CWE-95 | A03:2025 | 9.8 | [no-eval](./docs/rules/no-eval.md) | 💼 | | | 💡 | 🚫 |
|
|
143
|
+
| [no-innerhtml](https://eslint.interlace.tools/docs/browser-security/rules/no-innerhtml) | CWE-79 | A03:2025 | 6.1 | [no-innerhtml](./docs/rules/no-innerhtml.md) | 💼 | | | 💡 | |
|
|
144
|
+
| [require-postmessage-origin-check](https://eslint.interlace.tools/docs/browser-security/rules/require-postmessage-origin-check) | CWE-346 | A01:2025 | 8.8 | [require-postmessage-origin-check](./docs/rules/require-postmessage-origin-check.md) | 💼 | | | | |
|
|
145
|
+
| [no-postmessage-wildcard-origin](https://eslint.interlace.tools/docs/browser-security/rules/no-postmessage-wildcard-origin) | CWE-346 | A01:2025 | 8.8 | [no-postmessage-wildcard-origin](./docs/rules/no-postmessage-wildcard-origin.md) | 💼 | | | | |
|
|
146
|
+
| [no-postmessage-innerhtml](https://eslint.interlace.tools/docs/browser-security/rules/no-postmessage-innerhtml) | CWE-79 | A03:2025 | 6.1 | [no-postmessage-innerhtml](./docs/rules/no-postmessage-innerhtml.md) | 💼 | | | | |
|
|
147
|
+
| [no-sensitive-localstorage](https://eslint.interlace.tools/docs/browser-security/rules/no-sensitive-localstorage) | CWE-922 | A02:2025 | 7.5 | [no-sensitive-localstorage](./docs/rules/no-sensitive-localstorage.md) | 💼 | | | 💡 | |
|
|
148
|
+
| [no-sensitive-sessionstorage](https://eslint.interlace.tools/docs/browser-security/rules/no-sensitive-sessionstorage) | CWE-922 | A02:2025 | 7.5 | [no-sensitive-sessionstorage](./docs/rules/no-sensitive-sessionstorage.md) | 💼 | | | 💡 | |
|
|
149
|
+
| [no-sensitive-indexeddb](https://eslint.interlace.tools/docs/browser-security/rules/no-sensitive-indexeddb) | CWE-922 | A02:2025 | 7.5 | [no-sensitive-indexeddb](./docs/rules/no-sensitive-indexeddb.md) | 💼 | | | 💡 | |
|
|
150
|
+
| [no-jwt-in-storage](https://eslint.interlace.tools/docs/browser-security/rules/no-jwt-in-storage) | CWE-922 | A02:2025 | 7.5 | [no-jwt-in-storage](./docs/rules/no-jwt-in-storage.md) | 💼 | | | 💡 | |
|
|
151
|
+
| [no-sensitive-cookie-js](https://eslint.interlace.tools/docs/browser-security/rules/no-sensitive-cookie-js) | CWE-1004 | A02:2025 | 5.3 | [no-sensitive-cookie-js](./docs/rules/no-sensitive-cookie-js.md) | 💼 | | | 💡 | |
|
|
152
|
+
| [no-cookie-auth-tokens](https://eslint.interlace.tools/docs/browser-security/rules/no-cookie-auth-tokens) | CWE-1004 | A02:2025 | 5.3 | [no-cookie-auth-tokens](./docs/rules/no-cookie-auth-tokens.md) | 💼 | | | 💡 | |
|
|
153
|
+
| [require-cookie-secure-attrs](https://eslint.interlace.tools/docs/browser-security/rules/require-cookie-secure-attrs) | CWE-614 | A05:2025 | 5.3 | [require-cookie-secure-attrs](./docs/rules/require-cookie-secure-attrs.md) | 💼 | | | | 🚫 |
|
|
154
|
+
| [require-websocket-wss](https://eslint.interlace.tools/docs/browser-security/rules/require-websocket-wss) | CWE-319 | A02:2025 | 7.5 | [require-websocket-wss](./docs/rules/require-websocket-wss.md) | 💼 | | | 💡 | 🚫 |
|
|
155
|
+
| [no-websocket-innerhtml](https://eslint.interlace.tools/docs/browser-security/rules/no-websocket-innerhtml) | CWE-79 | A03:2025 | 6.1 | [no-websocket-innerhtml](./docs/rules/no-websocket-innerhtml.md) | 💼 | | | 💡 | |
|
|
156
|
+
| [no-websocket-eval](https://eslint.interlace.tools/docs/browser-security/rules/no-websocket-eval) | CWE-95 | A03:2025 | 9.8 | [no-websocket-eval](./docs/rules/no-websocket-eval.md) | 💼 | | | 💡 | |
|
|
157
|
+
| [no-filereader-innerhtml](https://eslint.interlace.tools/docs/browser-security/rules/no-filereader-innerhtml) | CWE-79 | A03:2025 | 6.1 | [no-filereader-innerhtml](./docs/rules/no-filereader-innerhtml.md) | 💼 | | | 💡 | |
|
|
158
|
+
| [require-blob-url-revocation](https://eslint.interlace.tools/docs/browser-security/rules/require-blob-url-revocation) | CWE-401 | A04:2025 | 5.3 | [require-blob-url-revocation](./docs/rules/require-blob-url-revocation.md) | 💼 | ⚠️ | | 💡 | |
|
|
159
|
+
| [no-dynamic-service-worker-url](https://eslint.interlace.tools/docs/browser-security/rules/no-dynamic-service-worker-url) | CWE-829 | A08:2025 | 7.5 | [no-dynamic-service-worker-url](./docs/rules/no-dynamic-service-worker-url.md) | 💼 | | | 💡 | |
|
|
160
|
+
| [no-worker-message-innerhtml](https://eslint.interlace.tools/docs/browser-security/rules/no-worker-message-innerhtml) | CWE-79 | A03:2025 | 6.1 | [no-worker-message-innerhtml](./docs/rules/no-worker-message-innerhtml.md) | 💼 | | | | |
|
|
161
|
+
| [no-unsafe-inline-csp](https://eslint.interlace.tools/docs/browser-security/rules/no-unsafe-inline-csp) | CWE-79 | A03:2025 | 6.1 | [no-unsafe-inline-csp](./docs/rules/no-unsafe-inline-csp.md) | 💼 | | | 💡 | |
|
|
162
|
+
| [no-unsafe-eval-csp](https://eslint.interlace.tools/docs/browser-security/rules/no-unsafe-eval-csp) | CWE-95 | A03:2025 | 9.8 | [no-unsafe-eval-csp](./docs/rules/no-unsafe-eval-csp.md) | 💼 | | | 💡 | |
|
|
163
|
+
|
|
164
|
+
## 🔗 Related ESLint Plugins
|
|
202
165
|
|
|
203
166
|
Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
|
|
204
167
|
|
|
205
|
-
| Plugin
|
|
206
|
-
|
|
|
207
|
-
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding)
|
|
208
|
-
| [`eslint-plugin-
|
|
209
|
-
| [`eslint-plugin-
|
|
210
|
-
| [`eslint-plugin-
|
|
211
|
-
| [`eslint-plugin-
|
|
212
|
-
| [`eslint-plugin-
|
|
168
|
+
| Plugin | Downloads | Description |
|
|
169
|
+
| :--------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------- |
|
|
170
|
+
| [`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. |
|
|
171
|
+
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | [](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL security & best practices. |
|
|
172
|
+
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [](https://www.npmjs.com/package/eslint-plugin-crypto) | NodeJS Cryptography security rules. |
|
|
173
|
+
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
|
|
174
|
+
| [`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 rules. |
|
|
175
|
+
| [`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. |
|
|
176
|
+
| [`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. |
|
|
177
|
+
| [`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. |
|
|
178
|
+
| [`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. |
|
|
213
179
|
|
|
214
180
|
## 📄 License
|
|
215
181
|
|
|
216
182
|
MIT © [Ofri Peretz](https://github.com/ofri-peretz)
|
|
183
|
+
|
|
184
|
+
<p align="center">
|
|
185
|
+
<a href="https://eslint.interlace.tools/docs/browser-security"><img src="https://eslint.interlace.tools/images/og-browser-security.png" alt="ESLint Interlace Plugin" width="300" /></a>
|
|
186
|
+
</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-browser-security",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Security-focused ESLint plugin for browser applications. Detects XSS vulnerabilities, postMessage abuse, localStorage/sessionStorage/IndexedDB token exposure, cookie security issues, WebSocket security, Blob URL leaks, Service Worker risks, and CSP misconfigurations.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -73,20 +73,11 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@interlace/eslint-devkit": "^1.2.1",
|
|
76
|
-
"vitest": "^4.0.6",
|
|
77
|
-
"@nx/vite": "^22.0.3",
|
|
78
76
|
"tslib": "^2.8.1"
|
|
79
77
|
},
|
|
80
78
|
"peerDependencies": {},
|
|
81
|
-
"scripts": {
|
|
82
|
-
"test": "vitest run",
|
|
83
|
-
"test:watch": "vitest watch",
|
|
84
|
-
"test:coverage": "vitest run --coverage"
|
|
85
|
-
},
|
|
86
79
|
"devDependencies": {
|
|
87
80
|
"@typescript-eslint/parser": "^8.46.2",
|
|
88
|
-
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
89
|
-
"@vitest/coverage-v8": "^4.0.6",
|
|
90
|
-
"vitest": "^4.0.6"
|
|
81
|
+
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
91
82
|
}
|
|
92
83
|
}
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Detects XSS vulnerabilities, postMessage abuse, localStorage/sessionStorage/IndexedDB
|
|
7
|
-
* token exposure, cookie security issues, WebSocket vulnerabilities, and more.
|
|
8
|
-
*
|
|
9
|
-
* Features:
|
|
10
|
-
* - LLM-optimized error messages with CWE references
|
|
11
|
-
* - XSS prevention rules (innerHTML, eval)
|
|
12
|
-
* - postMessage security
|
|
13
|
-
* - Storage security (localStorage, sessionStorage, IndexedDB)
|
|
14
|
-
* - Cookie security
|
|
15
|
-
* - WebSocket security
|
|
16
|
-
* - Browser API security
|
|
17
|
-
*
|
|
18
|
-
* @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.
|
|
19
6
|
*/
|
|
20
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
8
|
exports.configs = exports.plugin = exports.rules = void 0;
|
|
@@ -1,5 +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: no-cookie-auth-tokens
|
|
8
|
+
* Detects storing auth tokens in cookies via JavaScript (should use HttpOnly)
|
|
9
|
+
* CWE-1004: Sensitive Cookie Without 'HttpOnly' Flag
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/1004.html
|
|
12
|
+
*/
|
|
13
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
14
|
+
type MessageIds = 'authTokenInCookie' | 'useHttpOnlyCookie';
|
|
1
15
|
export interface Options {
|
|
2
16
|
/** Allow in test files. Default: true */
|
|
3
17
|
allowInTests?: boolean;
|
|
4
18
|
}
|
|
5
|
-
|
|
19
|
+
type RuleOptions = [Options?];
|
|
20
|
+
export declare const noCookieAuthTokens: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
21
|
+
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.noCookieAuthTokens = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +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: no-dynamic-service-worker-url
|
|
8
|
+
* Detects dynamic/untrusted URLs used for service worker registration
|
|
9
|
+
* CWE-829: Inclusion of Functionality from Untrusted Control Sphere
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/829.html
|
|
12
|
+
*/
|
|
13
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
14
|
+
type MessageIds = 'dynamicSwUrl' | 'useStaticUrl';
|
|
1
15
|
export interface Options {
|
|
2
16
|
/** Allow in test files. Default: true */
|
|
3
17
|
allowInTests?: boolean;
|
|
4
18
|
}
|
|
5
|
-
|
|
19
|
+
type RuleOptions = [Options?];
|
|
20
|
+
export declare const noDynamicServiceWorkerUrl: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
21
|
+
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.noDynamicServiceWorkerUrl = 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-eval
|
|
8
|
+
* Detects dangerous eval() and similar code execution patterns
|
|
9
|
+
* CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code (Eval Injection)
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/95.html
|
|
12
|
+
* @see https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/11-Testing_for_Code_Injection
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'dangerousEval' | 'useSafeAlternative';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: false */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
/** Allow Function constructor. Default: false */
|
|
5
20
|
allowFunctionConstructor?: boolean;
|
|
6
21
|
}
|
|
7
|
-
|
|
22
|
+
type RuleOptions = [Options?];
|
|
23
|
+
export declare const noEval: 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.noEval = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,22 @@
|
|
|
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-filereader-innerhtml
|
|
8
|
+
* Detects unsafe innerHTML usage with FileReader data
|
|
9
|
+
* CWE-79: Improper Neutralization of Input During Web Page Generation
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/79.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileReader
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'unsafeInnerhtml' | 'sanitizeContent';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
}
|
|
5
|
-
|
|
20
|
+
type RuleOptions = [Options?];
|
|
21
|
+
export declare const noFilereaderInnerhtml: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
22
|
+
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.noFilereaderInnerhtml = 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-innerhtml
|
|
8
|
+
* Detects dangerous innerHTML/outerHTML assignments that can lead to XSS
|
|
9
|
+
* CWE-79: Improper Neutralization of Input During Web Page Generation (XSS)
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/79.html
|
|
12
|
+
* @see https://owasp.org/www-community/attacks/xss/
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'dangerousInnerHTML' | 'useSanitizer';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow innerHTML in test files. Default: false */
|
|
3
18
|
allowInTests?: boolean;
|
|
@@ -6,4 +21,6 @@ export interface Options {
|
|
|
6
21
|
/** Allow innerHTML with literal strings. Default: true */
|
|
7
22
|
allowLiteralStrings?: boolean;
|
|
8
23
|
}
|
|
9
|
-
|
|
24
|
+
type RuleOptions = [Options?];
|
|
25
|
+
export declare const noInnerhtml: 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.noInnerhtml = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,22 @@
|
|
|
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-jwt-in-storage
|
|
8
|
+
* Detects storing JWT tokens in localStorage/sessionStorage
|
|
9
|
+
* CWE-922: Insecure Storage of Sensitive Information
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/922.html
|
|
12
|
+
* @see https://auth0.com/docs/secure/security-guidance/data-security/token-storage
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'jwtInStorage' | 'useHttpOnlyCookie';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
}
|
|
5
|
-
|
|
20
|
+
type RuleOptions = [Options?];
|
|
21
|
+
export declare const noJwtInStorage: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
22
|
+
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.noJwtInStorage = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,22 @@
|
|
|
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-postmessage-innerhtml
|
|
8
|
+
* Detects unsafe innerHTML usage in postMessage handlers
|
|
9
|
+
* CWE-79: Improper Neutralization of Input During Web Page Generation
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/79.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#security_concerns
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'unsafeInnerhtml' | 'useTextContent';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
}
|
|
5
|
-
|
|
20
|
+
type RuleOptions = [Options?];
|
|
21
|
+
export declare const noPostmessageInnerhtml: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
22
|
+
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.noPostmessageInnerhtml = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,22 @@
|
|
|
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-postmessage-wildcard-origin
|
|
8
|
+
* Detects postMessage calls with wildcard (*) targetOrigin
|
|
9
|
+
* CWE-346: Origin Validation Error
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/346.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#security_concerns
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'wildcardOrigin' | 'specifyOrigin';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
}
|
|
5
|
-
|
|
20
|
+
type RuleOptions = [Options?];
|
|
21
|
+
export declare const noPostmessageWildcardOrigin: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
22
|
+
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.noPostmessageWildcardOrigin = 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-sensitive-cookie-js
|
|
8
|
+
* Detects storing sensitive data (tokens, passwords) in cookies via JavaScript
|
|
9
|
+
* CWE-1004: Sensitive Cookie Without 'HttpOnly' Flag
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/1004.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#security
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'sensitiveCookieJs' | 'useHttpOnlyCookie';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
/** Sensitive key patterns to detect. Default includes common token/password patterns */
|
|
5
20
|
sensitivePatterns?: string[];
|
|
6
21
|
}
|
|
7
|
-
|
|
22
|
+
type RuleOptions = [Options?];
|
|
23
|
+
export declare const noSensitiveCookieJs: 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.noSensitiveCookieJs = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +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: no-sensitive-indexeddb
|
|
8
|
+
* Detects storing sensitive data in IndexedDB
|
|
9
|
+
* CWE-922: Insecure Storage of Sensitive Information
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/922.html
|
|
12
|
+
*/
|
|
13
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
14
|
+
type MessageIds = 'sensitiveInIndexedDB' | 'useEncryption';
|
|
1
15
|
export interface Options {
|
|
2
16
|
/** Allow in test files. Default: true */
|
|
3
17
|
allowInTests?: boolean;
|
|
4
18
|
}
|
|
5
|
-
|
|
19
|
+
type RuleOptions = [Options?];
|
|
20
|
+
export declare const noSensitiveIndexeddb: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
21
|
+
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.noSensitiveIndexeddb = 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-sensitive-localstorage
|
|
8
|
+
* Detects storing sensitive data (tokens, passwords, keys) in localStorage
|
|
9
|
+
* CWE-922: Insecure Storage of Sensitive Information
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/922.html
|
|
12
|
+
* @see https://owasp.org/www-community/vulnerabilities/Insecure_Storage
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'sensitiveLocalStorage' | 'useHttpOnlyCookie';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: false */
|
|
3
18
|
allowInTests?: boolean;
|
|
@@ -6,4 +21,6 @@ export interface Options {
|
|
|
6
21
|
/** Also check sessionStorage. Default: true */
|
|
7
22
|
checkSessionStorage?: boolean;
|
|
8
23
|
}
|
|
9
|
-
|
|
24
|
+
type RuleOptions = [Options?];
|
|
25
|
+
export declare const noSensitiveLocalstorage: 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.noSensitiveLocalstorage = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,7 +1,23 @@
|
|
|
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-sensitive-sessionstorage
|
|
8
|
+
* Detects storing sensitive data in sessionStorage
|
|
9
|
+
* CWE-922: Insecure Storage of Sensitive Information
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/922.html
|
|
12
|
+
*/
|
|
13
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
14
|
+
type MessageIds = 'sensitiveInSessionStorage' | 'useSecureStorage';
|
|
1
15
|
export interface Options {
|
|
2
16
|
/** Allow in test files. Default: true */
|
|
3
17
|
allowInTests?: boolean;
|
|
4
18
|
/** Additional sensitive key patterns */
|
|
5
19
|
additionalPatterns?: string[];
|
|
6
20
|
}
|
|
7
|
-
|
|
21
|
+
type RuleOptions = [Options?];
|
|
22
|
+
export declare const noSensitiveSessionstorage: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
23
|
+
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.noSensitiveSessionstorage = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,22 @@
|
|
|
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-unsafe-eval-csp
|
|
8
|
+
* Detects 'unsafe-eval' in Content Security Policy directives
|
|
9
|
+
* CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/95.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'unsafeEval' | 'removeUnsafeEval';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
}
|
|
5
|
-
|
|
20
|
+
type RuleOptions = [Options?];
|
|
21
|
+
export declare const noUnsafeEvalCsp: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
22
|
+
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.noUnsafeEvalCsp = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,22 @@
|
|
|
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-unsafe-inline-csp
|
|
8
|
+
* Detects 'unsafe-inline' in Content Security Policy directives
|
|
9
|
+
* CWE-79: Improper Neutralization of Input During Web Page Generation
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/79.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'unsafeInline' | 'useNonceOrHash';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
}
|
|
5
|
-
|
|
20
|
+
type RuleOptions = [Options?];
|
|
21
|
+
export declare const noUnsafeInlineCsp: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
22
|
+
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.noUnsafeInlineCsp = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,22 @@
|
|
|
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-websocket-eval
|
|
8
|
+
* Detects dangerous eval() usage with WebSocket message data
|
|
9
|
+
* CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/95.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'evalWithWsData' | 'parseDataSafely';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
}
|
|
5
|
-
|
|
20
|
+
type RuleOptions = [Options?];
|
|
21
|
+
export declare const noWebsocketEval: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
22
|
+
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.noWebsocketEval = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,22 @@
|
|
|
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-websocket-innerhtml
|
|
8
|
+
* Detects unsafe innerHTML usage with WebSocket message data
|
|
9
|
+
* CWE-79: Improper Neutralization of Input During Web Page Generation
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/79.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'unsafeInnerhtml' | 'useTextContent';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
}
|
|
5
|
-
|
|
20
|
+
type RuleOptions = [Options?];
|
|
21
|
+
export declare const noWebsocketInnerhtml: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
22
|
+
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.noWebsocketInnerhtml = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,22 @@
|
|
|
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-worker-message-innerhtml
|
|
8
|
+
* Detects unsafe innerHTML usage with Web Worker message data
|
|
9
|
+
* CWE-79: Improper Neutralization of Input During Web Page Generation
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/79.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Worker
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'workerInnerhtml' | 'sanitizeWorkerData';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
}
|
|
5
|
-
|
|
20
|
+
type RuleOptions = [Options?];
|
|
21
|
+
export declare const noWorkerMessageInnerhtml: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
22
|
+
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.noWorkerMessageInnerhtml = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +1,22 @@
|
|
|
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-blob-url-revocation
|
|
8
|
+
* Detects Blob URLs that are not revoked, preventing memory leaks
|
|
9
|
+
* CWE-401: Missing Release of Memory after Effective Lifetime
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/401.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'missingRevoke' | 'addRevocation';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
}
|
|
5
|
-
|
|
20
|
+
type RuleOptions = [Options?];
|
|
21
|
+
export declare const requireBlobUrlRevocation: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
22
|
+
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.requireBlobUrlRevocation = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -1,5 +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-cookie-secure-attrs
|
|
8
|
+
* Requires Secure and SameSite attributes when setting cookies
|
|
9
|
+
* CWE-614: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/614.html
|
|
12
|
+
*/
|
|
13
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
14
|
+
type MessageIds = 'missingSecure' | 'missingSameSite' | 'addSecureAttrs';
|
|
1
15
|
export interface Options {
|
|
2
16
|
/** Allow in test files. Default: true */
|
|
3
17
|
allowInTests?: boolean;
|
|
4
18
|
}
|
|
5
|
-
|
|
19
|
+
type RuleOptions = [Options?];
|
|
20
|
+
export declare const requireCookieSecureAttrs: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener>;
|
|
21
|
+
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.requireCookieSecureAttrs = 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: require-postmessage-origin-check
|
|
8
|
+
* Detects postMessage listeners without origin validation
|
|
9
|
+
* CWE-346: Origin Validation Error
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/346.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#security_concerns
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'missingOriginCheck' | 'addOriginCheck';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: false */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
/** Trusted origins that satisfy the check. Default: [] */
|
|
5
20
|
trustedOrigins?: string[];
|
|
6
21
|
}
|
|
7
|
-
|
|
22
|
+
type RuleOptions = [Options?];
|
|
23
|
+
export declare const requirePostmessageOriginCheck: 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.requirePostmessageOriginCheck = 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: require-websocket-wss
|
|
8
|
+
* Requires secure WebSocket connections (wss://) instead of unencrypted (ws://)
|
|
9
|
+
* CWE-319: Cleartext Transmission of Sensitive Information
|
|
10
|
+
*
|
|
11
|
+
* @see https://cwe.mitre.org/data/definitions/319.html
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
|
|
13
|
+
*/
|
|
14
|
+
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
15
|
+
type MessageIds = 'insecureWebsocket' | 'useWss';
|
|
1
16
|
export interface Options {
|
|
2
17
|
/** Allow in test files. Default: true */
|
|
3
18
|
allowInTests?: boolean;
|
|
4
19
|
/** Allow localhost/127.0.0.1 connections. Default: true */
|
|
5
20
|
allowLocalhost?: boolean;
|
|
6
21
|
}
|
|
7
|
-
|
|
22
|
+
type RuleOptions = [Options?];
|
|
23
|
+
export declare const requireWebsocketWss: 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.requireWebsocketWss = void 0;
|
|
4
9
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|