eslint-plugin-browser-security 1.1.1 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +2 -0
  2. package/README.md +78 -56
  3. package/package.json +6 -5
  4. package/src/index.js +62 -0
  5. package/src/rules/detect-mixed-content/index.d.ts +12 -0
  6. package/src/rules/detect-mixed-content/index.js +45 -0
  7. package/src/rules/no-allow-arbitrary-loads/index.d.ts +12 -0
  8. package/src/rules/no-allow-arbitrary-loads/index.js +48 -0
  9. package/src/rules/no-clickjacking/index.d.ts +36 -0
  10. package/src/rules/no-clickjacking/index.js +401 -0
  11. package/src/rules/no-client-side-auth-logic/index.d.ts +12 -0
  12. package/src/rules/no-client-side-auth-logic/index.js +74 -0
  13. package/src/rules/no-cookie-auth-tokens/index.d.ts +3 -1
  14. package/src/rules/no-credentials-in-query-params/index.d.ts +12 -0
  15. package/src/rules/no-credentials-in-query-params/index.js +62 -0
  16. package/src/rules/no-disabled-certificate-validation/index.d.ts +12 -0
  17. package/src/rules/no-disabled-certificate-validation/index.js +66 -0
  18. package/src/rules/no-dynamic-service-worker-url/index.d.ts +3 -1
  19. package/src/rules/no-eval/index.d.ts +3 -1
  20. package/src/rules/no-filereader-innerhtml/index.d.ts +3 -1
  21. package/src/rules/no-http-urls/index.d.ts +17 -0
  22. package/src/rules/no-http-urls/index.js +119 -0
  23. package/src/rules/no-innerhtml/index.d.ts +3 -1
  24. package/src/rules/no-insecure-redirects/index.d.ts +26 -0
  25. package/src/rules/no-insecure-redirects/index.js +221 -0
  26. package/src/rules/no-insecure-websocket/index.d.ts +12 -0
  27. package/src/rules/no-insecure-websocket/index.js +66 -0
  28. package/src/rules/no-jwt-in-storage/index.d.ts +3 -1
  29. package/src/rules/no-missing-cors-check/index.d.ts +28 -0
  30. package/src/rules/no-missing-cors-check/index.js +399 -0
  31. package/src/rules/no-missing-csrf-protection/index.d.ts +30 -0
  32. package/src/rules/no-missing-csrf-protection/index.js +185 -0
  33. package/src/rules/no-missing-security-headers/index.d.ts +26 -0
  34. package/src/rules/no-missing-security-headers/index.js +223 -0
  35. package/src/rules/no-password-in-url/index.d.ts +12 -0
  36. package/src/rules/no-password-in-url/index.js +55 -0
  37. package/src/rules/no-permissive-cors/index.d.ts +12 -0
  38. package/src/rules/no-permissive-cors/index.js +74 -0
  39. package/src/rules/no-postmessage-innerhtml/index.d.ts +3 -1
  40. package/src/rules/no-postmessage-wildcard-origin/index.d.ts +3 -1
  41. package/src/rules/no-sensitive-cookie-js/index.d.ts +3 -1
  42. package/src/rules/no-sensitive-data-in-analytics/index.d.ts +12 -0
  43. package/src/rules/no-sensitive-data-in-analytics/index.js +66 -0
  44. package/src/rules/no-sensitive-data-in-cache/index.d.ts +12 -0
  45. package/src/rules/no-sensitive-data-in-cache/index.js +53 -0
  46. package/src/rules/no-sensitive-indexeddb/index.d.ts +3 -1
  47. package/src/rules/no-sensitive-localstorage/index.d.ts +3 -1
  48. package/src/rules/no-sensitive-sessionstorage/index.d.ts +3 -1
  49. package/src/rules/no-tracking-without-consent/index.d.ts +12 -0
  50. package/src/rules/no-tracking-without-consent/index.js +72 -0
  51. package/src/rules/no-unencrypted-transmission/index.d.ts +30 -0
  52. package/src/rules/no-unencrypted-transmission/index.js +241 -0
  53. package/src/rules/no-unescaped-url-parameter/index.d.ts +28 -0
  54. package/src/rules/no-unescaped-url-parameter/index.js +357 -0
  55. package/src/rules/no-unsafe-eval-csp/index.d.ts +3 -1
  56. package/src/rules/no-unsafe-inline-csp/index.d.ts +3 -1
  57. package/src/rules/no-unvalidated-deeplinks/index.d.ts +12 -0
  58. package/src/rules/no-unvalidated-deeplinks/index.js +67 -0
  59. package/src/rules/no-websocket-eval/index.d.ts +3 -1
  60. package/src/rules/no-websocket-innerhtml/index.d.ts +3 -1
  61. package/src/rules/no-worker-message-innerhtml/index.d.ts +3 -1
  62. package/src/rules/require-blob-url-revocation/index.d.ts +3 -1
  63. package/src/rules/require-cookie-secure-attrs/index.d.ts +3 -1
  64. package/src/rules/require-csp-headers/index.d.ts +12 -0
  65. package/src/rules/require-csp-headers/index.js +69 -0
  66. package/src/rules/require-https-only/index.d.ts +12 -0
  67. package/src/rules/require-https-only/index.js +67 -0
  68. package/src/rules/require-mime-type-validation/index.d.ts +12 -0
  69. package/src/rules/require-mime-type-validation/index.js +71 -0
  70. package/src/rules/require-postmessage-origin-check/index.d.ts +3 -1
  71. package/src/rules/require-url-validation/index.d.ts +12 -0
  72. package/src/rules/require-url-validation/index.js +77 -0
  73. package/src/rules/require-websocket-wss/index.d.ts +3 -1
  74. package/AGENTS.md +0 -97
  75. package/CHANGELOG.md +0 -81
package/LICENSE CHANGED
@@ -19,3 +19,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+
package/README.md CHANGED
@@ -16,7 +16,8 @@
16
16
 
17
17
  ## Description
18
18
 
19
- This plugin provides a suite of browser-specific security rules designed to prevent Cross-Site Scripting (XSS) and other client-side vulnerabilities. It scans your code for dangerous patterns, such as unsafe DOM manipulation and insecure storage practices, offering real-time feedback to developers. Using this plugin ensures that your frontend applications adhere to modern security standards and protect user data effectively.
19
+ This plugin provides Browser-specific security rules to prevent XSS and other client-side attacks.
20
+ By using this plugin, you can proactively identify and mitigate security risks across your entire codebase.
20
21
 
21
22
  ## Philosophy
22
23
 
@@ -24,19 +25,18 @@ This plugin provides a suite of browser-specific security rules designed to prev
24
25
 
25
26
  ## Getting Started
26
27
 
27
- - To check out the [guide](https://eslint.interlace.tools/docs/browser-security), visit [eslint.interlace.tools](https://eslint.interlace.tools). 📚
28
- - 要查看中文 [指南](https://eslint.interlace.tools/docs/browser-security), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools). 📚
29
- - [가이드](https://eslint.interlace.tools/docs/browser-security) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools)에서 확인하실 수 있습니다. 📚
30
- - [ガイド](https://eslint.interlace.tools/docs/browser-security)は [eslint.interlace.tools](https://eslint.interlace.tools)でご確認ください。 📚
31
- - Para ver la [guía](https://eslint.interlace.tools/docs/browser-security), visita [eslint.interlace.tools](https://eslint.interlace.tools). 📚
32
- - للاطلاع على [الدليل](https://eslint.interlace.tools/docs/browser-security)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools). 📚
28
+ - To check out the [guide](https://eslint.interlace.tools/docs/security/plugin-browser-security), visit [eslint.interlace.tools](https://eslint.interlace.tools). 📚
29
+ - 要查看中文 [指南](https://eslint.interlace.tools/docs/security/plugin-browser-security), 请访问 [eslint.interlace.tools](https://eslint.interlace.tools). 📚
30
+ - [가이드](https://eslint.interlace.tools/docs/security/plugin-browser-security) 문서는 [eslint.interlace.tools](https://eslint.interlace.tools)에서 확인하실 수 있습니다. 📚
31
+ - [ガイド](https://eslint.interlace.tools/docs/security/plugin-browser-security)は [eslint.interlace.tools](https://eslint.interlace.tools)でご確認ください。 📚
32
+ - Para ver la [guía](https://eslint.interlace.tools/docs/security/plugin-browser-security), visita [eslint.interlace.tools](https://eslint.interlace.tools). 📚
33
+ - للاطلاع على [الدليل](https://eslint.interlace.tools/docs/security/plugin-browser-security)، قم بزيارة [eslint.interlace.tools](https://eslint.interlace.tools). 📚
33
34
 
34
35
  ```bash
35
36
  npm install eslint-plugin-browser-security --save-dev
36
37
  ```
37
38
 
38
39
  ## 💡 What You Get
39
-
40
40
  - **21 security rules** targeting browser-specific vulnerabilities
41
41
  - **XSS prevention** via DOM manipulation and dynamic content detection
42
42
  - **Storage security** preventing sensitive data exposure in localStorage/sessionStorage/IndexedDB
@@ -45,7 +45,6 @@ npm install eslint-plugin-browser-security --save-dev
45
45
  - **OWASP Top 10 coverage** for browser security patterns
46
46
 
47
47
  ## 🎯 Why This Plugin?
48
-
49
48
  Modern browser applications face unique security challenges across storage APIs, cross-origin communication, and dynamic content rendering. This plugin provides static analysis rules specifically designed for browser security patterns:
50
49
 
51
50
  - **XSS Prevention**: Detects dangerous DOM manipulation patterns
@@ -55,7 +54,6 @@ Modern browser applications face unique security challenges across storage APIs,
55
54
  - **LLM-Optimized**: All rules include AI-friendly remediation guidance
56
55
 
57
56
  ## 🔍 Detection Examples
58
-
59
57
  ### ❌ Vulnerable Code
60
58
 
61
59
  ```javascript
@@ -94,14 +92,12 @@ window.addEventListener('message', (event) => {
94
92
  ```
95
93
 
96
94
  ## ⚙️ Configuration Presets
97
-
98
95
  | Preset | Description |
99
96
  | :------------ | :-------------------------------------------------- |
100
97
  | `recommended` | Recommended security configuration |
101
98
  | `strict` | Strict security configuration - all rules as errors |
102
99
 
103
100
  ## 🤖 LLM-Optimized Messages
104
-
105
101
  All rules include structured remediation guidance designed for AI assistants:
106
102
 
107
103
  ```
@@ -129,58 +125,84 @@ By providing this structured context (CWE, OWASP, Fix), we enable AI tools to **
129
125
 
130
126
  **Legend**
131
127
 
132
- | Icon | Description |
133
- | :--: | :----------------------------------------------------------------- |
134
- | 💼 | **Recommended**: Included in the recommended preset. |
135
- | ⚠️ | **Warns**: Set towarn in recommended preset. |
136
- | 🔧 | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
137
- | 💡 | **Suggestions**: Providing code suggestions in IDE. |
138
- | 🚫 | **Deprecated**: This rule is deprecated. |
139
-
140
- | Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
141
- | :------------------------------------------------------------------------------------------------------------------------------ | :------: | :------: | :--: | :----------------------------------------------------------------------------------- | :-: | :-: | :-: | :-: | :-: |
142
- | [no-eval](https://eslint.interlace.tools/docs/browser-security/rules/no-eval) | CWE-95 | A03:2025 | 9.8 | [no-eval](./docs/rules/no-eval.md) | 💼 | | | 💡 | 🚫 |
143
- | [no-innerhtml](https://eslint.interlace.tools/docs/browser-security/rules/no-innerhtml) | CWE-79 | A03:2025 | 6.1 | [no-innerhtml](./docs/rules/no-innerhtml.md) | 💼 | | | 💡 | |
144
- | [require-postmessage-origin-check](https://eslint.interlace.tools/docs/browser-security/rules/require-postmessage-origin-check) | CWE-346 | A01:2025 | 8.8 | [require-postmessage-origin-check](./docs/rules/require-postmessage-origin-check.md) | 💼 | | | | |
145
- | [no-postmessage-wildcard-origin](https://eslint.interlace.tools/docs/browser-security/rules/no-postmessage-wildcard-origin) | CWE-346 | A01:2025 | 8.8 | [no-postmessage-wildcard-origin](./docs/rules/no-postmessage-wildcard-origin.md) | 💼 | | | | |
146
- | [no-postmessage-innerhtml](https://eslint.interlace.tools/docs/browser-security/rules/no-postmessage-innerhtml) | CWE-79 | A03:2025 | 6.1 | [no-postmessage-innerhtml](./docs/rules/no-postmessage-innerhtml.md) | 💼 | | | | |
147
- | [no-sensitive-localstorage](https://eslint.interlace.tools/docs/browser-security/rules/no-sensitive-localstorage) | CWE-922 | A02:2025 | 7.5 | [no-sensitive-localstorage](./docs/rules/no-sensitive-localstorage.md) | 💼 | | | 💡 | |
148
- | [no-sensitive-sessionstorage](https://eslint.interlace.tools/docs/browser-security/rules/no-sensitive-sessionstorage) | CWE-922 | A02:2025 | 7.5 | [no-sensitive-sessionstorage](./docs/rules/no-sensitive-sessionstorage.md) | 💼 | | | 💡 | |
149
- | [no-sensitive-indexeddb](https://eslint.interlace.tools/docs/browser-security/rules/no-sensitive-indexeddb) | CWE-922 | A02:2025 | 7.5 | [no-sensitive-indexeddb](./docs/rules/no-sensitive-indexeddb.md) | 💼 | | | 💡 | |
150
- | [no-jwt-in-storage](https://eslint.interlace.tools/docs/browser-security/rules/no-jwt-in-storage) | CWE-922 | A02:2025 | 7.5 | [no-jwt-in-storage](./docs/rules/no-jwt-in-storage.md) | 💼 | | | 💡 | |
151
- | [no-sensitive-cookie-js](https://eslint.interlace.tools/docs/browser-security/rules/no-sensitive-cookie-js) | CWE-1004 | A02:2025 | 5.3 | [no-sensitive-cookie-js](./docs/rules/no-sensitive-cookie-js.md) | 💼 | | | 💡 | |
152
- | [no-cookie-auth-tokens](https://eslint.interlace.tools/docs/browser-security/rules/no-cookie-auth-tokens) | CWE-1004 | A02:2025 | 5.3 | [no-cookie-auth-tokens](./docs/rules/no-cookie-auth-tokens.md) | 💼 | | | 💡 | |
153
- | [require-cookie-secure-attrs](https://eslint.interlace.tools/docs/browser-security/rules/require-cookie-secure-attrs) | CWE-614 | A05:2025 | 5.3 | [require-cookie-secure-attrs](./docs/rules/require-cookie-secure-attrs.md) | 💼 | | | | 🚫 |
154
- | [require-websocket-wss](https://eslint.interlace.tools/docs/browser-security/rules/require-websocket-wss) | CWE-319 | A02:2025 | 7.5 | [require-websocket-wss](./docs/rules/require-websocket-wss.md) | 💼 | | | 💡 | 🚫 |
155
- | [no-websocket-innerhtml](https://eslint.interlace.tools/docs/browser-security/rules/no-websocket-innerhtml) | CWE-79 | A03:2025 | 6.1 | [no-websocket-innerhtml](./docs/rules/no-websocket-innerhtml.md) | 💼 | | | 💡 | |
156
- | [no-websocket-eval](https://eslint.interlace.tools/docs/browser-security/rules/no-websocket-eval) | CWE-95 | A03:2025 | 9.8 | [no-websocket-eval](./docs/rules/no-websocket-eval.md) | 💼 | | | 💡 | |
157
- | [no-filereader-innerhtml](https://eslint.interlace.tools/docs/browser-security/rules/no-filereader-innerhtml) | CWE-79 | A03:2025 | 6.1 | [no-filereader-innerhtml](./docs/rules/no-filereader-innerhtml.md) | 💼 | | | 💡 | |
158
- | [require-blob-url-revocation](https://eslint.interlace.tools/docs/browser-security/rules/require-blob-url-revocation) | CWE-401 | A04:2025 | 5.3 | [require-blob-url-revocation](./docs/rules/require-blob-url-revocation.md) | 💼 | ⚠️ | | 💡 | |
159
- | [no-dynamic-service-worker-url](https://eslint.interlace.tools/docs/browser-security/rules/no-dynamic-service-worker-url) | CWE-829 | A08:2025 | 7.5 | [no-dynamic-service-worker-url](./docs/rules/no-dynamic-service-worker-url.md) | 💼 | | | 💡 | |
160
- | [no-worker-message-innerhtml](https://eslint.interlace.tools/docs/browser-security/rules/no-worker-message-innerhtml) | CWE-79 | A03:2025 | 6.1 | [no-worker-message-innerhtml](./docs/rules/no-worker-message-innerhtml.md) | 💼 | | | | |
161
- | [no-unsafe-inline-csp](https://eslint.interlace.tools/docs/browser-security/rules/no-unsafe-inline-csp) | CWE-79 | A03:2025 | 6.1 | [no-unsafe-inline-csp](./docs/rules/no-unsafe-inline-csp.md) | 💼 | | | 💡 | |
162
- | [no-unsafe-eval-csp](https://eslint.interlace.tools/docs/browser-security/rules/no-unsafe-eval-csp) | CWE-95 | A03:2025 | 9.8 | [no-unsafe-eval-csp](./docs/rules/no-unsafe-eval-csp.md) | 💼 | | | 💡 | |
128
+ | Icon | Description |
129
+ | :---: | :--- |
130
+ | 💼 | **Recommended**: Included in the recommended preset. |
131
+ | ⚠️ | **Warns**: Set towarn in recommended preset. |
132
+ | 🔧 | **Auto-fixable**: Automatically fixable by the `--fix` CLI option. |
133
+ | 💡 | **Suggestions**: Providing code suggestions in IDE. |
134
+ | 🚫 | **Deprecated**: This rule is deprecated. |
135
+
136
+ | Rule | CWE | OWASP | CVSS | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
137
+ | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: |
138
+ | [detect-mixed-content](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/detect-mixed-content) | | | | ESLint rule documentation for detect-mixed-content | | | | | |
139
+ | [no-allow-arbitrary-loads](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-allow-arbitrary-loads) | | | | ESLint rule documentation for no-allow-arbitrary-loads | | | | | |
140
+ | [no-clickjacking](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-clickjacking) | | | | ESLint rule documentation for no-clickjacking | | | | | |
141
+ | [no-client-side-auth-logic](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-client-side-auth-logic) | | | | ESLint rule documentation for no-client-side-auth-logic | | | | | |
142
+ | [no-cookie-auth-tokens](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-cookie-auth-tokens) | CWE-1004 | A02:2025 | 5.3 | ESLint rule documentation for no-cookie-auth-tokens | 💼 | | | 💡 | |
143
+ | [no-credentials-in-query-params](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-credentials-in-query-params) | | | | ESLint rule documentation for no-credentials-in-query-params | | | | | |
144
+ | [no-disabled-certificate-validation](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-disabled-certificate-validation) | | | | ESLint rule documentation for no-disabled-certificate-validation | | | | | |
145
+ | [no-dynamic-service-worker-url](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-dynamic-service-worker-url) | CWE-829 | A08:2025 | 7.5 | ESLint rule documentation for no-dynamic-service-worker-url | 💼 | | | 💡 | |
146
+ | [no-eval](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-eval) | CWE-95 | A03:2025 | 9.8 | ESLint rule documentation for no-eval | 💼 | | | 💡 | 🚫 |
147
+ | [no-filereader-innerhtml](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-filereader-innerhtml) | CWE-79 | A03:2025 | 6.1 | ESLint rule documentation for no-filereader-innerhtml | 💼 | | | 💡 | |
148
+ | [no-http-urls](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-http-urls) | | | | ESLint rule documentation for no-http-urls | | | | | |
149
+ | [no-innerhtml](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-innerhtml) | CWE-79 | A03:2025 | 6.1 | ESLint rule documentation for no-innerhtml | 💼 | | | 💡 | |
150
+ | [no-insecure-redirects](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-insecure-redirects) | | | | ESLint rule documentation for no-insecure-redirects | | | | | |
151
+ | [no-insecure-websocket](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-insecure-websocket) | | | | ESLint rule documentation for no-insecure-websocket | | | | | |
152
+ | [no-jwt-in-storage](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-jwt-in-storage) | CWE-922 | A02:2025 | 7.5 | ESLint rule documentation for no-jwt-in-storage | 💼 | | | 💡 | |
153
+ | [no-missing-cors-check](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-missing-cors-check) | | | | ESLint rule documentation for no-missing-cors-check | | | | | |
154
+ | [no-missing-csrf-protection](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-missing-csrf-protection) | | | | ESLint rule documentation for no-missing-csrf-protection | | | | | |
155
+ | [no-missing-security-headers](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-missing-security-headers) | | | | ESLint rule documentation for no-missing-security-headers | | | | | |
156
+ | [no-password-in-url](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-password-in-url) | | | | ESLint rule documentation for no-password-in-url | | | | | |
157
+ | [no-permissive-cors](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-permissive-cors) | | | | ESLint rule documentation for no-permissive-cors | | | | | |
158
+ | [no-postmessage-innerhtml](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-postmessage-innerhtml) | CWE-79 | A03:2025 | 6.1 | ESLint rule documentation for no-postmessage-innerhtml | 💼 | | | | |
159
+ | [no-postmessage-wildcard-origin](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-postmessage-wildcard-origin) | CWE-346 | A01:2025 | 8.8 | ESLint rule documentation for no-postmessage-wildcard-origin | 💼 | | | | |
160
+ | [no-sensitive-cookie-js](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-sensitive-cookie-js) | CWE-1004 | A02:2025 | 5.3 | ESLint rule documentation for no-sensitive-cookie-js | 💼 | | | 💡 | |
161
+ | [no-sensitive-data-in-analytics](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-sensitive-data-in-analytics) | | | | ESLint rule documentation for no-sensitive-data-in-analytics | | | | | |
162
+ | [no-sensitive-data-in-cache](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-sensitive-data-in-cache) | | | | ESLint rule documentation for no-sensitive-data-in-cache | | | | | |
163
+ | [no-sensitive-indexeddb](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-sensitive-indexeddb) | CWE-922 | A02:2025 | 7.5 | ESLint rule documentation for no-sensitive-indexeddb | 💼 | | | 💡 | |
164
+ | [no-sensitive-localstorage](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-sensitive-localstorage) | CWE-922 | A02:2025 | 7.5 | ESLint rule documentation for no-sensitive-localstorage | 💼 | | | 💡 | |
165
+ | [no-sensitive-sessionstorage](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-sensitive-sessionstorage) | CWE-922 | A02:2025 | 7.5 | ESLint rule documentation for no-sensitive-sessionstorage | 💼 | | | 💡 | |
166
+ | [no-tracking-without-consent](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-tracking-without-consent) | | | | ESLint rule documentation for no-tracking-without-consent | | | | | |
167
+ | [no-unencrypted-transmission](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-unencrypted-transmission) | | | | ESLint rule documentation for no-unencrypted-transmission | | | | | |
168
+ | [no-unescaped-url-parameter](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-unescaped-url-parameter) | | | | ESLint rule documentation for no-unescaped-url-parameter | | | | | |
169
+ | [no-unsafe-eval-csp](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-unsafe-eval-csp) | CWE-95 | A03:2025 | 9.8 | ESLint rule documentation for no-unsafe-eval-csp | 💼 | | | 💡 | |
170
+ | [no-unsafe-inline-csp](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-unsafe-inline-csp) | CWE-79 | A03:2025 | 6.1 | ESLint rule documentation for no-unsafe-inline-csp | 💼 | | | 💡 | |
171
+ | [no-unvalidated-deeplinks](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-unvalidated-deeplinks) | | | | ESLint rule documentation for no-unvalidated-deeplinks | | | | | |
172
+ | [no-websocket-eval](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-websocket-eval) | CWE-95 | A03:2025 | 9.8 | ESLint rule documentation for no-websocket-eval | 💼 | | | 💡 | |
173
+ | [no-websocket-innerhtml](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-websocket-innerhtml) | CWE-79 | A03:2025 | 6.1 | ESLint rule documentation for no-websocket-innerhtml | 💼 | | | 💡 | |
174
+ | [no-worker-message-innerhtml](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/no-worker-message-innerhtml) | CWE-79 | A03:2025 | 6.1 | ESLint rule documentation for no-worker-message-innerhtml | 💼 | | | | |
175
+ | [require-blob-url-revocation](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/require-blob-url-revocation) | CWE-401 | A04:2025 | 5.3 | ESLint rule documentation for require-blob-url-revocation | 💼 | ⚠️ | | 💡 | |
176
+ | [require-cookie-secure-attrs](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/require-cookie-secure-attrs) | CWE-614 | A05:2025 | 5.3 | ESLint rule documentation for require-cookie-secure-attrs | 💼 | | | | 🚫 |
177
+ | [require-csp-headers](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/require-csp-headers) | | | | ESLint rule documentation for require-csp-headers | | | | | |
178
+ | [require-https-only](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/require-https-only) | | | | ESLint rule documentation for require-https-only | | | | | |
179
+ | [require-mime-type-validation](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/require-mime-type-validation) | | | | ESLint rule documentation for require-mime-type-validation | | | | | |
180
+ | [require-postmessage-origin-check](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/require-postmessage-origin-check) | CWE-346 | A01:2025 | 8.8 | ESLint rule documentation for require-postmessage-origin-check | 💼 | | | | |
181
+ | [require-url-validation](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/require-url-validation) | | | | ESLint rule documentation for require-url-validation | | | | | |
182
+ | [require-websocket-wss](https://eslint.interlace.tools/docs/security/plugin-browser-security/rules/require-websocket-wss) | CWE-319 | A02:2025 | 7.5 | ESLint rule documentation for require-websocket-wss | 💼 | | | 💡 | 🚫 |
163
183
 
164
184
  ## 🔗 Related ESLint Plugins
165
185
 
166
186
  Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
167
187
 
168
- | Plugin | Downloads | Description |
169
- | :--------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------- |
170
- | [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-secure-coding.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-secure-coding) | General security rules & OWASP guidelines. |
171
- | [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-pg.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL security & best practices. |
172
- | [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-crypto.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-crypto) | NodeJS Cryptography security rules. |
173
- | [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-jwt.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
174
- | [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-vercel-ai-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security rules. |
175
- | [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-express-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-express-security) | Express.js security hardening rules. |
176
- | [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-lambda-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-lambda-security) | AWS Lambda security best practices. |
177
- | [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-nestjs-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | NestJS security rules & patterns. |
178
- | [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-import-next.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-import-next) | Next-gen import sorting & architecture. |
188
+ | Plugin | Downloads | Description |
189
+ | :--- | :---: | :--- |
190
+ | [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-secure-coding.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-secure-coding) | General security rules & OWASP guidelines. |
191
+ | [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-pg.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL security & best practices. |
192
+ | [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-crypto.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-crypto) | NodeJS Cryptography security rules. |
193
+ | [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-jwt.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security & best practices. |
194
+ | [`eslint-plugin-browser-security`](https://www.npmjs.com/package/eslint-plugin-browser-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-browser-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-browser-security) | Browser-specific security & XSS prevention. |
195
+ | [`eslint-plugin-express-security`](https://www.npmjs.com/package/eslint-plugin-express-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-express-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-express-security) | Express.js security hardening rules. |
196
+ | [`eslint-plugin-lambda-security`](https://www.npmjs.com/package/eslint-plugin-lambda-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-lambda-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-lambda-security) | AWS Lambda security best practices. |
197
+ | [`eslint-plugin-nestjs-security`](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-nestjs-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-nestjs-security) | NestJS security rules & patterns. |
198
+ | [`eslint-plugin-mongodb-security`](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-mongodb-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-mongodb-security) | MongoDB security best practices. |
199
+ | [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-vercel-ai-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security hardening. |
200
+ | [`eslint-plugin-import-next`](https://www.npmjs.com/package/eslint-plugin-import-next) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-import-next.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-import-next) | Next-gen import sorting & architecture. |
179
201
 
180
202
  ## 📄 License
181
203
 
182
204
  MIT © [Ofri Peretz](https://github.com/ofri-peretz)
183
205
 
184
206
  <p align="center">
185
- <a href="https://eslint.interlace.tools/docs/browser-security"><img src="https://eslint.interlace.tools/images/og-browser-security.png" alt="ESLint Interlace Plugin" width="300" /></a>
186
- </p>
207
+ <a href="https://eslint.interlace.tools/docs/security/plugin-browser-security"><img src="https://eslint.interlace.tools/images/og-browser-security.png" alt="ESLint Interlace Plugin" width="100%" /></a>
208
+ </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-browser-security",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "Security-focused ESLint plugin for browser applications. Detects XSS vulnerabilities, postMessage abuse, localStorage/sessionStorage/IndexedDB token exposure, cookie security issues, WebSocket security, Blob URL leaks, Service Worker risks, and CSP misconfigurations.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -17,10 +17,10 @@
17
17
  },
18
18
  "author": "Ofri Peretz <ofriperetzdev@gmail.com>",
19
19
  "license": "MIT",
20
- "homepage": "https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-browser-security/README.md",
20
+ "homepage": "https://github.com/ofri-peretz/eslint/tree/main/packages/eslint-plugin-browser-security#readme",
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "git+https://github.com/ofri-peretz/eslint.git",
23
+ "url": "https://github.com/ofri-peretz/eslint",
24
24
  "directory": "packages/eslint-plugin-browser-security"
25
25
  },
26
26
  "bugs": {
@@ -41,6 +41,7 @@
41
41
  "eslint",
42
42
  "eslint-plugin",
43
43
  "eslintplugin",
44
+ "interlace-security",
44
45
  "browser",
45
46
  "browser-security",
46
47
  "web-security",
@@ -72,8 +73,8 @@
72
73
  "node": ">=18.0.0"
73
74
  },
74
75
  "dependencies": {
75
- "@interlace/eslint-devkit": "^1.2.1",
76
- "tslib": "^2.8.1"
76
+ "tslib": "^2.3.0",
77
+ "@interlace/eslint-devkit": "^1.2.1"
77
78
  },
78
79
  "peerDependencies": {},
79
80
  "devDependencies": {
package/src/index.js CHANGED
@@ -35,6 +35,32 @@ const no_worker_message_innerhtml_1 = require("./rules/no-worker-message-innerht
35
35
  // CSP Security
36
36
  const no_unsafe_inline_csp_1 = require("./rules/no-unsafe-inline-csp");
37
37
  const no_unsafe_eval_csp_1 = require("./rules/no-unsafe-eval-csp");
38
+ // Migrated rules from secure-coding
39
+ const detect_mixed_content_1 = require("./rules/detect-mixed-content");
40
+ const no_allow_arbitrary_loads_1 = require("./rules/no-allow-arbitrary-loads");
41
+ const no_clickjacking_1 = require("./rules/no-clickjacking");
42
+ const no_credentials_in_query_params_1 = require("./rules/no-credentials-in-query-params");
43
+ const no_http_urls_1 = require("./rules/no-http-urls");
44
+ const no_insecure_redirects_1 = require("./rules/no-insecure-redirects");
45
+ const no_insecure_websocket_1 = require("./rules/no-insecure-websocket");
46
+ const no_missing_cors_check_1 = require("./rules/no-missing-cors-check");
47
+ const no_missing_csrf_protection_1 = require("./rules/no-missing-csrf-protection");
48
+ const no_missing_security_headers_1 = require("./rules/no-missing-security-headers");
49
+ const no_password_in_url_1 = require("./rules/no-password-in-url");
50
+ const no_permissive_cors_1 = require("./rules/no-permissive-cors");
51
+ const no_sensitive_data_in_analytics_1 = require("./rules/no-sensitive-data-in-analytics");
52
+ const no_sensitive_data_in_cache_1 = require("./rules/no-sensitive-data-in-cache");
53
+ const no_tracking_without_consent_1 = require("./rules/no-tracking-without-consent");
54
+ const no_unencrypted_transmission_1 = require("./rules/no-unencrypted-transmission");
55
+ const no_unescaped_url_parameter_1 = require("./rules/no-unescaped-url-parameter");
56
+ const no_unvalidated_deeplinks_1 = require("./rules/no-unvalidated-deeplinks");
57
+ const require_csp_headers_1 = require("./rules/require-csp-headers");
58
+ const require_https_only_1 = require("./rules/require-https-only");
59
+ const require_url_validation_1 = require("./rules/require-url-validation");
60
+ const require_mime_type_validation_1 = require("./rules/require-mime-type-validation");
61
+ const no_disabled_certificate_validation_1 = require("./rules/no-disabled-certificate-validation");
62
+ // Migrated from secure-coding (browser-specific auth)
63
+ const no_client_side_auth_logic_1 = require("./rules/no-client-side-auth-logic");
38
64
  /**
39
65
  * Collection of all browser security ESLint rules
40
66
  */
@@ -68,6 +94,32 @@ exports.rules = {
68
94
  // CSP Security
69
95
  'no-unsafe-inline-csp': no_unsafe_inline_csp_1.noUnsafeInlineCsp,
70
96
  'no-unsafe-eval-csp': no_unsafe_eval_csp_1.noUnsafeEvalCsp,
97
+ // Migrated rules
98
+ 'detect-mixed-content': detect_mixed_content_1.detectMixedContent,
99
+ 'no-allow-arbitrary-loads': no_allow_arbitrary_loads_1.noAllowArbitraryLoads,
100
+ 'no-clickjacking': no_clickjacking_1.noClickjacking,
101
+ 'no-credentials-in-query-params': no_credentials_in_query_params_1.noCredentialsInQueryParams,
102
+ 'no-http-urls': no_http_urls_1.noHttpUrls,
103
+ 'no-insecure-redirects': no_insecure_redirects_1.noInsecureRedirects,
104
+ 'no-insecure-websocket': no_insecure_websocket_1.noInsecureWebsocket,
105
+ 'no-missing-cors-check': no_missing_cors_check_1.noMissingCorsCheck,
106
+ 'no-missing-csrf-protection': no_missing_csrf_protection_1.noMissingCsrfProtection,
107
+ 'no-missing-security-headers': no_missing_security_headers_1.noMissingSecurityHeaders,
108
+ 'no-password-in-url': no_password_in_url_1.noPasswordInUrl,
109
+ 'no-permissive-cors': no_permissive_cors_1.noPermissiveCors,
110
+ 'no-sensitive-data-in-analytics': no_sensitive_data_in_analytics_1.noSensitiveDataInAnalytics,
111
+ 'no-sensitive-data-in-cache': no_sensitive_data_in_cache_1.noSensitiveDataInCache,
112
+ 'no-tracking-without-consent': no_tracking_without_consent_1.noTrackingWithoutConsent,
113
+ 'no-unencrypted-transmission': no_unencrypted_transmission_1.noUnencryptedTransmission,
114
+ 'no-unescaped-url-parameter': no_unescaped_url_parameter_1.noUnescapedUrlParameter,
115
+ 'no-unvalidated-deeplinks': no_unvalidated_deeplinks_1.noUnvalidatedDeeplinks,
116
+ 'require-csp-headers': require_csp_headers_1.requireCspHeaders,
117
+ 'require-https-only': require_https_only_1.requireHttpsOnly,
118
+ 'require-url-validation': require_url_validation_1.requireUrlValidation,
119
+ 'require-mime-type-validation': require_mime_type_validation_1.requireMimeTypeValidation,
120
+ 'no-disabled-certificate-validation': no_disabled_certificate_validation_1.noDisabledCertificateValidation,
121
+ // Migrated from secure-coding
122
+ 'no-client-side-auth-logic': no_client_side_auth_logic_1.noClientSideAuthLogic,
71
123
  };
72
124
  /**
73
125
  * ESLint Plugin object
@@ -112,6 +164,16 @@ const recommendedRules = {
112
164
  // Medium - CSP Security
113
165
  'browser-security/no-unsafe-inline-csp': 'error',
114
166
  'browser-security/no-unsafe-eval-csp': 'error',
167
+ // Migrated Rules
168
+ 'browser-security/detect-mixed-content': 'error',
169
+ 'browser-security/no-allow-arbitrary-loads': 'error',
170
+ 'browser-security/no-clickjacking': 'error',
171
+ 'browser-security/no-credentials-in-query-params': 'error',
172
+ 'browser-security/no-http-urls': 'error',
173
+ 'browser-security/require-https-only': 'error',
174
+ 'browser-security/no-insecure-websocket': 'error',
175
+ 'browser-security/no-unvalidated-deeplinks': 'error',
176
+ 'browser-security/no-client-side-auth-logic': 'error',
115
177
  };
116
178
  /**
117
179
  * Preset configurations for browser security rules
@@ -0,0 +1,12 @@
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
+ export interface Options {
7
+ }
8
+ type RuleOptions = [Options?];
9
+ export declare const detectMixedContent: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
10
+ name: string;
11
+ };
12
+ export {};
@@ -0,0 +1,45 @@
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
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.detectMixedContent = void 0;
9
+ /**
10
+ * @fileoverview Detect HTTP resources in HTTPS pages
11
+ * @see https://owasp.org/www-project-mobile-top-10/
12
+ * @see https://cwe.mitre.org/data/definitions/311.html
13
+ */
14
+ const eslint_devkit_1 = require("@interlace/eslint-devkit");
15
+ exports.detectMixedContent = (0, eslint_devkit_1.createRule)({
16
+ name: 'detect-mixed-content',
17
+ meta: {
18
+ type: 'problem',
19
+ docs: {
20
+ description: 'Detect HTTP resources in HTTPS pages',
21
+ },
22
+ messages: {
23
+ violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
24
+ icon: eslint_devkit_1.MessageIcons.SECURITY,
25
+ issueName: 'violation Detected',
26
+ cwe: 'CWE-311',
27
+ description: 'Detect HTTP resources in HTTPS pages detected - Literal containing http:// in HTTPS context',
28
+ severity: 'MEDIUM',
29
+ fix: 'Review and apply secure practices',
30
+ documentationLink: 'https://cwe.mitre.org/data/definitions/311.html',
31
+ })
32
+ },
33
+ schema: [],
34
+ },
35
+ defaultOptions: [],
36
+ create(context) {
37
+ return {
38
+ Literal(node) {
39
+ if (typeof node.value === 'string' && node.value.startsWith('http://')) {
40
+ context.report({ node, messageId: 'violationDetected' });
41
+ }
42
+ },
43
+ };
44
+ },
45
+ });
@@ -0,0 +1,12 @@
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
+ export interface Options {
7
+ }
8
+ type RuleOptions = [Options?];
9
+ export declare const noAllowArbitraryLoads: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
10
+ name: string;
11
+ };
12
+ export {};
@@ -0,0 +1,48 @@
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
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.noAllowArbitraryLoads = void 0;
9
+ /**
10
+ * @fileoverview Prevent configuration allowing insecure loads
11
+ * @see https://owasp.org/www-project-mobile-top-10/
12
+ * @see https://cwe.mitre.org/data/definitions/749.html
13
+ */
14
+ const eslint_devkit_1 = require("@interlace/eslint-devkit");
15
+ exports.noAllowArbitraryLoads = (0, eslint_devkit_1.createRule)({
16
+ name: 'no-allow-arbitrary-loads',
17
+ meta: {
18
+ type: 'problem',
19
+ docs: {
20
+ description: 'Prevent configuration allowing insecure loads',
21
+ },
22
+ messages: {
23
+ violationDetected: (0, eslint_devkit_1.formatLLMMessage)({
24
+ icon: eslint_devkit_1.MessageIcons.SECURITY,
25
+ issueName: 'violation Detected',
26
+ cwe: 'CWE-295',
27
+ description: 'Prevent configuration allowing insecure loads detected - allowArbitraryLoads: true',
28
+ severity: 'HIGH',
29
+ fix: 'Review and apply secure practices',
30
+ documentationLink: 'https://cwe.mitre.org/data/definitions/295.html',
31
+ })
32
+ },
33
+ schema: [],
34
+ },
35
+ defaultOptions: [],
36
+ create(context) {
37
+ return {
38
+ Property(node) {
39
+ if (node.key.type === 'Identifier' &&
40
+ node.key.name === 'allowArbitraryLoads' &&
41
+ node.value.type === 'Literal' &&
42
+ node.value.value === true) {
43
+ context.report({ node, messageId: 'violationDetected' });
44
+ }
45
+ },
46
+ };
47
+ },
48
+ });
@@ -0,0 +1,36 @@
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-clickjacking
8
+ * Detects clickjacking vulnerabilities (CWE-1021)
9
+ *
10
+ * Clickjacking tricks users into clicking on invisible or disguised elements
11
+ * by overlaying them with transparent frames. This rule detects missing
12
+ * protections against clickjacking attacks.
13
+ *
14
+ * False Positive Reduction:
15
+ * This rule uses security utilities to reduce false positives by detecting:
16
+ * - Safe iframe usage patterns
17
+ * - Trusted frame sources
18
+ * - JSDoc annotations (@trusted-frame, @safe-iframe)
19
+ * - Frame-busting protections
20
+ */
21
+ import type { TSESLint } from '@interlace/eslint-devkit';
22
+ import { type SecurityRuleOptions } from '@interlace/eslint-devkit';
23
+ type MessageIds = 'clickjackingVulnerability' | 'missingFrameBusting' | 'unsafeIframeUsage' | 'missingXFrameOptions' | 'missingCspFrameAncestors' | 'transparentFrameOverlay' | 'frameManipulation' | 'implementFrameBusting' | 'useXFrameOptions' | 'setCspFrameAncestors' | 'strategyFrameProtection' | 'strategyContentSecurity' | 'strategyUserInteraction';
24
+ export interface Options extends SecurityRuleOptions {
25
+ /** Trusted iframe sources */
26
+ trustedSources?: string[];
27
+ /** Require frame-busting code */
28
+ requireFrameBusting?: boolean;
29
+ /** Detect transparent overlays */
30
+ detectTransparentOverlays?: boolean;
31
+ }
32
+ type RuleOptions = [Options?];
33
+ export declare const noClickjacking: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
34
+ name: string;
35
+ };
36
+ export {};