eslint-plugin-browser-security 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +21 -0
  3. package/README.md +60 -49
  4. package/package.json +2 -11
  5. package/src/index.d.ts +5 -0
  6. package/src/index.js +3 -16
  7. package/src/rules/no-cookie-auth-tokens/index.d.ts +17 -1
  8. package/src/rules/no-cookie-auth-tokens/index.js +5 -0
  9. package/src/rules/no-dynamic-service-worker-url/index.d.ts +17 -1
  10. package/src/rules/no-dynamic-service-worker-url/index.js +5 -0
  11. package/src/rules/no-eval/index.d.ts +18 -1
  12. package/src/rules/no-eval/index.js +5 -0
  13. package/src/rules/no-filereader-innerhtml/index.d.ts +18 -1
  14. package/src/rules/no-filereader-innerhtml/index.js +5 -0
  15. package/src/rules/no-innerhtml/index.d.ts +18 -1
  16. package/src/rules/no-innerhtml/index.js +5 -0
  17. package/src/rules/no-jwt-in-storage/index.d.ts +18 -1
  18. package/src/rules/no-jwt-in-storage/index.js +5 -0
  19. package/src/rules/no-postmessage-innerhtml/index.d.ts +18 -1
  20. package/src/rules/no-postmessage-innerhtml/index.js +5 -0
  21. package/src/rules/no-postmessage-wildcard-origin/index.d.ts +18 -1
  22. package/src/rules/no-postmessage-wildcard-origin/index.js +5 -0
  23. package/src/rules/no-sensitive-cookie-js/index.d.ts +18 -1
  24. package/src/rules/no-sensitive-cookie-js/index.js +5 -0
  25. package/src/rules/no-sensitive-indexeddb/index.d.ts +17 -1
  26. package/src/rules/no-sensitive-indexeddb/index.js +5 -0
  27. package/src/rules/no-sensitive-localstorage/index.d.ts +18 -1
  28. package/src/rules/no-sensitive-localstorage/index.js +5 -0
  29. package/src/rules/no-sensitive-sessionstorage/index.d.ts +17 -1
  30. package/src/rules/no-sensitive-sessionstorage/index.js +5 -0
  31. package/src/rules/no-unsafe-eval-csp/index.d.ts +18 -1
  32. package/src/rules/no-unsafe-eval-csp/index.js +5 -0
  33. package/src/rules/no-unsafe-inline-csp/index.d.ts +18 -1
  34. package/src/rules/no-unsafe-inline-csp/index.js +5 -0
  35. package/src/rules/no-websocket-eval/index.d.ts +18 -1
  36. package/src/rules/no-websocket-eval/index.js +5 -0
  37. package/src/rules/no-websocket-innerhtml/index.d.ts +18 -1
  38. package/src/rules/no-websocket-innerhtml/index.js +5 -0
  39. package/src/rules/no-worker-message-innerhtml/index.d.ts +18 -1
  40. package/src/rules/no-worker-message-innerhtml/index.js +5 -0
  41. package/src/rules/require-blob-url-revocation/index.d.ts +18 -1
  42. package/src/rules/require-blob-url-revocation/index.js +5 -0
  43. package/src/rules/require-cookie-secure-attrs/index.d.ts +17 -1
  44. package/src/rules/require-cookie-secure-attrs/index.js +5 -0
  45. package/src/rules/require-postmessage-origin-check/index.d.ts +18 -1
  46. package/src/rules/require-postmessage-origin-check/index.js +5 -0
  47. package/src/rules/require-websocket-wss/index.d.ts +18 -1
  48. 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,18 @@
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
  [![npm version](https://img.shields.io/npm/v/eslint-plugin-browser-security.svg)](https://www.npmjs.com/package/eslint-plugin-browser-security)
12
+ [![npm downloads](https://img.shields.io/npm/dm/eslint-plugin-browser-security.svg)](https://www.npmjs.com/package/eslint-plugin-browser-security)
6
13
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
14
  [![codecov](https://codecov.io/gh/ofri-peretz/eslint/graph/badge.svg?component=browser_security)](https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=browser_security)
15
+ [![Dec 2025](https://img.shields.io/badge/Dec_2025-blue?logo=rocket&logoColor=white)](https://github.com/ofri-peretz/eslint)
8
16
 
9
17
  ## 💡 What You Get
10
18
 
@@ -73,59 +81,59 @@ export default [browserSecurity.configs.recommended];
73
81
 
74
82
  ### XSS Prevention
75
83
 
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` | 💼 | | 💡 |
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` | 💼 | | | 💡 | |
80
88
 
81
89
  ### postMessage Security
82
90
 
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 | 💼 | | 💡 |
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 | 💼 | | | 💡 | |
88
96
 
89
97
  ### Storage Security
90
98
 
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 | 💼 | | 💡 |
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 | 💼 | | | 💡 | |
97
105
 
98
106
  ### Cookie Security
99
107
 
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 | 💼 | | 💡 |
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 | 💼 | | | 💡 | |
105
113
 
106
114
  ### WebSocket Security
107
115
 
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 | 💼 | | 💡 |
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 | 💼 | | | 💡 | |
113
121
 
114
122
  ### File API & Workers Security
115
123
 
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 | 💼 | | 💡 |
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 | 💼 | | | 💡 | |
122
130
 
123
131
  ### CSP Security
124
132
 
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 | 💼 | | 💡 |
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 | 💼 | | | 💡 | |
129
137
 
130
138
  ## 🔍 Detection Examples
131
139
 
@@ -168,12 +176,12 @@ window.addEventListener('message', (event) => {
168
176
 
169
177
  ## 🗂️ OWASP Coverage
170
178
 
171
- | Rule | OWASP Top 10 2021 | Category |
172
- | ---------------------------------- | --------------------------- | ----------------------- |
173
- | `no-eval` | A03: Injection | Code Injection |
174
- | `no-innerhtml` | A03: Injection | DOM XSS |
175
- | `no-sensitive-localstorage` | A02: Cryptographic Failures | Sensitive Data Exposure |
176
- | `require-postmessage-origin-check` | A01: Broken Access Control | Origin Validation |
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 | | | | | | | |
177
185
 
178
186
  ## 🤖 LLM-Optimized Messages
179
187
 
@@ -202,14 +210,17 @@ All rules include structured remediation guidance designed for AI assistants:
202
210
 
203
211
  Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
204
212
 
205
- | Plugin | Downloads | Description | Rules |
206
- | ------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------: | --------------------------- | :---: |
207
- | [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [![npm](https://img.shields.io/npm/dm/eslint-plugin-secure-coding.svg)](https://npmjs.com/package/eslint-plugin-secure-coding) | Universal security patterns | 89 |
208
- | [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [![npm](https://img.shields.io/npm/dm/eslint-plugin-crypto.svg)](https://npmjs.com/package/eslint-plugin-crypto) | Cryptographic security | 24 |
209
- | [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [![npm](https://img.shields.io/npm/dm/eslint-plugin-jwt.svg)](https://npmjs.com/package/eslint-plugin-jwt) | JWT handling security | 13 |
210
- | [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [![npm](https://img.shields.io/npm/dm/eslint-plugin-express-security.svg)](https://npmjs.com/package/eslint-plugin-express-security) | Express.js security | 8 |
211
- | [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | [![npm](https://img.shields.io/npm/dm/eslint-plugin-nestjs-security.svg)](https://npmjs.com/package/eslint-plugin-nestjs-security) | NestJS security | 5 |
212
- | [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | [![npm](https://img.shields.io/npm/dm/eslint-plugin-lambda-security.svg)](https://npmjs.com/package/eslint-plugin-lambda-security) | AWS Lambda security | 5 |
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) | | | | | | | | | |
213
224
 
214
225
  ## 📄 License
215
226
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-browser-security",
3
- "version": "1.0.4",
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",
@@ -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
@@ -1,3 +1,8 @@
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
+ */
1
6
  /**
2
7
  * eslint-plugin-browser-security
3
8
  *
package/src/index.js CHANGED
@@ -1,21 +1,8 @@
1
1
  "use strict";
2
2
  /**
3
- * eslint-plugin-browser-security
4
- *
5
- * Security-focused ESLint plugin for browser applications.
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
- export declare const noCookieAuthTokens: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noDynamicServiceWorkerUrl: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noEval: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noFilereaderInnerhtml: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noInnerhtml: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noJwtInStorage: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noPostmessageInnerhtml: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noPostmessageWildcardOrigin: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noSensitiveCookieJs: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noSensitiveIndexeddb: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noSensitiveLocalstorage: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noSensitiveSessionstorage: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noUnsafeEvalCsp: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noUnsafeInlineCsp: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noWebsocketEval: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noWebsocketInnerhtml: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const noWorkerMessageInnerhtml: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const requireBlobUrlRevocation: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const requireCookieSecureAttrs: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const requirePostmessageOriginCheck: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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
- export declare const requireWebsocketWss: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
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");