eslint-plugin-browser-security 1.0.1 → 1.0.4

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 (2) hide show
  1. package/README.md +47 -45
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -67,63 +67,65 @@ import browserSecurity from 'eslint-plugin-browser-security';
67
67
  export default [browserSecurity.configs.recommended];
68
68
  ```
69
69
 
70
- ## 📋 Rules (21 total)
70
+ ## 🔐 Rules (21 total)
71
+
72
+ 💼 = Set in `recommended` | 🔧 = Auto-fixable | 💡 = Has suggestions
71
73
 
72
74
  ### XSS Prevention
73
75
 
74
- | Rule | Description | CVSS | CWE |
75
- | ---------------------------------------------- | --------------------------------------------------------------------------------- | ---- | ------ |
76
- | [`no-eval`](./docs/rules/no-eval.md) | Prevent code injection via `eval()`, `new Function()`, and string-based callbacks | 9.3 | CWE-95 |
77
- | [`no-innerhtml`](./docs/rules/no-innerhtml.md) | Prevent XSS via `innerHTML`, `outerHTML`, and `insertAdjacentHTML()` | 8.1 | CWE-79 |
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` | 💼 | | 💡 |
78
80
 
79
81
  ### postMessage Security
80
82
 
81
- | Rule | Description | CVSS | CWE |
82
- | -------------------------------------------------------------------------------------- | -------------------------------------------------- | ---- | ------- |
83
- | [`require-postmessage-origin-check`](./docs/rules/require-postmessage-origin-check.md) | Require origin validation in postMessage handlers | 9.3 | CWE-346 |
84
- | [`no-postmessage-wildcard-origin`](./docs/rules/no-postmessage-wildcard-origin.md) | Prevent wildcard targetOrigin in postMessage calls | 7.5 | CWE-346 |
85
- | [`no-postmessage-innerhtml`](./docs/rules/no-postmessage-innerhtml.md) | Prevent XSS via innerHTML in postMessage handlers | 8.8 | CWE-79 |
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 | 💼 | | 💡 |
86
88
 
87
89
  ### Storage Security
88
90
 
89
- | Rule | Description | CVSS | CWE |
90
- | ---------------------------------------------------------------------------- | ------------------------------------------------ | ---- | ------- |
91
- | [`no-sensitive-localstorage`](./docs/rules/no-sensitive-localstorage.md) | Prevent storing sensitive data in localStorage | 7.5 | CWE-922 |
92
- | [`no-sensitive-sessionstorage`](./docs/rules/no-sensitive-sessionstorage.md) | Prevent storing sensitive data in sessionStorage | 7.5 | CWE-922 |
93
- | [`no-sensitive-indexeddb`](./docs/rules/no-sensitive-indexeddb.md) | Prevent storing sensitive data in IndexedDB | 7.5 | CWE-922 |
94
- | [`no-jwt-in-storage`](./docs/rules/no-jwt-in-storage.md) | Prevent storing JWT tokens in browser storage | 8.1 | CWE-922 |
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 | 💼 | | 💡 |
95
97
 
96
98
  ### Cookie Security
97
99
 
98
- | Rule | Description | CVSS | CWE |
99
- | ---------------------------------------------------------------------------- | -------------------------------------------------------- | ---- | -------- |
100
- | [`no-sensitive-cookie-js`](./docs/rules/no-sensitive-cookie-js.md) | Prevent storing sensitive data in cookies via JavaScript | 8.1 | CWE-1004 |
101
- | [`no-cookie-auth-tokens`](./docs/rules/no-cookie-auth-tokens.md) | Prevent auth tokens in JS-accessible cookies | 8.5 | CWE-1004 |
102
- | [`require-cookie-secure-attrs`](./docs/rules/require-cookie-secure-attrs.md) | Require Secure and SameSite cookie attributes | 6.5 | CWE-614 |
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 | 💼 | | 💡 |
103
105
 
104
106
  ### WebSocket Security
105
107
 
106
- | Rule | Description | CVSS | CWE |
107
- | ------------------------------------------------------------------ | ----------------------------------------------- | ---- | ------- |
108
- | [`require-websocket-wss`](./docs/rules/require-websocket-wss.md) | Require secure WebSocket connections (wss://) | 7.5 | CWE-319 |
109
- | [`no-websocket-innerhtml`](./docs/rules/no-websocket-innerhtml.md) | Prevent XSS via innerHTML in WebSocket handlers | 8.1 | CWE-79 |
110
- | [`no-websocket-eval`](./docs/rules/no-websocket-eval.md) | Prevent RCE via eval() in WebSocket handlers | 9.8 | CWE-95 |
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 | 💼 | | 💡 |
111
113
 
112
114
  ### File API & Workers Security
113
115
 
114
- | Rule | Description | CVSS | CWE |
115
- | -------------------------------------------------------------------------------- | ---------------------------------------------------- | ---- | ------- |
116
- | [`no-filereader-innerhtml`](./docs/rules/no-filereader-innerhtml.md) | Prevent XSS via innerHTML with FileReader data | 8.1 | CWE-79 |
117
- | [`require-blob-url-revocation`](./docs/rules/require-blob-url-revocation.md) | Require revoking Blob URLs to prevent memory leaks | 5.3 | CWE-401 |
118
- | [`no-dynamic-service-worker-url`](./docs/rules/no-dynamic-service-worker-url.md) | Prevent dynamic URLs in service worker registration | 8.1 | CWE-829 |
119
- | [`no-worker-message-innerhtml`](./docs/rules/no-worker-message-innerhtml.md) | Prevent XSS via innerHTML in Worker message handlers | 7.5 | CWE-79 |
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 | 💼 | | 💡 |
120
122
 
121
123
  ### CSP Security
122
124
 
123
- | Rule | Description | CVSS | CWE |
124
- | -------------------------------------------------------------- | ------------------------------- | ---- | ------ |
125
- | [`no-unsafe-inline-csp`](./docs/rules/no-unsafe-inline-csp.md) | Disallow 'unsafe-inline' in CSP | 7.5 | CWE-79 |
126
- | [`no-unsafe-eval-csp`](./docs/rules/no-unsafe-eval-csp.md) | Disallow 'unsafe-eval' in CSP | 8.1 | CWE-95 |
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 | 💼 | | 💡 |
127
129
 
128
130
  ## 🔍 Detection Examples
129
131
 
@@ -198,16 +200,16 @@ All rules include structured remediation guidance designed for AI assistants:
198
200
 
199
201
  ## 🔗 Related Packages
200
202
 
201
- Part of the [Forge-JS ESLint Security Ecosystem](https://github.com/ofri-peretz/eslint):
203
+ Part of the **Interlace ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
202
204
 
203
- | Package | Focus |
204
- | --------------------------------------------------------------------- | --------------------------- |
205
- | [`eslint-plugin-secure-coding`](../eslint-plugin-secure-coding) | Universal security patterns |
206
- | [`eslint-plugin-crypto`](../eslint-plugin-crypto) | Cryptographic security |
207
- | [`eslint-plugin-jwt`](../eslint-plugin-jwt) | JWT handling security |
208
- | [`eslint-plugin-express-security`](../eslint-plugin-express-security) | Express.js security |
209
- | [`eslint-plugin-nestjs-security`](../eslint-plugin-nestjs-security) | NestJS security |
210
- | [`eslint-plugin-lambda-security`](../eslint-plugin-lambda-security) | AWS Lambda security |
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 |
211
213
 
212
214
  ## 📄 License
213
215
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-browser-security",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
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",
@@ -89,4 +89,4 @@
89
89
  "@vitest/coverage-v8": "^4.0.6",
90
90
  "vitest": "^4.0.6"
91
91
  }
92
- }
92
+ }