eslint-plugin-browser-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 +58 -52
- package/package.json +1 -1
- 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/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# eslint-plugin-browser-security
|
|
2
2
|
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img src="https://eslint.interlace.tools/images/og-browser.png" alt="ESLint Interlace - eslint-plugin-browser-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 browser applications. Detects XSS vulnerabilities, postMessage abuse, storage API token exposure, cookie security issues, WebSocket vulnerabilities, and more.
|
|
4
10
|
|
|
5
11
|
[](https://www.npmjs.com/package/eslint-plugin-browser-security)
|
|
@@ -75,59 +81,59 @@ export default [browserSecurity.configs.recommended];
|
|
|
75
81
|
|
|
76
82
|
### XSS Prevention
|
|
77
83
|
|
|
78
|
-
| Rule |
|
|
79
|
-
|
|
|
80
|
-
| [no-eval](./docs/rules/no-eval.md) | CWE-95 | A03:2021 | Prevent code injection via `eval()`, `new Function()` | 💼 | | 💡 |
|
|
81
|
-
| [no-innerhtml](./docs/rules/no-innerhtml.md) | CWE-79 | A03:2021 | Prevent XSS via `innerHTML`, `outerHTML` | 💼 | | 💡 |
|
|
84
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
85
|
+
| :------------------------------------------- | :----: | :------: | :--: | :---------------------------------------------------- | :-: | :-: | :-: | :-: | :-: |
|
|
86
|
+
| [no-eval](./docs/rules/no-eval.md) | CWE-95 | A03:2021 | | Prevent code injection via `eval()`, `new Function()` | 💼 | | | 💡 | |
|
|
87
|
+
| [no-innerhtml](./docs/rules/no-innerhtml.md) | CWE-79 | A03:2021 | | Prevent XSS via `innerHTML`, `outerHTML` | 💼 | | | 💡 | |
|
|
82
88
|
|
|
83
89
|
### postMessage Security
|
|
84
90
|
|
|
85
|
-
| Rule |
|
|
86
|
-
|
|
|
87
|
-
| [require-postmessage-origin-check](./docs/rules/require-postmessage-origin-check.md) | CWE-346 | A01:2021 | Require origin validation in postMessage handlers | 💼 | | 💡 |
|
|
88
|
-
| [no-postmessage-wildcard-origin](./docs/rules/no-postmessage-wildcard-origin.md) | CWE-346 | A01:2021 | Prevent wildcard targetOrigin in postMessage | 💼 | | 💡 |
|
|
89
|
-
| [no-postmessage-innerhtml](./docs/rules/no-postmessage-innerhtml.md) | CWE-79 | A03:2021 | Prevent XSS via innerHTML in postMessage handlers | 💼 | | 💡 |
|
|
91
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
92
|
+
| :----------------------------------------------------------------------------------- | :-----: | :------: | :--: | :------------------------------------------------ | :-: | :-: | :-: | :-: | :-: |
|
|
93
|
+
| [require-postmessage-origin-check](./docs/rules/require-postmessage-origin-check.md) | CWE-346 | A01:2021 | | Require origin validation in postMessage handlers | 💼 | | | 💡 | |
|
|
94
|
+
| [no-postmessage-wildcard-origin](./docs/rules/no-postmessage-wildcard-origin.md) | CWE-346 | A01:2021 | | Prevent wildcard targetOrigin in postMessage | 💼 | | | 💡 | |
|
|
95
|
+
| [no-postmessage-innerhtml](./docs/rules/no-postmessage-innerhtml.md) | CWE-79 | A03:2021 | | Prevent XSS via innerHTML in postMessage handlers | 💼 | | | 💡 | |
|
|
90
96
|
|
|
91
97
|
### Storage Security
|
|
92
98
|
|
|
93
|
-
| Rule |
|
|
94
|
-
|
|
|
95
|
-
| [no-sensitive-localstorage](./docs/rules/no-sensitive-localstorage.md) | CWE-922 | A02:2021 | Prevent sensitive data in localStorage | 💼 | | 💡 |
|
|
96
|
-
| [no-sensitive-sessionstorage](./docs/rules/no-sensitive-sessionstorage.md) | CWE-922 | A02:2021 | Prevent sensitive data in sessionStorage | 💼 | | 💡 |
|
|
97
|
-
| [no-sensitive-indexeddb](./docs/rules/no-sensitive-indexeddb.md) | CWE-922 | A02:2021 | Prevent sensitive data in IndexedDB | 💼 | | 💡 |
|
|
98
|
-
| [no-jwt-in-storage](./docs/rules/no-jwt-in-storage.md) | CWE-922 | A02:2021 | Prevent JWT tokens in browser storage | 💼 | | 💡 |
|
|
99
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
100
|
+
| :------------------------------------------------------------------------- | :-----: | :------: | :--: | :--------------------------------------- | :-: | :-: | :-: | :-: | :-: |
|
|
101
|
+
| [no-sensitive-localstorage](./docs/rules/no-sensitive-localstorage.md) | CWE-922 | A02:2021 | | Prevent sensitive data in localStorage | 💼 | | | 💡 | |
|
|
102
|
+
| [no-sensitive-sessionstorage](./docs/rules/no-sensitive-sessionstorage.md) | CWE-922 | A02:2021 | | Prevent sensitive data in sessionStorage | 💼 | | | 💡 | |
|
|
103
|
+
| [no-sensitive-indexeddb](./docs/rules/no-sensitive-indexeddb.md) | CWE-922 | A02:2021 | | Prevent sensitive data in IndexedDB | 💼 | | | 💡 | |
|
|
104
|
+
| [no-jwt-in-storage](./docs/rules/no-jwt-in-storage.md) | CWE-922 | A02:2021 | | Prevent JWT tokens in browser storage | 💼 | | | 💡 | |
|
|
99
105
|
|
|
100
106
|
### Cookie Security
|
|
101
107
|
|
|
102
|
-
| Rule |
|
|
103
|
-
|
|
|
104
|
-
| [no-sensitive-cookie-js](./docs/rules/no-sensitive-cookie-js.md) | CWE-1004 | A02:2021 | Prevent sensitive data in cookies via JS | 💼 | | 💡 |
|
|
105
|
-
| [no-cookie-auth-tokens](./docs/rules/no-cookie-auth-tokens.md) | CWE-1004 | A02:2021 | Prevent auth tokens in JS-accessible cookies | 💼 | | 💡 |
|
|
106
|
-
| [require-cookie-secure-attrs](./docs/rules/require-cookie-secure-attrs.md) | CWE-614 | A05:2021 | Require Secure and SameSite attributes | 💼 | | 💡 |
|
|
108
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
109
|
+
| :------------------------------------------------------------------------- | :------: | :------: | :--: | :------------------------------------------- | :-: | :-: | :-: | :-: | :-: |
|
|
110
|
+
| [no-sensitive-cookie-js](./docs/rules/no-sensitive-cookie-js.md) | CWE-1004 | A02:2021 | | Prevent sensitive data in cookies via JS | 💼 | | | 💡 | |
|
|
111
|
+
| [no-cookie-auth-tokens](./docs/rules/no-cookie-auth-tokens.md) | CWE-1004 | A02:2021 | | Prevent auth tokens in JS-accessible cookies | 💼 | | | 💡 | |
|
|
112
|
+
| [require-cookie-secure-attrs](./docs/rules/require-cookie-secure-attrs.md) | CWE-614 | A05:2021 | | Require Secure and SameSite attributes | 💼 | | | 💡 | |
|
|
107
113
|
|
|
108
114
|
### WebSocket Security
|
|
109
115
|
|
|
110
|
-
| Rule |
|
|
111
|
-
|
|
|
112
|
-
| [require-websocket-wss](./docs/rules/require-websocket-wss.md) | CWE-319 | A02:2021 | Require secure WebSocket (wss://) | 💼 | | 💡 |
|
|
113
|
-
| [no-websocket-innerhtml](./docs/rules/no-websocket-innerhtml.md) | CWE-79 | A03:2021 | Prevent XSS in WebSocket handlers | 💼 | | 💡 |
|
|
114
|
-
| [no-websocket-eval](./docs/rules/no-websocket-eval.md) | CWE-95 | A03:2021 | Prevent RCE in WebSocket handlers | 💼 | | 💡 |
|
|
116
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
117
|
+
| :--------------------------------------------------------------- | :-----: | :------: | :--: | :-------------------------------- | :-: | :-: | :-: | :-: | :-: |
|
|
118
|
+
| [require-websocket-wss](./docs/rules/require-websocket-wss.md) | CWE-319 | A02:2021 | | Require secure WebSocket (wss://) | 💼 | | | 💡 | |
|
|
119
|
+
| [no-websocket-innerhtml](./docs/rules/no-websocket-innerhtml.md) | CWE-79 | A03:2021 | | Prevent XSS in WebSocket handlers | 💼 | | | 💡 | |
|
|
120
|
+
| [no-websocket-eval](./docs/rules/no-websocket-eval.md) | CWE-95 | A03:2021 | | Prevent RCE in WebSocket handlers | 💼 | | | 💡 | |
|
|
115
121
|
|
|
116
122
|
### File API & Workers Security
|
|
117
123
|
|
|
118
|
-
| Rule |
|
|
119
|
-
|
|
|
120
|
-
| [no-filereader-innerhtml](./docs/rules/no-filereader-innerhtml.md) | CWE-79 | A03:2021 | Prevent XSS with FileReader data | 💼 | | 💡 |
|
|
121
|
-
| [require-blob-url-revocation](./docs/rules/require-blob-url-revocation.md) | CWE-401 | A04:2021 | Require revoking Blob URLs | 💼 | | 💡 |
|
|
122
|
-
| [no-dynamic-service-worker-url](./docs/rules/no-dynamic-service-worker-url.md) | CWE-829 | A08:2021 | Prevent dynamic service worker URLs | 💼 | | 💡 |
|
|
123
|
-
| [no-worker-message-innerhtml](./docs/rules/no-worker-message-innerhtml.md) | CWE-79 | A03:2021 | Prevent XSS in Worker handlers | 💼 | | 💡 |
|
|
124
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
125
|
+
| :----------------------------------------------------------------------------- | :-----: | :------: | :--: | :---------------------------------- | :-: | :-: | :-: | :-: | :-: |
|
|
126
|
+
| [no-filereader-innerhtml](./docs/rules/no-filereader-innerhtml.md) | CWE-79 | A03:2021 | | Prevent XSS with FileReader data | 💼 | | | 💡 | |
|
|
127
|
+
| [require-blob-url-revocation](./docs/rules/require-blob-url-revocation.md) | CWE-401 | A04:2021 | | Require revoking Blob URLs | 💼 | | | 💡 | |
|
|
128
|
+
| [no-dynamic-service-worker-url](./docs/rules/no-dynamic-service-worker-url.md) | CWE-829 | A08:2021 | | Prevent dynamic service worker URLs | 💼 | | | 💡 | |
|
|
129
|
+
| [no-worker-message-innerhtml](./docs/rules/no-worker-message-innerhtml.md) | CWE-79 | A03:2021 | | Prevent XSS in Worker handlers | 💼 | | | 💡 | |
|
|
124
130
|
|
|
125
131
|
### CSP Security
|
|
126
132
|
|
|
127
|
-
| Rule |
|
|
128
|
-
|
|
|
129
|
-
| [no-unsafe-inline-csp](./docs/rules/no-unsafe-inline-csp.md) | CWE-79 | A03:2021 | Disallow 'unsafe-inline' in CSP | 💼 | | 💡 |
|
|
130
|
-
| [no-unsafe-eval-csp](./docs/rules/no-unsafe-eval-csp.md) | CWE-95 | A03:2021 | Disallow 'unsafe-eval' in CSP | 💼 | | 💡 |
|
|
133
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
134
|
+
| :----------------------------------------------------------- | :----: | :------: | :--: | :------------------------------ | :-: | :-: | :-: | :-: | :-: |
|
|
135
|
+
| [no-unsafe-inline-csp](./docs/rules/no-unsafe-inline-csp.md) | CWE-79 | A03:2021 | | Disallow 'unsafe-inline' in CSP | 💼 | | | 💡 | |
|
|
136
|
+
| [no-unsafe-eval-csp](./docs/rules/no-unsafe-eval-csp.md) | CWE-95 | A03:2021 | | Disallow 'unsafe-eval' in CSP | 💼 | | | 💡 | |
|
|
131
137
|
|
|
132
138
|
## 🔍 Detection Examples
|
|
133
139
|
|
|
@@ -170,12 +176,12 @@ window.addEventListener('message', (event) => {
|
|
|
170
176
|
|
|
171
177
|
## 🗂️ OWASP Coverage
|
|
172
178
|
|
|
173
|
-
| Rule | OWASP
|
|
174
|
-
|
|
|
175
|
-
| `no-eval` |
|
|
176
|
-
| `no-innerhtml` |
|
|
177
|
-
| `no-sensitive-localstorage` | A02: Cryptographic Failures |
|
|
178
|
-
| `require-postmessage-origin-check` | A01: Broken Access Control |
|
|
179
|
+
| Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
180
|
+
| :--------------------------------- | :-: | :-------------------------: | :--: | :---------- | :-: | :-: | :-: | :-: | :-: |
|
|
181
|
+
| `no-eval` | | A03: Injection | | | | | | | |
|
|
182
|
+
| `no-innerhtml` | | A03: Injection | | | | | | | |
|
|
183
|
+
| `no-sensitive-localstorage` | | A02: Cryptographic Failures | | | | | | | |
|
|
184
|
+
| `require-postmessage-origin-check` | | A01: Broken Access Control | | | | | | | |
|
|
179
185
|
|
|
180
186
|
## 🤖 LLM-Optimized Messages
|
|
181
187
|
|
|
@@ -204,17 +210,17 @@ All rules include structured remediation guidance designed for AI assistants:
|
|
|
204
210
|
|
|
205
211
|
Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
|
|
206
212
|
|
|
207
|
-
| Plugin |
|
|
208
|
-
|
|
|
209
|
-
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) |
|
|
210
|
-
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) |
|
|
211
|
-
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) |
|
|
212
|
-
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) |
|
|
213
|
-
| [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) |
|
|
214
|
-
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) |
|
|
215
|
-
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) |
|
|
216
|
-
| [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) |
|
|
217
|
-
| [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) |
|
|
213
|
+
| Plugin | Downloads | Description | Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
|
|
214
|
+
| :--------------------------------------------------------------------------------------------------- | :-------: | :---------: | :--: | :-- | :---: | :--: | :---------: | :-: | :-: | --- | --- | --- |
|
|
215
|
+
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | | | | | | | | | |
|
|
216
|
+
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | | | | | | | | | |
|
|
217
|
+
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | | | | | | | | | |
|
|
218
|
+
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | | | | | | | | | |
|
|
219
|
+
| [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | | | | | | | | | |
|
|
220
|
+
| [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | | | | | | | | | |
|
|
221
|
+
| [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | | | | | | | | | |
|
|
222
|
+
| [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | | | | | | | | | |
|
|
223
|
+
| [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | | | | | | | | | |
|
|
218
224
|
|
|
219
225
|
## 📄 License
|
|
220
226
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-browser-security",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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",
|
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");
|