eslint-plugin-browser-security 1.2.8 → 1.2.10

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 (97) hide show
  1. package/package.json +21 -35
  2. package/src/index.d.ts +17 -64
  3. package/src/index.js +1 -76
  4. package/src/oxlint.d.ts +17 -20
  5. package/src/oxlint.js +0 -18
  6. package/src/rules/detect-mixed-content/index.js +0 -10
  7. package/src/rules/no-allow-arbitrary-loads/index.js +0 -10
  8. package/src/rules/no-clickjacking/index.js +0 -37
  9. package/src/rules/no-client-side-auth-logic/index.js +0 -11
  10. package/src/rules/no-cookie-auth-tokens/index.js +0 -13
  11. package/src/rules/no-credentials-in-query-params/index.js +0 -10
  12. package/src/rules/no-disabled-certificate-validation/index.js +0 -10
  13. package/src/rules/no-dynamic-service-worker-url/index.js +0 -9
  14. package/src/rules/no-eval/index.js +1 -14
  15. package/src/rules/no-filereader-innerhtml/index.js +0 -23
  16. package/src/rules/no-http-urls/index.js +0 -13
  17. package/src/rules/no-innerhtml/index.js +0 -25
  18. package/src/rules/no-insecure-redirects/index.js +3 -39
  19. package/src/rules/no-insecure-websocket/index.js +0 -12
  20. package/src/rules/no-jwt-in-storage/index.js +19 -42
  21. package/src/rules/no-missing-cors-check/index.js +4 -57
  22. package/src/rules/no-missing-csrf-protection/index.js +0 -23
  23. package/src/rules/no-missing-security-headers/index.js +0 -29
  24. package/src/rules/no-password-in-url/index.js +0 -11
  25. package/src/rules/no-permissive-cors/index.js +0 -13
  26. package/src/rules/no-postmessage-innerhtml/index.js +0 -18
  27. package/src/rules/no-postmessage-wildcard-origin/index.js +0 -10
  28. package/src/rules/no-sensitive-cookie-js/index.js +0 -18
  29. package/src/rules/no-sensitive-data-in-analytics/index.js +0 -11
  30. package/src/rules/no-sensitive-data-in-cache/index.js +0 -10
  31. package/src/rules/no-sensitive-indexeddb/index.js +0 -8
  32. package/src/rules/no-sensitive-localstorage/index.js +0 -11
  33. package/src/rules/no-sensitive-sessionstorage/index.js +0 -9
  34. package/src/rules/no-tracking-without-consent/index.js +0 -10
  35. package/src/rules/no-unencrypted-transmission/index.js +0 -32
  36. package/src/rules/no-unescaped-url-parameter/index.js +5 -47
  37. package/src/rules/no-unsafe-eval-csp/index.js +0 -10
  38. package/src/rules/no-unsafe-inline-csp/index.js +0 -10
  39. package/src/rules/no-unvalidated-deeplinks/index.js +0 -11
  40. package/src/rules/no-websocket-eval/index.js +0 -26
  41. package/src/rules/no-websocket-innerhtml/index.js +0 -20
  42. package/src/rules/no-worker-message-innerhtml/index.js +0 -23
  43. package/src/rules/require-blob-url-revocation/index.js +0 -10
  44. package/src/rules/require-cookie-secure-attrs/index.js +0 -7
  45. package/src/rules/require-csp-headers/index.js +0 -13
  46. package/src/rules/require-https-only/index.js +0 -13
  47. package/src/rules/require-mime-type-validation/index.js +0 -13
  48. package/src/rules/require-postmessage-origin-check/index.js +0 -17
  49. package/src/rules/require-url-validation/index.js +0 -12
  50. package/src/rules/require-websocket-wss/index.js +0 -17
  51. package/AGENTS.md +0 -97
  52. package/CHANGELOG.md +0 -169
  53. package/src/rules/detect-mixed-content/index.d.ts +0 -12
  54. package/src/rules/no-allow-arbitrary-loads/index.d.ts +0 -12
  55. package/src/rules/no-clickjacking/index.d.ts +0 -36
  56. package/src/rules/no-client-side-auth-logic/index.d.ts +0 -12
  57. package/src/rules/no-cookie-auth-tokens/index.d.ts +0 -23
  58. package/src/rules/no-credentials-in-query-params/index.d.ts +0 -12
  59. package/src/rules/no-disabled-certificate-validation/index.d.ts +0 -12
  60. package/src/rules/no-dynamic-service-worker-url/index.d.ts +0 -23
  61. package/src/rules/no-eval/index.d.ts +0 -26
  62. package/src/rules/no-filereader-innerhtml/index.d.ts +0 -24
  63. package/src/rules/no-http-urls/index.d.ts +0 -17
  64. package/src/rules/no-innerhtml/index.d.ts +0 -28
  65. package/src/rules/no-insecure-redirects/index.d.ts +0 -26
  66. package/src/rules/no-insecure-websocket/index.d.ts +0 -12
  67. package/src/rules/no-jwt-in-storage/index.d.ts +0 -24
  68. package/src/rules/no-missing-cors-check/index.d.ts +0 -28
  69. package/src/rules/no-missing-csrf-protection/index.d.ts +0 -30
  70. package/src/rules/no-missing-security-headers/index.d.ts +0 -26
  71. package/src/rules/no-password-in-url/index.d.ts +0 -12
  72. package/src/rules/no-permissive-cors/index.d.ts +0 -12
  73. package/src/rules/no-postmessage-innerhtml/index.d.ts +0 -24
  74. package/src/rules/no-postmessage-wildcard-origin/index.d.ts +0 -24
  75. package/src/rules/no-sensitive-cookie-js/index.d.ts +0 -26
  76. package/src/rules/no-sensitive-data-in-analytics/index.d.ts +0 -12
  77. package/src/rules/no-sensitive-data-in-cache/index.d.ts +0 -12
  78. package/src/rules/no-sensitive-indexeddb/index.d.ts +0 -23
  79. package/src/rules/no-sensitive-localstorage/index.d.ts +0 -28
  80. package/src/rules/no-sensitive-sessionstorage/index.d.ts +0 -25
  81. package/src/rules/no-tracking-without-consent/index.d.ts +0 -12
  82. package/src/rules/no-unencrypted-transmission/index.d.ts +0 -30
  83. package/src/rules/no-unescaped-url-parameter/index.d.ts +0 -28
  84. package/src/rules/no-unsafe-eval-csp/index.d.ts +0 -24
  85. package/src/rules/no-unsafe-inline-csp/index.d.ts +0 -24
  86. package/src/rules/no-unvalidated-deeplinks/index.d.ts +0 -12
  87. package/src/rules/no-websocket-eval/index.d.ts +0 -24
  88. package/src/rules/no-websocket-innerhtml/index.d.ts +0 -24
  89. package/src/rules/no-worker-message-innerhtml/index.d.ts +0 -24
  90. package/src/rules/require-blob-url-revocation/index.d.ts +0 -24
  91. package/src/rules/require-cookie-secure-attrs/index.d.ts +0 -23
  92. package/src/rules/require-csp-headers/index.d.ts +0 -12
  93. package/src/rules/require-https-only/index.d.ts +0 -12
  94. package/src/rules/require-mime-type-validation/index.d.ts +0 -12
  95. package/src/rules/require-postmessage-origin-check/index.d.ts +0 -26
  96. package/src/rules/require-url-validation/index.d.ts +0 -12
  97. package/src/rules/require-websocket-wss/index.d.ts +0 -26
package/AGENTS.md DELETED
@@ -1,97 +0,0 @@
1
- # AGENTS.md
2
-
3
- > Context for AI coding agents working on eslint-plugin-browser-security
4
-
5
- ## Setup Commands
6
-
7
- ```bash
8
- # Install dependencies (from monorepo root)
9
- npm install
10
-
11
- # Build this package
12
- nx build eslint-plugin-browser-security
13
-
14
- # Run tests
15
- nx test eslint-plugin-browser-security
16
-
17
- # Run tests with coverage
18
- nx test eslint-plugin-browser-security --coverage
19
-
20
- # Lint this package
21
- nx lint eslint-plugin-browser-security
22
- ```
23
-
24
- ## Code Style
25
-
26
- - TypeScript strict mode with `@interlace/eslint-devkit` types
27
- - Use `AST_NODE_TYPES` constants, never string literals for node types
28
- - Use `formatLLMMessage()` for all rule error messages
29
- - Include CWE, CVSS, OWASP in every security message
30
- - Use `c8 ignore` comments with documented reasons for untestable code
31
- - Single-pass AST traversal patterns (O(n) complexity)
32
-
33
- ## Testing Instructions
34
-
35
- - Tests use `@typescript-eslint/rule-tester` with Vitest
36
- - Each rule has `index.ts` (implementation) and `*.test.ts` (tests) in same directory
37
- - Run specific rule test: `nx test eslint-plugin-browser-security --testPathPattern="no-innerhtml"`
38
- - Coverage target: ≥90% lines, ≥95% functions
39
- - All tests must pass before committing
40
-
41
- ## Project Structure
42
-
43
- ```
44
- src/
45
- ├── index.ts # Plugin entry, exports rules and 7 configs
46
- └── rules/ # 21 rule directories
47
- └── [rule-name]/
48
- ├── index.ts # Rule implementation
49
- └── *.test.ts # Rule tests
50
- docs/rules/ # Markdown documentation per rule
51
- ```
52
-
53
- ## Plugin Purpose
54
-
55
- Security-focused ESLint plugin with **21 rules** for browser application security. Covers XSS prevention, postMessage abuse, storage security, cookie security, WebSocket vulnerabilities, File API, Workers, and CSP.
56
-
57
- ## Rule Categories
58
-
59
- | Category | Rules | CWEs |
60
- | ------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------ |
61
- | XSS Prevention | `no-innerhtml`, `no-eval` | 79, 95 |
62
- | postMessage | `require-postmessage-origin-check`, `no-postmessage-wildcard-origin`, `no-postmessage-innerhtml` | 79, 346 |
63
- | Storage | `no-sensitive-localstorage`, `no-sensitive-sessionstorage`, `no-sensitive-indexeddb`, `no-jwt-in-storage` | 922 |
64
- | Cookies | `no-sensitive-cookie-js`, `no-cookie-auth-tokens`, `require-cookie-secure-attrs` | 614, 1004 |
65
- | WebSocket | `require-websocket-wss`, `no-websocket-innerhtml`, `no-websocket-eval` | 79, 95, 319 |
66
- | File API & Workers | `no-filereader-innerhtml`, `require-blob-url-revocation`, `no-dynamic-service-worker-url`, `no-worker-message-innerhtml` | 79, 401, 829 |
67
- | CSP | `no-unsafe-inline-csp`, `no-unsafe-eval-csp` | 79, 95 |
68
-
69
- ## Common Fix Patterns
70
-
71
- ```typescript
72
- // XSS - innerHTML
73
- // BAD: element.innerHTML = userInput
74
- // GOOD: element.textContent = userInput
75
- // GOOD: element.innerHTML = DOMPurify.sanitize(userInput)
76
-
77
- // postMessage origin check
78
- // BAD: window.addEventListener('message', (e) => process(e.data))
79
- // GOOD: window.addEventListener('message', (e) => {
80
- // if (e.origin !== 'https://trusted.com') return;
81
- // process(e.data);
82
- // })
83
-
84
- // Storage - JWT
85
- // BAD: localStorage.setItem('token', jwt)
86
- // GOOD: Use HttpOnly cookies set by server
87
-
88
- // WebSocket
89
- // BAD: new WebSocket('ws://example.com')
90
- // GOOD: new WebSocket('wss://example.com')
91
- ```
92
-
93
- ## Security Considerations
94
-
95
- - All rules map to OWASP Top 10 2021 categories
96
- - CWE coverage: 79, 95, 319, 346, 401, 614, 829, 922, 1004
97
- - Every rule message includes remediation guidance for both humans and LLMs
package/CHANGELOG.md DELETED
@@ -1,169 +0,0 @@
1
- ## [1.2.3] - 2026-02-08
2
-
3
- ## 1.2.8
4
-
5
- ### Patch Changes
6
-
7
- - [#269](https://github.com/ofri-peretz/eslint/pull/269) [`7028fe2`](https://github.com/ofri-peretz/eslint/commit/7028fe2668a42266d831014184dcef70e73101ad) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - docs: dual-logo README header (Interlace mark + ESLint mark side by side) and closing Interlace footer — refreshes the README rendered on npmjs.com. No runtime changes.
8
-
9
- - Updated dependencies [[`7028fe2`](https://github.com/ofri-peretz/eslint/commit/7028fe2668a42266d831014184dcef70e73101ad)]:
10
- - @interlace/eslint-devkit@1.4.2
11
-
12
- ## 1.2.7
13
-
14
- ### Patch Changes
15
-
16
- - [#252](https://github.com/ofri-peretz/eslint/pull/252) [`d67e395`](https://github.com/ofri-peretz/eslint/commit/d67e3953c2748ad36e6aebe0f24b1d04e518b4d0) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Fix Codecov badge showing "unknown" — switch from flag to component URL format
17
-
18
- ## 1.2.6
19
-
20
- ### Patch Changes
21
-
22
- - [#225](https://github.com/ofri-peretz/eslint/pull/225) [`34ff5a8`](https://github.com/ofri-peretz/eslint/commit/34ff5a8e6f5126c5d1c0a524759e0af2b5476b46) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - CI-only: pin all coverage thresholds at 100% (integration target, merges last).
23
-
24
- ## 1.2.5
25
-
26
- ### Patch Changes
27
-
28
- - [#213](https://github.com/ofri-peretz/eslint/pull/213) [`391dbe6`](https://github.com/ofri-peretz/eslint/commit/391dbe6b39f78d549379218567cb959649f8c614) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Align every security rule's `meta.docs.cvss` to the CVSS its finding actually
29
- emits. The emitted machine-readable message sources its `CVSS:x` from
30
- `CWE_MAPPING` via `formatLLMMessage` → `enrichFromCWE`, but the static
31
- `meta.docs.cvss` documentation field had drifted on 45 rules across these 7
32
- plugins — e.g. `no-hardcoded-credentials` documented `9.5` while emitting
33
- `CVSS:9.8` (the value the published article and SARIF/LLM consumers already
34
- read).
35
-
36
- This corrects the **documentation metadata only** — no emitted finding changes.
37
- Locked by `security-cvss-docs-consistency.lock.test.ts` (cross-plugin: every
38
- security rule's `meta.docs.cvss` must equal the CVSS it emits), the
39
- `no-hardcoded-credentials` rule lock (real ESLint `Linter` emission), and a
40
- devkit `enrichFromCWE` contract test pinning `CWE-798 → 9.8`.
41
-
42
- Follow-up (not in scope): 50 security rules document a CVSS that never appears
43
- in any emitted message (their messages carry no CWE), and several rules emit the
44
- generic CWE score where a rule-specific score may be warranted — both change
45
- emitted output and are separate decisions.
46
-
47
- ## 1.2.4
48
-
49
- ### Patch Changes
50
-
51
- - [#141](https://github.com/ofri-peretz/eslint/pull/141) [`38ab670`](https://github.com/ofri-peretz/eslint/commit/38ab670a0221684f4fd3d5dc3c05ddec7458ca2b) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - fix: remove false `meta.fixable: 'code'` declarations from 21 rules that had no `fix()` function
52
-
53
- Rules that declared `fixable: 'code'` in their ESLint meta without an actual `fix()` implementation would show the ⚡ auto-fix icon in editors and CI formatters but apply no change when `--fix` was run. This patch removes the misleading declaration from:
54
- - `browser-security/no-clickjacking`
55
- - `import-next/first`, `named`, `no-barrel-import`, `no-import-module-exports`, `no-namespace`
56
- - `node-security/no-buffer-overread`, `no-unsafe-dynamic-require`, `no-zip-slip`
57
- - `react-features/react-no-inline-functions`
58
- - `reliability/no-jsdoc-terminator-in-example` (uses `suggest`, not auto-fix; corrected to `hasSuggestions: true` only)
59
- - `secure-coding/no-directive-injection`, `no-electron-security-issues`, `no-graphql-injection`, `no-improper-sanitization`, `no-improper-type-validation`, `no-ldap-injection`, `no-unchecked-loop-condition`, `no-unlimited-resource-allocation`, `no-weak-password-recovery`, `no-xpath-injection`
60
-
61
- - Updated dependencies [[`736a5fe`](https://github.com/ofri-peretz/eslint/commit/736a5fed47e673f6157ea900b29fe2a54e4bc7df)]:
62
- - @interlace/eslint-devkit@1.4.1
63
-
64
- ### Bug Fixes
65
-
66
- - align codecov component IDs with full package names ([2831b968](https://github.com/ofri-peretz/eslint/commit/2831b968))
67
- - resolve all benchmark FN/FP across security rules ([45ffb791](https://github.com/ofri-peretz/eslint/commit/45ffb791))
68
-
69
- ### Documentation
70
-
71
- - fix changelog header format across all packages ([c3a15082](https://github.com/ofri-peretz/eslint/commit/c3a15082))
72
-
73
- ### ❤️ Thank You
74
-
75
- - Ofri Peretz
76
-
77
- ## [1.2.2] - 2026-02-06
78
-
79
- ### Bug Fixes
80
-
81
- - align codecov component names and update docs components ([0a59a86c](https://github.com/ofri-peretz/eslint/commit/0a59a86c))
82
-
83
- ### ❤️ Thank You
84
-
85
- - Ofri Peretz
86
-
87
- ## [1.2.1] - 2026-02-02
88
-
89
- This was a version bump only for eslint-plugin-browser-security to align it with other projects, there were no code changes.
90
-
91
- # Changelog
92
-
93
- All notable changes to `eslint-plugin-browser-security` will be documented in this file.
94
-
95
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
96
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
97
-
98
- ### Documentation
99
-
100
- - 📘 Launched new documentation site: [eslint.interlace.tools](https://eslint.interlace.tools/)
101
-
102
- ## [1.0.0] - 2025-12-29
103
-
104
- ### Added
105
-
106
- #### XSS Prevention Rules (2)
107
-
108
- - `no-innerhtml` - Detect dangerous innerHTML/outerHTML assignments (CWE-79)
109
- - `no-eval` - Detect eval(), new Function(), and string-based callbacks (CWE-95)
110
-
111
- #### postMessage Security Rules (3)
112
-
113
- - `require-postmessage-origin-check` - Require origin validation in message handlers (CWE-346)
114
- - `no-postmessage-wildcard-origin` - Prevent wildcard targetOrigin in postMessage (CWE-346)
115
- - `no-postmessage-innerhtml` - Prevent XSS via innerHTML in postMessage handlers (CWE-79)
116
-
117
- #### Storage Security Rules (4)
118
-
119
- - `no-sensitive-localstorage` - Prevent storing sensitive data in localStorage (CWE-922)
120
- - `no-sensitive-sessionstorage` - Prevent storing sensitive data in sessionStorage (CWE-922)
121
- - `no-sensitive-indexeddb` - Prevent storing sensitive data in IndexedDB (CWE-922)
122
- - `no-jwt-in-storage` - Prevent storing JWT tokens in browser storage (CWE-922)
123
-
124
- #### Cookie Security Rules (3)
125
-
126
- - `no-sensitive-cookie-js` - Prevent storing sensitive data in cookies via JavaScript (CWE-1004)
127
- - `no-cookie-auth-tokens` - Prevent auth tokens in JS-accessible cookies (CWE-1004)
128
- - `require-cookie-secure-attrs` - Require Secure and SameSite cookie attributes (CWE-614)
129
-
130
- #### WebSocket Security Rules (3)
131
-
132
- - `require-websocket-wss` - Require secure WebSocket connections (wss://) (CWE-319)
133
- - `no-websocket-innerhtml` - Prevent XSS via innerHTML in WebSocket handlers (CWE-79)
134
- - `no-websocket-eval` - Prevent RCE via eval() in WebSocket handlers (CWE-95)
135
-
136
- #### File API & Workers Security Rules (4)
137
-
138
- - `no-filereader-innerhtml` - Prevent XSS via innerHTML with FileReader data (CWE-79)
139
- - `require-blob-url-revocation` - Require revoking Blob URLs to prevent memory leaks (CWE-401)
140
- - `no-dynamic-service-worker-url` - Prevent dynamic URLs in service worker registration (CWE-829)
141
- - `no-worker-message-innerhtml` - Prevent XSS via innerHTML in Worker message handlers (CWE-79)
142
-
143
- #### CSP Security Rules (2)
144
-
145
- - `no-unsafe-inline-csp` - Disallow 'unsafe-inline' in CSP (CWE-79)
146
- - `no-unsafe-eval-csp` - Disallow 'unsafe-eval' in CSP (CWE-95)
147
-
148
- #### Presets (7)
149
-
150
- - `recommended` - Balanced security defaults
151
- - `strict` - All 21 rules as errors
152
- - `xss` - XSS-focused rules only
153
- - `storage` - Storage security rules only
154
- - `postmessage` - postMessage security rules only
155
- - `websocket` - WebSocket security rules only
156
- - `cookies` - Cookie security rules only
157
-
158
- #### Features
159
-
160
- - LLM-optimized error messages with CWE references
161
- - OWASP Top 10 2021 alignment
162
- - TypeScript support with exported option types
163
- - Comprehensive test coverage (297 tests, 97.73% line coverage)
164
- - Auto-fix suggestions where safe
165
-
166
- ### Security
167
-
168
- - Covers 8 CWEs: 79, 95, 319, 346, 401, 614, 829, 922, 1004
169
- - Maps to OWASP Top 10 2021: A01, A02, A03
@@ -1,12 +0,0 @@
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 {};
@@ -1,12 +0,0 @@
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 {};
@@ -1,36 +0,0 @@
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 {};
@@ -1,12 +0,0 @@
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 noClientSideAuthLogic: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
10
- name: string;
11
- };
12
- export {};
@@ -1,23 +0,0 @@
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';
15
- export interface Options {
16
- /** Allow in test files. Default: true */
17
- allowInTests?: boolean;
18
- }
19
- type RuleOptions = [Options?];
20
- export declare const noCookieAuthTokens: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
21
- name: string;
22
- };
23
- export {};
@@ -1,12 +0,0 @@
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 noCredentialsInQueryParams: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
10
- name: string;
11
- };
12
- export {};
@@ -1,12 +0,0 @@
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 noDisabledCertificateValidation: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
10
- name: string;
11
- };
12
- export {};
@@ -1,23 +0,0 @@
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';
15
- export interface Options {
16
- /** Allow in test files. Default: true */
17
- allowInTests?: boolean;
18
- }
19
- type RuleOptions = [Options?];
20
- export declare const noDynamicServiceWorkerUrl: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
21
- name: string;
22
- };
23
- export {};
@@ -1,26 +0,0 @@
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';
16
- export interface Options {
17
- /** Allow in test files. Default: false */
18
- allowInTests?: boolean;
19
- /** Allow Function constructor. Default: false */
20
- allowFunctionConstructor?: boolean;
21
- }
22
- type RuleOptions = [Options?];
23
- export declare const noEval: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
- name: string;
25
- };
26
- export {};
@@ -1,24 +0,0 @@
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';
16
- export interface Options {
17
- /** Allow in test files. Default: true */
18
- allowInTests?: boolean;
19
- }
20
- type RuleOptions = [Options?];
21
- export declare const noFilereaderInnerhtml: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
- name: string;
23
- };
24
- export {};
@@ -1,17 +0,0 @@
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
- type MessageIds = 'insecureHttp' | 'insecureHttpWithException';
7
- export interface Options {
8
- /** List of hostnames allowed to use HTTP (e.g., localhost, 127.0.0.1) */
9
- allowedHosts?: string[];
10
- /** List of ports allowed for HTTP (e.g., 3000, 8080 for development) */
11
- allowedPorts?: number[];
12
- }
13
- type RuleOptions = [Options?];
14
- export declare const noHttpUrls: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
15
- name: string;
16
- };
17
- export {};
@@ -1,28 +0,0 @@
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';
16
- export interface Options {
17
- /** Allow innerHTML in test files. Default: false */
18
- allowInTests?: boolean;
19
- /** Trusted sanitizer function names. Default: ['DOMPurify.sanitize', 'sanitize', 'sanitizeHtml'] */
20
- trustedSanitizers?: string[];
21
- /** Allow innerHTML with literal strings. Default: true */
22
- allowLiteralStrings?: boolean;
23
- }
24
- type RuleOptions = [Options?];
25
- export declare const noInnerhtml: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
26
- name: string;
27
- };
28
- export {};
@@ -1,26 +0,0 @@
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-insecure-redirects
8
- * Detects open redirect vulnerabilities
9
- * CWE-601: URL Redirection to Untrusted Site ('Open Redirect')
10
- *
11
- * @see https://cwe.mitre.org/data/definitions/601.html
12
- * @see https://owasp.org/www-community/vulnerabilities/Unvalidated_Redirects_and_Forwards
13
- */
14
- import type { TSESLint } from '@interlace/eslint-devkit';
15
- type MessageIds = 'insecureRedirect' | 'whitelistDomains' | 'validateRedirect' | 'useRelativeUrl';
16
- export interface Options {
17
- /** Ignore in test files. Default: true */
18
- ignoreInTests?: boolean;
19
- /** Allowed redirect domains. Default: [] */
20
- allowedDomains?: string[];
21
- }
22
- type RuleOptions = [Options?];
23
- export declare const noInsecureRedirects: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
24
- name: string;
25
- };
26
- export {};
@@ -1,12 +0,0 @@
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 noInsecureWebsocket: import("@typescript-eslint/utils/ts-eslint").RuleModule<"violationDetected", RuleOptions, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
10
- name: string;
11
- };
12
- export {};
@@ -1,24 +0,0 @@
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';
16
- export interface Options {
17
- /** Allow in test files. Default: true */
18
- allowInTests?: boolean;
19
- }
20
- type RuleOptions = [Options?];
21
- export declare const noJwtInStorage: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
- name: string;
23
- };
24
- export {};
@@ -1,28 +0,0 @@
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-missing-cors-check
8
- * Detects missing CORS validation (wildcard CORS, missing origin check)
9
- * CWE-346: Origin Validation Error
10
- *
11
- * @see https://cwe.mitre.org/data/definitions/346.html
12
- * @see https://owasp.org/www-community/attacks/CORS_Misconfiguration
13
- */
14
- import type { TSESLint } from '@interlace/eslint-devkit';
15
- type MessageIds = 'missingCorsCheck' | 'useOriginValidation' | 'useCorsMiddleware';
16
- export interface Options {
17
- /** Allow missing CORS checks in test files. Default: false */
18
- allowInTests?: boolean;
19
- /** Trusted CORS libraries. Default: ['cors', '@koa/cors', 'express-cors'] */
20
- trustedLibraries?: string[];
21
- /** Additional safe patterns to ignore. Default: [] */
22
- ignorePatterns?: string[];
23
- }
24
- type RuleOptions = [Options?];
25
- export declare const noMissingCorsCheck: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
26
- name: string;
27
- };
28
- export {};
@@ -1,30 +0,0 @@
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-missing-csrf-protection
8
- * Detects missing CSRF token validation in POST/PUT/DELETE requests
9
- * CWE-352: Cross-Site Request Forgery (CSRF)
10
- *
11
- * @see https://cwe.mitre.org/data/definitions/352.html
12
- * @see https://owasp.org/www-community/attacks/csrf
13
- */
14
- import type { TSESLint } from '@interlace/eslint-devkit';
15
- type MessageIds = 'missingCsrfProtection' | 'addCsrfValidation';
16
- export interface Options {
17
- /** Allow missing CSRF protection in test files. Default: false */
18
- allowInTests?: boolean;
19
- /** CSRF middleware patterns to recognize. Default: ['csrf', 'csurf', 'csrfProtection', 'verifyCsrfToken'] */
20
- csrfMiddlewarePatterns?: string[];
21
- /** HTTP methods that require CSRF protection. Default: ['post', 'put', 'delete', 'patch'] */
22
- protectedMethods?: string[];
23
- /** Additional safe patterns to ignore. Default: [] */
24
- ignorePatterns?: string[];
25
- }
26
- type RuleOptions = [Options?];
27
- export declare const noMissingCsrfProtection: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
28
- name: string;
29
- };
30
- export {};