eslint-plugin-browser-security 1.2.9 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -22
- package/src/index.d.ts +17 -64
- package/src/index.js +1 -76
- package/src/oxlint.d.ts +17 -20
- package/src/oxlint.js +0 -18
- package/src/rules/detect-mixed-content/index.js +0 -10
- package/src/rules/no-allow-arbitrary-loads/index.js +0 -10
- package/src/rules/no-clickjacking/index.js +0 -37
- package/src/rules/no-client-side-auth-logic/index.js +0 -11
- package/src/rules/no-cookie-auth-tokens/index.js +0 -13
- package/src/rules/no-credentials-in-query-params/index.js +0 -10
- package/src/rules/no-disabled-certificate-validation/index.js +0 -10
- package/src/rules/no-dynamic-service-worker-url/index.js +0 -9
- package/src/rules/no-eval/index.js +1 -14
- package/src/rules/no-filereader-innerhtml/index.js +0 -23
- package/src/rules/no-http-urls/index.js +0 -13
- package/src/rules/no-innerhtml/index.js +0 -25
- package/src/rules/no-insecure-redirects/index.js +3 -39
- package/src/rules/no-insecure-websocket/index.js +0 -12
- package/src/rules/no-jwt-in-storage/index.js +19 -42
- package/src/rules/no-missing-cors-check/index.js +4 -57
- package/src/rules/no-missing-csrf-protection/index.js +0 -23
- package/src/rules/no-missing-security-headers/index.js +0 -29
- package/src/rules/no-password-in-url/index.js +0 -11
- package/src/rules/no-permissive-cors/index.js +0 -13
- package/src/rules/no-postmessage-innerhtml/index.js +0 -18
- package/src/rules/no-postmessage-wildcard-origin/index.js +0 -10
- package/src/rules/no-sensitive-cookie-js/index.js +0 -18
- package/src/rules/no-sensitive-data-in-analytics/index.js +0 -11
- package/src/rules/no-sensitive-data-in-cache/index.js +0 -10
- package/src/rules/no-sensitive-indexeddb/index.js +0 -8
- package/src/rules/no-sensitive-localstorage/index.js +0 -11
- package/src/rules/no-sensitive-sessionstorage/index.js +0 -9
- package/src/rules/no-tracking-without-consent/index.js +0 -10
- package/src/rules/no-unencrypted-transmission/index.js +0 -32
- package/src/rules/no-unescaped-url-parameter/index.js +5 -47
- package/src/rules/no-unsafe-eval-csp/index.js +0 -10
- package/src/rules/no-unsafe-inline-csp/index.js +0 -10
- package/src/rules/no-unvalidated-deeplinks/index.js +0 -11
- package/src/rules/no-websocket-eval/index.js +0 -26
- package/src/rules/no-websocket-innerhtml/index.js +0 -20
- package/src/rules/no-worker-message-innerhtml/index.js +0 -23
- package/src/rules/require-blob-url-revocation/index.js +0 -10
- package/src/rules/require-cookie-secure-attrs/index.js +0 -7
- package/src/rules/require-csp-headers/index.js +0 -13
- package/src/rules/require-https-only/index.js +0 -13
- package/src/rules/require-mime-type-validation/index.js +0 -13
- package/src/rules/require-postmessage-origin-check/index.js +0 -17
- package/src/rules/require-url-validation/index.js +0 -12
- package/src/rules/require-websocket-wss/index.js +0 -17
- package/AGENTS.md +0 -97
- package/CHANGELOG.md +0 -188
- package/src/rules/detect-mixed-content/index.d.ts +0 -12
- package/src/rules/no-allow-arbitrary-loads/index.d.ts +0 -12
- package/src/rules/no-clickjacking/index.d.ts +0 -36
- package/src/rules/no-client-side-auth-logic/index.d.ts +0 -12
- package/src/rules/no-cookie-auth-tokens/index.d.ts +0 -23
- package/src/rules/no-credentials-in-query-params/index.d.ts +0 -12
- package/src/rules/no-disabled-certificate-validation/index.d.ts +0 -12
- package/src/rules/no-dynamic-service-worker-url/index.d.ts +0 -23
- package/src/rules/no-eval/index.d.ts +0 -26
- package/src/rules/no-filereader-innerhtml/index.d.ts +0 -24
- package/src/rules/no-http-urls/index.d.ts +0 -17
- package/src/rules/no-innerhtml/index.d.ts +0 -28
- package/src/rules/no-insecure-redirects/index.d.ts +0 -26
- package/src/rules/no-insecure-websocket/index.d.ts +0 -12
- package/src/rules/no-jwt-in-storage/index.d.ts +0 -24
- package/src/rules/no-missing-cors-check/index.d.ts +0 -28
- package/src/rules/no-missing-csrf-protection/index.d.ts +0 -30
- package/src/rules/no-missing-security-headers/index.d.ts +0 -26
- package/src/rules/no-password-in-url/index.d.ts +0 -12
- package/src/rules/no-permissive-cors/index.d.ts +0 -12
- package/src/rules/no-postmessage-innerhtml/index.d.ts +0 -24
- package/src/rules/no-postmessage-wildcard-origin/index.d.ts +0 -24
- package/src/rules/no-sensitive-cookie-js/index.d.ts +0 -26
- package/src/rules/no-sensitive-data-in-analytics/index.d.ts +0 -12
- package/src/rules/no-sensitive-data-in-cache/index.d.ts +0 -12
- package/src/rules/no-sensitive-indexeddb/index.d.ts +0 -23
- package/src/rules/no-sensitive-localstorage/index.d.ts +0 -28
- package/src/rules/no-sensitive-sessionstorage/index.d.ts +0 -25
- package/src/rules/no-tracking-without-consent/index.d.ts +0 -12
- package/src/rules/no-unencrypted-transmission/index.d.ts +0 -30
- package/src/rules/no-unescaped-url-parameter/index.d.ts +0 -28
- package/src/rules/no-unsafe-eval-csp/index.d.ts +0 -24
- package/src/rules/no-unsafe-inline-csp/index.d.ts +0 -24
- package/src/rules/no-unvalidated-deeplinks/index.d.ts +0 -12
- package/src/rules/no-websocket-eval/index.d.ts +0 -24
- package/src/rules/no-websocket-innerhtml/index.d.ts +0 -24
- package/src/rules/no-worker-message-innerhtml/index.d.ts +0 -24
- package/src/rules/require-blob-url-revocation/index.d.ts +0 -24
- package/src/rules/require-cookie-secure-attrs/index.d.ts +0 -23
- package/src/rules/require-csp-headers/index.d.ts +0 -12
- package/src/rules/require-https-only/index.d.ts +0 -12
- package/src/rules/require-mime-type-validation/index.d.ts +0 -12
- package/src/rules/require-postmessage-origin-check/index.d.ts +0 -26
- package/src/rules/require-url-validation/index.d.ts +0 -12
- 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,188 +0,0 @@
|
|
|
1
|
-
## [1.2.3] - 2026-02-08
|
|
2
|
-
|
|
3
|
-
## 1.2.9
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- [#294](https://github.com/ofri-peretz/eslint/pull/294) [`659f6dc`](https://github.com/ofri-peretz/eslint/commit/659f6dc0181b03b675f72b5949fcf123dd066358) Thanks [@ofri-peretz](https://github.com/ofri-peretz)! - Rewrite `description` and `keywords` on every published package for npm search discovery. npm ranks on name, description, and keywords, and the registry only picks up these fields at publish — so this is metadata-only and takes effect for each package on its next release.
|
|
8
|
-
|
|
9
|
-
**Descriptions now lead with the search phrase.** Every one starts `ESLint plugin for <the thing you'd search>` instead of a brand-first or category-first framing, and names the concrete vulnerabilities the plugin actually detects. Three were corrected while doing so:
|
|
10
|
-
|
|
11
|
-
- `eslint-plugin-import-next` claimed "100x faster no-cycle detection". No 100x measurement exists: `CLAIMS.md` records **3.1x end-to-end** (8x in pure rule execution) on a 5,483-file React codebase, and the highest number in any benchmark result is 54.9x on the synthetic corpus. The description now states the real-codebase figure.
|
|
12
|
-
- `eslint-plugin-secure-coding` claimed SQL injection, XSS and CSRF coverage — none of which are its rules. It now names what it does detect: LDAP, XPath, XXE, GraphQL and template injection, unsafe deserialization, ReDoS, missing authentication, and PII in logs.
|
|
13
|
-
- `eslint-plugin-secure-coding` ("89 rules") and `eslint-plugin-react-a11y` ("37 rules") hard-coded rule counts that had drifted from reality. Counts are generated into `interlace-numbers.json`; hand-typed copies are removed rather than corrected.
|
|
14
|
-
|
|
15
|
-
**Keywords now match the vocabulary of the plugins that rank.** `eslint-plugin-security`, `eslint-plugin-jsx-a11y`, `eslint-plugin-n` and `eslint-plugin-import` all carry the `eslint` / `eslintplugin` / `eslint-plugin` trio — six of our packages were missing `eslintplugin`, and every one now carries all three plus `static-analysis`, `linting` and `code-quality`. Security plugins add `sast`, `appsec` and `vulnerability`; `node-security` and `secure-coding` also carry `nodesecurity`, the exact keyword `eslint-plugin-security` ranks on. Each plugin gained the CWE identifiers and attack names for what it detects (`cwe-78` command injection, `cwe-22` path traversal, `cwe-89` SQL injection, `cwe-79` XSS, `cwe-347` JWT algorithm confusion, `cwe-352` CSRF, `cwe-943` NoSQL injection), and `node-security` gained the crypto vocabulary it had been missing entirely despite absorbing the crypto rule set (`crypto`, `cryptography`, `weak-hash`, `md5`, `sha1`, `timing-attack`).
|
|
16
|
-
|
|
17
|
-
No rule behavior, exports, or configuration changes.
|
|
18
|
-
|
|
19
|
-
- Updated dependencies [[`e1cdf83`](https://github.com/ofri-peretz/eslint/commit/e1cdf83e3db761907f0ab06f7fc6c1f1da7513a5), [`659f6dc`](https://github.com/ofri-peretz/eslint/commit/659f6dc0181b03b675f72b5949fcf123dd066358)]:
|
|
20
|
-
- @interlace/eslint-devkit@1.4.3
|
|
21
|
-
|
|
22
|
-
## 1.2.8
|
|
23
|
-
|
|
24
|
-
### Patch Changes
|
|
25
|
-
|
|
26
|
-
- [#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.
|
|
27
|
-
|
|
28
|
-
- Updated dependencies [[`7028fe2`](https://github.com/ofri-peretz/eslint/commit/7028fe2668a42266d831014184dcef70e73101ad)]:
|
|
29
|
-
- @interlace/eslint-devkit@1.4.2
|
|
30
|
-
|
|
31
|
-
## 1.2.7
|
|
32
|
-
|
|
33
|
-
### Patch Changes
|
|
34
|
-
|
|
35
|
-
- [#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
|
|
36
|
-
|
|
37
|
-
## 1.2.6
|
|
38
|
-
|
|
39
|
-
### Patch Changes
|
|
40
|
-
|
|
41
|
-
- [#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).
|
|
42
|
-
|
|
43
|
-
## 1.2.5
|
|
44
|
-
|
|
45
|
-
### Patch Changes
|
|
46
|
-
|
|
47
|
-
- [#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
|
|
48
|
-
emits. The emitted machine-readable message sources its `CVSS:x` from
|
|
49
|
-
`CWE_MAPPING` via `formatLLMMessage` → `enrichFromCWE`, but the static
|
|
50
|
-
`meta.docs.cvss` documentation field had drifted on 45 rules across these 7
|
|
51
|
-
plugins — e.g. `no-hardcoded-credentials` documented `9.5` while emitting
|
|
52
|
-
`CVSS:9.8` (the value the published article and SARIF/LLM consumers already
|
|
53
|
-
read).
|
|
54
|
-
|
|
55
|
-
This corrects the **documentation metadata only** — no emitted finding changes.
|
|
56
|
-
Locked by `security-cvss-docs-consistency.lock.test.ts` (cross-plugin: every
|
|
57
|
-
security rule's `meta.docs.cvss` must equal the CVSS it emits), the
|
|
58
|
-
`no-hardcoded-credentials` rule lock (real ESLint `Linter` emission), and a
|
|
59
|
-
devkit `enrichFromCWE` contract test pinning `CWE-798 → 9.8`.
|
|
60
|
-
|
|
61
|
-
Follow-up (not in scope): 50 security rules document a CVSS that never appears
|
|
62
|
-
in any emitted message (their messages carry no CWE), and several rules emit the
|
|
63
|
-
generic CWE score where a rule-specific score may be warranted — both change
|
|
64
|
-
emitted output and are separate decisions.
|
|
65
|
-
|
|
66
|
-
## 1.2.4
|
|
67
|
-
|
|
68
|
-
### Patch Changes
|
|
69
|
-
|
|
70
|
-
- [#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
|
|
71
|
-
|
|
72
|
-
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:
|
|
73
|
-
- `browser-security/no-clickjacking`
|
|
74
|
-
- `import-next/first`, `named`, `no-barrel-import`, `no-import-module-exports`, `no-namespace`
|
|
75
|
-
- `node-security/no-buffer-overread`, `no-unsafe-dynamic-require`, `no-zip-slip`
|
|
76
|
-
- `react-features/react-no-inline-functions`
|
|
77
|
-
- `reliability/no-jsdoc-terminator-in-example` (uses `suggest`, not auto-fix; corrected to `hasSuggestions: true` only)
|
|
78
|
-
- `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`
|
|
79
|
-
|
|
80
|
-
- Updated dependencies [[`736a5fe`](https://github.com/ofri-peretz/eslint/commit/736a5fed47e673f6157ea900b29fe2a54e4bc7df)]:
|
|
81
|
-
- @interlace/eslint-devkit@1.4.1
|
|
82
|
-
|
|
83
|
-
### Bug Fixes
|
|
84
|
-
|
|
85
|
-
- align codecov component IDs with full package names ([2831b968](https://github.com/ofri-peretz/eslint/commit/2831b968))
|
|
86
|
-
- resolve all benchmark FN/FP across security rules ([45ffb791](https://github.com/ofri-peretz/eslint/commit/45ffb791))
|
|
87
|
-
|
|
88
|
-
### Documentation
|
|
89
|
-
|
|
90
|
-
- fix changelog header format across all packages ([c3a15082](https://github.com/ofri-peretz/eslint/commit/c3a15082))
|
|
91
|
-
|
|
92
|
-
### ❤️ Thank You
|
|
93
|
-
|
|
94
|
-
- Ofri Peretz
|
|
95
|
-
|
|
96
|
-
## [1.2.2] - 2026-02-06
|
|
97
|
-
|
|
98
|
-
### Bug Fixes
|
|
99
|
-
|
|
100
|
-
- align codecov component names and update docs components ([0a59a86c](https://github.com/ofri-peretz/eslint/commit/0a59a86c))
|
|
101
|
-
|
|
102
|
-
### ❤️ Thank You
|
|
103
|
-
|
|
104
|
-
- Ofri Peretz
|
|
105
|
-
|
|
106
|
-
## [1.2.1] - 2026-02-02
|
|
107
|
-
|
|
108
|
-
This was a version bump only for eslint-plugin-browser-security to align it with other projects, there were no code changes.
|
|
109
|
-
|
|
110
|
-
# Changelog
|
|
111
|
-
|
|
112
|
-
All notable changes to `eslint-plugin-browser-security` will be documented in this file.
|
|
113
|
-
|
|
114
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
115
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
116
|
-
|
|
117
|
-
### Documentation
|
|
118
|
-
|
|
119
|
-
- 📘 Launched new documentation site: [eslint.interlace.tools](https://eslint.interlace.tools/)
|
|
120
|
-
|
|
121
|
-
## [1.0.0] - 2025-12-29
|
|
122
|
-
|
|
123
|
-
### Added
|
|
124
|
-
|
|
125
|
-
#### XSS Prevention Rules (2)
|
|
126
|
-
|
|
127
|
-
- `no-innerhtml` - Detect dangerous innerHTML/outerHTML assignments (CWE-79)
|
|
128
|
-
- `no-eval` - Detect eval(), new Function(), and string-based callbacks (CWE-95)
|
|
129
|
-
|
|
130
|
-
#### postMessage Security Rules (3)
|
|
131
|
-
|
|
132
|
-
- `require-postmessage-origin-check` - Require origin validation in message handlers (CWE-346)
|
|
133
|
-
- `no-postmessage-wildcard-origin` - Prevent wildcard targetOrigin in postMessage (CWE-346)
|
|
134
|
-
- `no-postmessage-innerhtml` - Prevent XSS via innerHTML in postMessage handlers (CWE-79)
|
|
135
|
-
|
|
136
|
-
#### Storage Security Rules (4)
|
|
137
|
-
|
|
138
|
-
- `no-sensitive-localstorage` - Prevent storing sensitive data in localStorage (CWE-922)
|
|
139
|
-
- `no-sensitive-sessionstorage` - Prevent storing sensitive data in sessionStorage (CWE-922)
|
|
140
|
-
- `no-sensitive-indexeddb` - Prevent storing sensitive data in IndexedDB (CWE-922)
|
|
141
|
-
- `no-jwt-in-storage` - Prevent storing JWT tokens in browser storage (CWE-922)
|
|
142
|
-
|
|
143
|
-
#### Cookie Security Rules (3)
|
|
144
|
-
|
|
145
|
-
- `no-sensitive-cookie-js` - Prevent storing sensitive data in cookies via JavaScript (CWE-1004)
|
|
146
|
-
- `no-cookie-auth-tokens` - Prevent auth tokens in JS-accessible cookies (CWE-1004)
|
|
147
|
-
- `require-cookie-secure-attrs` - Require Secure and SameSite cookie attributes (CWE-614)
|
|
148
|
-
|
|
149
|
-
#### WebSocket Security Rules (3)
|
|
150
|
-
|
|
151
|
-
- `require-websocket-wss` - Require secure WebSocket connections (wss://) (CWE-319)
|
|
152
|
-
- `no-websocket-innerhtml` - Prevent XSS via innerHTML in WebSocket handlers (CWE-79)
|
|
153
|
-
- `no-websocket-eval` - Prevent RCE via eval() in WebSocket handlers (CWE-95)
|
|
154
|
-
|
|
155
|
-
#### File API & Workers Security Rules (4)
|
|
156
|
-
|
|
157
|
-
- `no-filereader-innerhtml` - Prevent XSS via innerHTML with FileReader data (CWE-79)
|
|
158
|
-
- `require-blob-url-revocation` - Require revoking Blob URLs to prevent memory leaks (CWE-401)
|
|
159
|
-
- `no-dynamic-service-worker-url` - Prevent dynamic URLs in service worker registration (CWE-829)
|
|
160
|
-
- `no-worker-message-innerhtml` - Prevent XSS via innerHTML in Worker message handlers (CWE-79)
|
|
161
|
-
|
|
162
|
-
#### CSP Security Rules (2)
|
|
163
|
-
|
|
164
|
-
- `no-unsafe-inline-csp` - Disallow 'unsafe-inline' in CSP (CWE-79)
|
|
165
|
-
- `no-unsafe-eval-csp` - Disallow 'unsafe-eval' in CSP (CWE-95)
|
|
166
|
-
|
|
167
|
-
#### Presets (7)
|
|
168
|
-
|
|
169
|
-
- `recommended` - Balanced security defaults
|
|
170
|
-
- `strict` - All 21 rules as errors
|
|
171
|
-
- `xss` - XSS-focused rules only
|
|
172
|
-
- `storage` - Storage security rules only
|
|
173
|
-
- `postmessage` - postMessage security rules only
|
|
174
|
-
- `websocket` - WebSocket security rules only
|
|
175
|
-
- `cookies` - Cookie security rules only
|
|
176
|
-
|
|
177
|
-
#### Features
|
|
178
|
-
|
|
179
|
-
- LLM-optimized error messages with CWE references
|
|
180
|
-
- OWASP Top 10 2021 alignment
|
|
181
|
-
- TypeScript support with exported option types
|
|
182
|
-
- Comprehensive test coverage (297 tests, 97.73% line coverage)
|
|
183
|
-
- Auto-fix suggestions where safe
|
|
184
|
-
|
|
185
|
-
### Security
|
|
186
|
-
|
|
187
|
-
- Covers 8 CWEs: 79, 95, 319, 346, 401, 614, 829, 922, 1004
|
|
188
|
-
- 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 {};
|