eslint-plugin-sdl-2 1.2.2 → 1.2.5
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/dist/_internal/ast-utils.d.ts.map +1 -1
- package/dist/_internal/ast-utils.js +9 -8
- package/dist/_internal/ast-utils.js.map +1 -1
- package/dist/_internal/create-rule.d.ts +3 -1
- package/dist/_internal/create-rule.d.ts.map +1 -1
- package/dist/_internal/create-rule.js +5 -1
- package/dist/_internal/create-rule.js.map +1 -1
- package/dist/_internal/domparser.d.ts.map +1 -1
- package/dist/_internal/domparser.js +8 -7
- package/dist/_internal/domparser.js.map +1 -1
- package/dist/_internal/electron-web-preferences.d.ts.map +1 -1
- package/dist/_internal/electron-web-preferences.js +12 -10
- package/dist/_internal/electron-web-preferences.js.map +1 -1
- package/dist/_internal/estree-utils.d.ts.map +1 -1
- package/dist/_internal/estree-utils.js +17 -15
- package/dist/_internal/estree-utils.js.map +1 -1
- package/dist/_internal/node-tls-config.d.ts.map +1 -1
- package/dist/_internal/node-tls-config.js +9 -8
- package/dist/_internal/node-tls-config.js.map +1 -1
- package/dist/_internal/rules-registry.d.ts.map +1 -1
- package/dist/_internal/rules-registry.js +142 -143
- package/dist/_internal/rules-registry.js.map +1 -1
- package/dist/_internal/script-element.d.ts.map +1 -1
- package/dist/_internal/script-element.js +6 -5
- package/dist/_internal/script-element.js.map +1 -1
- package/dist/_internal/worker-code-loading.d.ts.map +1 -1
- package/dist/_internal/worker-code-loading.js +18 -17
- package/dist/_internal/worker-code-loading.js.map +1 -1
- package/dist/plugin.cjs +579 -497
- package/dist/plugin.cjs.map +4 -4
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +38 -21
- package/dist/plugin.js.map +1 -1
- package/dist/rules/no-angular-bypass-security-trust-html.d.ts.map +1 -1
- package/dist/rules/no-angular-bypass-security-trust-html.js +4 -3
- package/dist/rules/no-angular-bypass-security-trust-html.js.map +1 -1
- package/dist/rules/no-angular-innerhtml-binding.js +1 -1
- package/dist/rules/no-angularjs-bypass-sce.d.ts.map +1 -1
- package/dist/rules/no-angularjs-bypass-sce.js +5 -4
- package/dist/rules/no-angularjs-bypass-sce.js.map +1 -1
- package/dist/rules/no-angularjs-enable-svg.d.ts.map +1 -1
- package/dist/rules/no-angularjs-enable-svg.js +2 -1
- package/dist/rules/no-angularjs-enable-svg.js.map +1 -1
- package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.js +2 -2
- package/dist/rules/no-angularjs-sce-resource-url-wildcard.d.ts.map +1 -1
- package/dist/rules/no-angularjs-sce-resource-url-wildcard.js +8 -7
- package/dist/rules/no-angularjs-sce-resource-url-wildcard.js.map +1 -1
- package/dist/rules/no-child-process-exec.d.ts.map +1 -1
- package/dist/rules/no-child-process-exec.js +21 -17
- package/dist/rules/no-child-process-exec.js.map +1 -1
- package/dist/rules/no-child-process-shell-true.d.ts.map +1 -1
- package/dist/rules/no-child-process-shell-true.js +12 -10
- package/dist/rules/no-child-process-shell-true.js.map +1 -1
- package/dist/rules/no-document-domain.d.ts.map +1 -1
- package/dist/rules/no-document-domain.js +2 -1
- package/dist/rules/no-document-domain.js.map +1 -1
- package/dist/rules/no-document-execcommand-insert-html.d.ts.map +1 -1
- package/dist/rules/no-document-execcommand-insert-html.js +4 -3
- package/dist/rules/no-document-execcommand-insert-html.js.map +1 -1
- package/dist/rules/no-document-parse-html-unsafe.d.ts.map +1 -1
- package/dist/rules/no-document-parse-html-unsafe.js +6 -5
- package/dist/rules/no-document-parse-html-unsafe.js.map +1 -1
- package/dist/rules/no-document-write.d.ts.map +1 -1
- package/dist/rules/no-document-write.js +2 -1
- package/dist/rules/no-document-write.js.map +1 -1
- package/dist/rules/no-domparser-html-without-sanitization.d.ts.map +1 -1
- package/dist/rules/no-domparser-html-without-sanitization.js +3 -2
- package/dist/rules/no-domparser-html-without-sanitization.js.map +1 -1
- package/dist/rules/no-domparser-svg-without-sanitization.d.ts.map +1 -1
- package/dist/rules/no-domparser-svg-without-sanitization.js +3 -2
- package/dist/rules/no-domparser-svg-without-sanitization.js.map +1 -1
- package/dist/rules/no-dynamic-import-unsafe-url.js +1 -1
- package/dist/rules/no-electron-dangerous-blink-features.d.ts.map +1 -1
- package/dist/rules/no-electron-dangerous-blink-features.js +14 -11
- package/dist/rules/no-electron-dangerous-blink-features.js.map +1 -1
- package/dist/rules/no-electron-expose-raw-ipc-renderer.d.ts.map +1 -1
- package/dist/rules/no-electron-expose-raw-ipc-renderer.js +19 -18
- package/dist/rules/no-electron-expose-raw-ipc-renderer.js.map +1 -1
- package/dist/rules/no-electron-insecure-certificate-error-handler.d.ts.map +1 -1
- package/dist/rules/no-electron-insecure-certificate-error-handler.js +15 -9
- package/dist/rules/no-electron-insecure-certificate-error-handler.js.map +1 -1
- package/dist/rules/no-electron-insecure-certificate-verify-proc.d.ts.map +1 -1
- package/dist/rules/no-electron-insecure-certificate-verify-proc.js +12 -8
- package/dist/rules/no-electron-insecure-certificate-verify-proc.js.map +1 -1
- package/dist/rules/no-electron-insecure-permission-request-handler.d.ts.map +1 -1
- package/dist/rules/no-electron-insecure-permission-request-handler.js +12 -8
- package/dist/rules/no-electron-insecure-permission-request-handler.js.map +1 -1
- package/dist/rules/no-electron-permission-check-handler-allow-all.d.ts.map +1 -1
- package/dist/rules/no-electron-permission-check-handler-allow-all.js +8 -7
- package/dist/rules/no-electron-permission-check-handler-allow-all.js.map +1 -1
- package/dist/rules/no-electron-unchecked-ipc-sender.d.ts.map +1 -1
- package/dist/rules/no-electron-unchecked-ipc-sender.js +14 -10
- package/dist/rules/no-electron-unchecked-ipc-sender.js.map +1 -1
- package/dist/rules/no-electron-unrestricted-navigation.d.ts.map +1 -1
- package/dist/rules/no-electron-unrestricted-navigation.js +15 -11
- package/dist/rules/no-electron-unrestricted-navigation.js.map +1 -1
- package/dist/rules/no-electron-untrusted-open-external.d.ts.map +1 -1
- package/dist/rules/no-electron-untrusted-open-external.js +11 -9
- package/dist/rules/no-electron-untrusted-open-external.js.map +1 -1
- package/dist/rules/no-electron-webview-allowpopups.d.ts.map +1 -1
- package/dist/rules/no-electron-webview-allowpopups.js +7 -6
- package/dist/rules/no-electron-webview-allowpopups.js.map +1 -1
- package/dist/rules/no-electron-webview-insecure-webpreferences.d.ts.map +1 -1
- package/dist/rules/no-electron-webview-insecure-webpreferences.js +9 -8
- package/dist/rules/no-electron-webview-insecure-webpreferences.js.map +1 -1
- package/dist/rules/no-electron-webview-node-integration.d.ts.map +1 -1
- package/dist/rules/no-electron-webview-node-integration.js +9 -8
- package/dist/rules/no-electron-webview-node-integration.js.map +1 -1
- package/dist/rules/no-html-method.d.ts.map +1 -1
- package/dist/rules/no-html-method.js +3 -2
- package/dist/rules/no-html-method.js.map +1 -1
- package/dist/rules/no-http-request-to-insecure-protocol.d.ts.map +1 -1
- package/dist/rules/no-http-request-to-insecure-protocol.js +13 -10
- package/dist/rules/no-http-request-to-insecure-protocol.js.map +1 -1
- package/dist/rules/no-iframe-srcdoc.d.ts.map +1 -1
- package/dist/rules/no-iframe-srcdoc.js +13 -12
- package/dist/rules/no-iframe-srcdoc.js.map +1 -1
- package/dist/rules/no-inner-html.d.ts.map +1 -1
- package/dist/rules/no-inner-html.js +5 -4
- package/dist/rules/no-inner-html.js.map +1 -1
- package/dist/rules/no-insecure-random.d.ts.map +1 -1
- package/dist/rules/no-insecure-random.js +12 -10
- package/dist/rules/no-insecure-random.js.map +1 -1
- package/dist/rules/no-insecure-tls-agent-options.d.ts.map +1 -1
- package/dist/rules/no-insecure-tls-agent-options.js +10 -9
- package/dist/rules/no-insecure-tls-agent-options.js.map +1 -1
- package/dist/rules/no-insecure-url.d.ts.map +1 -1
- package/dist/rules/no-insecure-url.js +11 -10
- package/dist/rules/no-insecure-url.js.map +1 -1
- package/dist/rules/no-location-javascript-url.d.ts.map +1 -1
- package/dist/rules/no-location-javascript-url.js +11 -8
- package/dist/rules/no-location-javascript-url.js.map +1 -1
- package/dist/rules/no-message-event-without-origin-check.d.ts.map +1 -1
- package/dist/rules/no-message-event-without-origin-check.js +25 -29
- package/dist/rules/no-message-event-without-origin-check.js.map +1 -1
- package/dist/rules/no-node-tls-check-server-identity-bypass.d.ts.map +1 -1
- package/dist/rules/no-node-tls-check-server-identity-bypass.js +14 -13
- package/dist/rules/no-node-tls-check-server-identity-bypass.js.map +1 -1
- package/dist/rules/no-node-tls-legacy-protocol.d.ts.map +1 -1
- package/dist/rules/no-node-tls-legacy-protocol.js +6 -5
- package/dist/rules/no-node-tls-legacy-protocol.js.map +1 -1
- package/dist/rules/no-node-tls-reject-unauthorized-zero.d.ts.map +1 -1
- package/dist/rules/no-node-tls-reject-unauthorized-zero.js +11 -8
- package/dist/rules/no-node-tls-reject-unauthorized-zero.js.map +1 -1
- package/dist/rules/no-node-tls-security-level-zero.d.ts.map +1 -1
- package/dist/rules/no-node-tls-security-level-zero.js +6 -5
- package/dist/rules/no-node-tls-security-level-zero.js.map +1 -1
- package/dist/rules/no-node-vm-run-in-context.d.ts.map +1 -1
- package/dist/rules/no-node-vm-run-in-context.js +25 -21
- package/dist/rules/no-node-vm-run-in-context.js.map +1 -1
- package/dist/rules/no-node-vm-source-text-module.d.ts.map +1 -1
- package/dist/rules/no-node-vm-source-text-module.js +21 -17
- package/dist/rules/no-node-vm-source-text-module.js.map +1 -1
- package/dist/rules/no-node-worker-threads-eval.d.ts.map +1 -1
- package/dist/rules/no-node-worker-threads-eval.js +26 -21
- package/dist/rules/no-node-worker-threads-eval.js.map +1 -1
- package/dist/rules/no-nonnull-assertion-on-security-input.d.ts.map +1 -1
- package/dist/rules/no-nonnull-assertion-on-security-input.js +5 -4
- package/dist/rules/no-nonnull-assertion-on-security-input.js.map +1 -1
- package/dist/rules/no-postmessage-star-origin.d.ts.map +1 -1
- package/dist/rules/no-postmessage-star-origin.js +3 -2
- package/dist/rules/no-postmessage-star-origin.js.map +1 -1
- package/dist/rules/no-postmessage-without-origin-allowlist.d.ts.map +1 -1
- package/dist/rules/no-postmessage-without-origin-allowlist.js +10 -7
- package/dist/rules/no-postmessage-without-origin-allowlist.js.map +1 -1
- package/dist/rules/no-range-create-contextual-fragment.d.ts.map +1 -1
- package/dist/rules/no-range-create-contextual-fragment.js +8 -7
- package/dist/rules/no-range-create-contextual-fragment.js.map +1 -1
- package/dist/rules/no-script-src-data-url.d.ts.map +1 -1
- package/dist/rules/no-script-src-data-url.js +9 -8
- package/dist/rules/no-script-src-data-url.js.map +1 -1
- package/dist/rules/no-script-text.d.ts.map +1 -1
- package/dist/rules/no-script-text.js +2 -1
- package/dist/rules/no-script-text.js.map +1 -1
- package/dist/rules/no-service-worker-unsafe-script-url.d.ts.map +1 -1
- package/dist/rules/no-service-worker-unsafe-script-url.js +3 -2
- package/dist/rules/no-service-worker-unsafe-script-url.js.map +1 -1
- package/dist/rules/no-set-html-unsafe.d.ts.map +1 -1
- package/dist/rules/no-set-html-unsafe.js +3 -2
- package/dist/rules/no-set-html-unsafe.js.map +1 -1
- package/dist/rules/no-trusted-types-policy-pass-through.d.ts.map +1 -1
- package/dist/rules/no-trusted-types-policy-pass-through.js +19 -18
- package/dist/rules/no-trusted-types-policy-pass-through.js.map +1 -1
- package/dist/rules/no-unsafe-alloc.d.ts.map +1 -1
- package/dist/rules/no-unsafe-alloc.js +4 -3
- package/dist/rules/no-unsafe-alloc.js.map +1 -1
- package/dist/rules/no-unsafe-cast-to-trusted-types.d.ts.map +1 -1
- package/dist/rules/no-unsafe-cast-to-trusted-types.js +8 -7
- package/dist/rules/no-unsafe-cast-to-trusted-types.js.map +1 -1
- package/dist/rules/no-window-open-without-noopener.d.ts.map +1 -1
- package/dist/rules/no-window-open-without-noopener.js +10 -7
- package/dist/rules/no-window-open-without-noopener.js.map +1 -1
- package/dist/rules/no-worker-blob-url.d.ts.map +1 -1
- package/dist/rules/no-worker-blob-url.js +3 -2
- package/dist/rules/no-worker-blob-url.js.map +1 -1
- package/dist/rules/no-worker-data-url.d.ts.map +1 -1
- package/dist/rules/no-worker-data-url.js +3 -2
- package/dist/rules/no-worker-data-url.js.map +1 -1
- package/package.json +38 -39
package/dist/plugin.cjs
CHANGED
|
@@ -33,16 +33,16 @@ __export(plugin_exports, {
|
|
|
33
33
|
default: () => plugin_default
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(plugin_exports);
|
|
36
|
-
var
|
|
36
|
+
var typeScriptPluginModule = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
37
37
|
var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
|
|
38
|
-
var
|
|
39
|
-
var
|
|
38
|
+
var nodePluginModule = __toESM(require("eslint-plugin-n"), 1);
|
|
39
|
+
var securityPluginModule = __toESM(require("eslint-plugin-security"), 1);
|
|
40
40
|
|
|
41
41
|
// package.json
|
|
42
42
|
var package_default = {
|
|
43
43
|
$schema: "https://www.schemastore.org/package.json",
|
|
44
44
|
name: "eslint-plugin-sdl-2",
|
|
45
|
-
version: "1.2.
|
|
45
|
+
version: "1.2.5",
|
|
46
46
|
private: false,
|
|
47
47
|
description: "ESLint plugin providing SDL-focused security and platform hardening rules.",
|
|
48
48
|
keywords: [
|
|
@@ -127,19 +127,19 @@ var package_default = {
|
|
|
127
127
|
"changelog:generate": "git-cliff --config cliff.toml --output CHANGELOG.md",
|
|
128
128
|
"changelog:preview": "git-cliff --config cliff.toml --unreleased",
|
|
129
129
|
"changelog:release-notes": "git-cliff --config cliff.toml --latest --strip all",
|
|
130
|
-
"clean:cache": "
|
|
131
|
-
"clean:cache:coverage": "
|
|
132
|
-
"clean:cache:dist": "
|
|
133
|
-
"clean:cache:eslint": "
|
|
134
|
-
"clean:cache:ncu": "
|
|
135
|
-
"clean:cache:prettier": "
|
|
136
|
-
"clean:cache:stryker": "
|
|
137
|
-
"clean:cache:stylelint": "
|
|
138
|
-
"clean:cache:temp":
|
|
139
|
-
"clean:cache:typescript": "
|
|
140
|
-
"clean:cache:vite": "
|
|
141
|
-
"clean:database": "
|
|
142
|
-
"clean:docs": "
|
|
130
|
+
"clean:cache": "node scripts/remove-paths.mjs dist coverage cache .cache .vite .turbo",
|
|
131
|
+
"clean:cache:coverage": "node scripts/remove-paths.mjs coverage .coverage",
|
|
132
|
+
"clean:cache:dist": "node scripts/remove-paths.mjs dist release",
|
|
133
|
+
"clean:cache:eslint": "node scripts/remove-paths.mjs .cache/.eslintcache",
|
|
134
|
+
"clean:cache:ncu": "node scripts/remove-paths.mjs .cache/.ncu-cache.json",
|
|
135
|
+
"clean:cache:prettier": "node scripts/remove-paths.mjs .cache/.prettier-cache .prettier-cache .prettiercache",
|
|
136
|
+
"clean:cache:stryker": "node scripts/remove-paths.mjs .stryker-tmp",
|
|
137
|
+
"clean:cache:stylelint": "node scripts/remove-paths.mjs .cache/stylelintcache stylelintcache .stylelintcache",
|
|
138
|
+
"clean:cache:temp": "node scripts/remove-paths.mjs .temp/.**",
|
|
139
|
+
"clean:cache:typescript": "node scripts/remove-paths.mjs .cache/**.tsbuildinfo .cache/builds",
|
|
140
|
+
"clean:cache:vite": "node scripts/remove-paths.mjs .cache/vite .cache/vitest .cache/vitest-zero-coverage .cache/vite-zero-coverage",
|
|
141
|
+
"clean:database": "node scripts/remove-paths.mjs %appdata%/uptime-watcher/uptime-watcher.sqlite",
|
|
142
|
+
"clean:docs": "node scripts/remove-paths.mjs docs/docusaurus/.docusaurus/** docs/docusaurus/build/** docs/docusaurus/site-docs/developer/api/**",
|
|
143
143
|
"clean:docusaurus": "npm run clean:docs && npm run --workspace docs/docusaurus clear",
|
|
144
144
|
"cognitive-complexity": "cognitive-complexity-ts --threshold 10",
|
|
145
145
|
commit: "git-cz",
|
|
@@ -172,8 +172,8 @@ var package_default = {
|
|
|
172
172
|
"lint:config:inspect": "npx eslint --inspect-config",
|
|
173
173
|
"lint:css": 'stylelint --cache --config stylelint.config.mjs --cache-strategy content --cache-location .cache/stylelintcache --ignore-pattern "docs/docusaurus/static/stylelint-inspector/**" --ignore-pattern "docs/docusaurus/static/eslint-inspector/**" src/ docs/ --custom-formatter stylelint-formatter-pretty && echo "Stylelint done!"',
|
|
174
174
|
"lint:css:fix": 'stylelint --cache --config stylelint.config.mjs --cache-strategy content --cache-location .cache/stylelintcache --ignore-pattern "docs/docusaurus/static/stylelint-inspector/**" --ignore-pattern "docs/docusaurus/static/eslint-inspector/**" src/ docs/ --custom-formatter stylelint-formatter-pretty --fix && echo "Stylelint done!"',
|
|
175
|
-
"lint:depcheck": "
|
|
176
|
-
"lint:deps": "
|
|
175
|
+
"lint:depcheck": "npm run knip",
|
|
176
|
+
"lint:deps": "npm run knip",
|
|
177
177
|
"lint:dupes": "jscpd src/ --config jscpd.json",
|
|
178
178
|
"lint:dupes:all": "jscpd src/ --config jscpd.json --min-lines 3",
|
|
179
179
|
"lint:dupes:skiplocal": "jscpd src/ --skipLocal --config jscpd.json",
|
|
@@ -206,7 +206,7 @@ var package_default = {
|
|
|
206
206
|
"lint:secretlint": 'secretlint --secretlintrc .secretlintrc.cjs --secretlintignore .secretlintignore "./*" ".vscode/**" "assets/**" "src/**" "electron/**" "shared/**" "config/**" "scripts/**" "playwright/**" "storybook/**" ".storybook" "tests/**" "benchmarks/**" ".devin/**" "public/**" ".github/**" "docs/Architecture/**" "docs/*" "docs/assets/**" "docs/Guides/**" "docs/Testing/**" "docs/TSDoc/**" "docs/docusaurus/src/**" "docs/docusaurus/static/**" "docs/docusaurus/blog/**" "docs/docusaurus/docs/**" "docs/docusaurus/docs/*"',
|
|
207
207
|
"lint:secrets": "detect-secrets scan",
|
|
208
208
|
"lint:unused": "npm run knip -- --include unlisted,unresolved,duplicates",
|
|
209
|
-
"lint:unused-deps": "
|
|
209
|
+
"lint:unused-deps": "npm run knip -- --include dependencies",
|
|
210
210
|
"lint:yaml": 'cross-env NODE_OPTIONS=--max_old_space_size=16384 eslint --cache --cache-strategy content --cache-location .cache/.eslintcache "**/*.{yml,yaml}" && echo "YAML lint done!"',
|
|
211
211
|
"lint:yaml:fix": 'cross-env NODE_OPTIONS=--max_old_space_size=16384 eslint --cache --cache-strategy content --cache-location .cache/.eslintcache --fix "**/*.{yml,yaml}" && echo "YAML lint (fix) done!"',
|
|
212
212
|
"madge:circular": 'madge --circular --no-spinner --ts-config tsconfig.json --extensions ts,tsx,js,jsx,mjs,cjs,cts,mts ./src --exclude "(^|[\\/])(test|dist|node_modules|cache|.cache|coverage|build|eslint-inspector|temp|.docusaurus)($|[\\/])|\\.css$"',
|
|
@@ -259,11 +259,12 @@ var package_default = {
|
|
|
259
259
|
},
|
|
260
260
|
dependencies: {
|
|
261
261
|
"@types/eslint-plugin-security": "^3.0.1",
|
|
262
|
-
"@typescript-eslint/eslint-plugin": "^8.59.
|
|
263
|
-
"@typescript-eslint/parser": "^8.59.
|
|
264
|
-
"@typescript-eslint/type-utils": "^8.59.
|
|
265
|
-
"@typescript-eslint/utils": "^8.59.
|
|
262
|
+
"@typescript-eslint/eslint-plugin": "^8.59.3",
|
|
263
|
+
"@typescript-eslint/parser": "^8.59.3",
|
|
264
|
+
"@typescript-eslint/type-utils": "^8.59.3",
|
|
265
|
+
"@typescript-eslint/utils": "^8.59.3",
|
|
266
266
|
"eslint-plugin-n": "^18.0.1",
|
|
267
|
+
"eslint-plugin-security": "^3.0.1",
|
|
267
268
|
"ts-extras": "^1.0.0",
|
|
268
269
|
"type-fest": "^5.6.0"
|
|
269
270
|
},
|
|
@@ -272,7 +273,7 @@ var package_default = {
|
|
|
272
273
|
"@csstools/stylelint-formatter-github": "^2.0.0",
|
|
273
274
|
"@double-great/remark-lint-alt-text": "^1.1.1",
|
|
274
275
|
"@eslint/compat": "^2.1.0",
|
|
275
|
-
"@eslint/config-inspector": "^
|
|
276
|
+
"@eslint/config-inspector": "^3.0.2",
|
|
276
277
|
"@microsoft/tsdoc-config": "^0.18.1",
|
|
277
278
|
"@stryker-ignorer/console-all": "^0.3.2",
|
|
278
279
|
"@stryker-mutator/core": "^9.6.1",
|
|
@@ -280,43 +281,41 @@ var package_default = {
|
|
|
280
281
|
"@stryker-mutator/vitest-runner": "^9.6.1",
|
|
281
282
|
"@types/htmlhint": "^1.1.5",
|
|
282
283
|
"@types/madge": "^5.0.3",
|
|
283
|
-
"@types/node": "^25.
|
|
284
|
+
"@types/node": "^25.7.0",
|
|
284
285
|
"@types/sloc": "^0.2.3",
|
|
285
|
-
"@typescript-eslint/rule-tester": "^8.59.
|
|
286
|
-
"@vitest/coverage-v8": "^4.1.
|
|
287
|
-
"@vitest/ui": "^4.1.
|
|
286
|
+
"@typescript-eslint/rule-tester": "^8.59.3",
|
|
287
|
+
"@vitest/coverage-v8": "^4.1.6",
|
|
288
|
+
"@vitest/ui": "^4.1.6",
|
|
288
289
|
actionlint: "^2.0.6",
|
|
289
290
|
"all-contributors-cli": "^6.26.1",
|
|
290
291
|
"cognitive-complexity-ts": "^0.8.1",
|
|
291
|
-
commitlint: "^21.0.
|
|
292
|
+
commitlint: "^21.0.1",
|
|
292
293
|
"commitlint-config-gitmoji": "^2.3.1",
|
|
293
294
|
"cross-env": "^10.1.0",
|
|
294
|
-
depcheck: "^1.4.7",
|
|
295
295
|
"detect-secrets": "^1.0.6",
|
|
296
296
|
eslint: "^10.3.0",
|
|
297
|
-
"eslint-config-nick2bad4u": "^1.0.
|
|
297
|
+
"eslint-config-nick2bad4u": "^1.0.16",
|
|
298
298
|
"eslint-formatter-unix": "^9.0.1",
|
|
299
299
|
"eslint-rule-benchmark": "^0.8.0",
|
|
300
|
-
"fast-check": "^4.
|
|
300
|
+
"fast-check": "^4.8.0",
|
|
301
301
|
"git-cliff": "^2.13.1",
|
|
302
302
|
"gitleaks-secret-scanner": "^2.1.1",
|
|
303
303
|
htmlhint: "^1.9.2",
|
|
304
|
-
jscpd: "^4.1.
|
|
305
|
-
knip: "^6.
|
|
304
|
+
jscpd: "^4.1.1",
|
|
305
|
+
knip: "^6.13.1",
|
|
306
306
|
leasot: "^14.4.0",
|
|
307
307
|
madge: "^8.0.0",
|
|
308
308
|
"markdown-link-check": "^3.14.2",
|
|
309
|
-
"npm-check-updates": "^22.
|
|
309
|
+
"npm-check-updates": "^22.2.0",
|
|
310
310
|
"npm-package-json-lint": "^10.4.0",
|
|
311
311
|
picocolors: "^1.1.1",
|
|
312
312
|
prettier: "^3.8.3",
|
|
313
|
-
"prettier-config-nick2bad4u": "^1.0.
|
|
314
|
-
publint: "^0.3.
|
|
313
|
+
"prettier-config-nick2bad4u": "^1.0.12",
|
|
314
|
+
publint: "^0.3.21",
|
|
315
315
|
"rehype-katex": "^7.0.1",
|
|
316
316
|
remark: "^15.0.1",
|
|
317
317
|
"remark-cli": "^12.0.1",
|
|
318
318
|
"remark-config-nick2bad4u": "^1.0.1",
|
|
319
|
-
rimraf: "^6.1.3",
|
|
320
319
|
secretlint: "^13.0.0",
|
|
321
320
|
"secretlint-config-nick2bad4u": "^1.0.4",
|
|
322
321
|
sloc: "^0.3.2",
|
|
@@ -326,12 +325,12 @@ var package_default = {
|
|
|
326
325
|
"ts-unused-exports": "^11.0.1",
|
|
327
326
|
typedoc: "^0.28.19",
|
|
328
327
|
typescript: "^6.0.3",
|
|
329
|
-
"typescript-eslint": "^8.59.
|
|
328
|
+
"typescript-eslint": "^8.59.3",
|
|
330
329
|
typesync: "^0.14.3",
|
|
331
330
|
vfile: "^6.0.3",
|
|
332
|
-
vite: "^8.0.
|
|
331
|
+
vite: "^8.0.12",
|
|
333
332
|
"vite-tsconfig-paths": "^6.1.1",
|
|
334
|
-
vitest: "^4.1.
|
|
333
|
+
vitest: "^4.1.6",
|
|
335
334
|
"yamllint-js": "^0.2.4"
|
|
336
335
|
},
|
|
337
336
|
peerDependencies: {
|
|
@@ -364,7 +363,11 @@ var package_default = {
|
|
|
364
363
|
// dist/_internal/create-rule.js
|
|
365
364
|
var import_utils = require("@typescript-eslint/utils");
|
|
366
365
|
var docsBaseUrl = "https://nick2bad4u.github.io/eslint-plugin-SDL-2/docs/rules";
|
|
367
|
-
var
|
|
366
|
+
var ruleCreatorFactory = (
|
|
367
|
+
// eslint-disable-next-line new-cap -- RuleCreator is intentionally a callable factory.
|
|
368
|
+
import_utils.ESLintUtils.RuleCreator((name) => `${docsBaseUrl}/${name}`)
|
|
369
|
+
);
|
|
370
|
+
var createRule = ruleCreatorFactory;
|
|
368
371
|
|
|
369
372
|
// dist/rules/no-angular-bypass-sanitizer.js
|
|
370
373
|
var rule = createRule({
|
|
@@ -397,11 +400,12 @@ var rule = createRule({
|
|
|
397
400
|
var no_angular_bypass_sanitizer_default = rule;
|
|
398
401
|
|
|
399
402
|
// dist/rules/no-angular-bypass-security-trust-html.js
|
|
403
|
+
var import_utils2 = require("@typescript-eslint/utils");
|
|
400
404
|
var getMemberPropertyName = (memberExpression) => {
|
|
401
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
405
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils2.AST_NODE_TYPES.Identifier) {
|
|
402
406
|
return memberExpression.property.name;
|
|
403
407
|
}
|
|
404
|
-
if (memberExpression.property.type ===
|
|
408
|
+
if (memberExpression.property.type === import_utils2.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
405
409
|
return memberExpression.property.value;
|
|
406
410
|
}
|
|
407
411
|
return void 0;
|
|
@@ -410,7 +414,7 @@ var rule2 = createRule({
|
|
|
410
414
|
create(context) {
|
|
411
415
|
return {
|
|
412
416
|
CallExpression(node) {
|
|
413
|
-
if (node.callee.type !==
|
|
417
|
+
if (node.callee.type !== import_utils2.AST_NODE_TYPES.MemberExpression) {
|
|
414
418
|
return;
|
|
415
419
|
}
|
|
416
420
|
if (getMemberPropertyName(node.callee) !== "bypassSecurityTrustHtml") {
|
|
@@ -443,7 +447,7 @@ var no_angular_bypass_security_trust_html_default = rule2;
|
|
|
443
447
|
|
|
444
448
|
// dist/rules/no-angular-innerhtml-binding.js
|
|
445
449
|
var import_ts_extras = require("ts-extras");
|
|
446
|
-
var hasInnerHtmlBindingPattern = (text) => /\[\s*innerhtml\s*\]\s*=/
|
|
450
|
+
var hasInnerHtmlBindingPattern = (text) => /\[\s*innerhtml\s*\]\s*=/iv.test(text);
|
|
447
451
|
var rule3 = createRule({
|
|
448
452
|
create(context) {
|
|
449
453
|
return {
|
|
@@ -526,9 +530,10 @@ var rule4 = createRule({
|
|
|
526
530
|
var no_angular_sanitization_trusted_urls_default = rule4;
|
|
527
531
|
|
|
528
532
|
// dist/rules/no-angularjs-bypass-sce.js
|
|
533
|
+
var import_utils3 = require("@typescript-eslint/utils");
|
|
529
534
|
var import_ts_extras2 = require("ts-extras");
|
|
530
|
-
var isEmptyLiteral = (argument) => argument?.type ===
|
|
531
|
-
var isSceProviderEnabledSafeLiteral = (argument) => argument?.type ===
|
|
535
|
+
var isEmptyLiteral = (argument) => argument?.type === import_utils3.AST_NODE_TYPES.Literal && argument.value === "";
|
|
536
|
+
var isSceProviderEnabledSafeLiteral = (argument) => argument?.type === import_utils3.AST_NODE_TYPES.Literal && (0, import_ts_extras2.arrayIncludes)([
|
|
532
537
|
1,
|
|
533
538
|
"1",
|
|
534
539
|
true,
|
|
@@ -552,7 +557,7 @@ var noAngularjsBypassSceRule = createRule({
|
|
|
552
557
|
};
|
|
553
558
|
return {
|
|
554
559
|
"CallExpression[callee.type='MemberExpression'][callee.object.type='Identifier'][callee.object.name='$sce'][callee.property.type='Identifier']"(node) {
|
|
555
|
-
if (node.callee.type !==
|
|
560
|
+
if (node.callee.type !== import_utils3.AST_NODE_TYPES.MemberExpression || node.callee.property.type !== import_utils3.AST_NODE_TYPES.Identifier) {
|
|
556
561
|
return;
|
|
557
562
|
}
|
|
558
563
|
if (!isBypassSceMethod(node.callee.property.name)) {
|
|
@@ -599,8 +604,9 @@ var noAngularjsBypassSceRule = createRule({
|
|
|
599
604
|
var no_angularjs_bypass_sce_default = noAngularjsBypassSceRule;
|
|
600
605
|
|
|
601
606
|
// dist/rules/no-angularjs-enable-svg.js
|
|
607
|
+
var import_utils4 = require("@typescript-eslint/utils");
|
|
602
608
|
var import_ts_extras3 = require("ts-extras");
|
|
603
|
-
var isExplicitlyDisabledSvgLiteral = (argument) => argument?.type ===
|
|
609
|
+
var isExplicitlyDisabledSvgLiteral = (argument) => argument?.type === import_utils4.AST_NODE_TYPES.Literal && (0, import_ts_extras3.arrayIncludes)([
|
|
604
610
|
0,
|
|
605
611
|
"0",
|
|
606
612
|
false,
|
|
@@ -644,8 +650,8 @@ var no_angularjs_enable_svg_default = rule5;
|
|
|
644
650
|
|
|
645
651
|
// dist/rules/no-angularjs-ng-bind-html-without-sanitize.js
|
|
646
652
|
var import_ts_extras4 = require("ts-extras");
|
|
647
|
-
var hasNgBindHtmlPattern = (text) => /\bng-bind-html\b/
|
|
648
|
-
var hasKnownSanitizePattern = (text) => /\b(?:ngsanitize|\$sanitize|sanitize)\b/
|
|
653
|
+
var hasNgBindHtmlPattern = (text) => /\bng-bind-html\b/iv.test(text);
|
|
654
|
+
var hasKnownSanitizePattern = (text) => /\b(?:ngsanitize|\$sanitize|sanitize)\b/iv.test(text);
|
|
649
655
|
var rule6 = createRule({
|
|
650
656
|
create(context) {
|
|
651
657
|
return {
|
|
@@ -734,11 +740,12 @@ var rule7 = createRule({
|
|
|
734
740
|
var no_angularjs_sanitization_whitelist_default = rule7;
|
|
735
741
|
|
|
736
742
|
// dist/rules/no-angularjs-sce-resource-url-wildcard.js
|
|
743
|
+
var import_utils5 = require("@typescript-eslint/utils");
|
|
737
744
|
var getMemberPropertyName2 = (memberExpression) => {
|
|
738
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
745
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils5.AST_NODE_TYPES.Identifier) {
|
|
739
746
|
return memberExpression.property.name;
|
|
740
747
|
}
|
|
741
|
-
if (memberExpression.property.type ===
|
|
748
|
+
if (memberExpression.property.type === import_utils5.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
742
749
|
return memberExpression.property.value;
|
|
743
750
|
}
|
|
744
751
|
return void 0;
|
|
@@ -748,18 +755,18 @@ var rule8 = createRule({
|
|
|
748
755
|
create(context) {
|
|
749
756
|
return {
|
|
750
757
|
CallExpression(node) {
|
|
751
|
-
if (node.callee.type !==
|
|
758
|
+
if (node.callee.type !== import_utils5.AST_NODE_TYPES.MemberExpression) {
|
|
752
759
|
return;
|
|
753
760
|
}
|
|
754
761
|
if (getMemberPropertyName2(node.callee) !== "resourceUrlWhitelist") {
|
|
755
762
|
return;
|
|
756
763
|
}
|
|
757
764
|
const [firstArgument] = node.arguments;
|
|
758
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
765
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils5.AST_NODE_TYPES.SpreadElement || firstArgument.type !== import_utils5.AST_NODE_TYPES.ArrayExpression) {
|
|
759
766
|
return;
|
|
760
767
|
}
|
|
761
768
|
for (const elementNode of firstArgument.elements) {
|
|
762
|
-
if (elementNode === null || elementNode.type ===
|
|
769
|
+
if (elementNode === null || elementNode.type === import_utils5.AST_NODE_TYPES.SpreadElement || elementNode.type !== import_utils5.AST_NODE_TYPES.Literal || typeof elementNode.value !== "string") {
|
|
763
770
|
continue;
|
|
764
771
|
}
|
|
765
772
|
if (!isWildcardValue(elementNode.value)) {
|
|
@@ -792,15 +799,17 @@ var rule8 = createRule({
|
|
|
792
799
|
var no_angularjs_sce_resource_url_wildcard_default = rule8;
|
|
793
800
|
|
|
794
801
|
// dist/rules/no-child-process-exec.js
|
|
802
|
+
var import_utils7 = require("@typescript-eslint/utils");
|
|
795
803
|
var import_ts_extras6 = require("ts-extras");
|
|
796
804
|
|
|
797
805
|
// dist/_internal/estree-utils.js
|
|
806
|
+
var import_utils6 = require("@typescript-eslint/utils");
|
|
798
807
|
var import_ts_extras5 = require("ts-extras");
|
|
799
808
|
var getMemberPropertyName3 = (memberExpression) => {
|
|
800
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
809
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils6.AST_NODE_TYPES.Identifier) {
|
|
801
810
|
return memberExpression.property.name;
|
|
802
811
|
}
|
|
803
|
-
if (memberExpression.property.type ===
|
|
812
|
+
if (memberExpression.property.type === import_utils6.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
804
813
|
return memberExpression.property.value;
|
|
805
814
|
}
|
|
806
815
|
return void 0;
|
|
@@ -809,19 +818,16 @@ var getPropertyName = (property) => {
|
|
|
809
818
|
if (property.computed) {
|
|
810
819
|
return void 0;
|
|
811
820
|
}
|
|
812
|
-
if (property.key.type ===
|
|
821
|
+
if (property.key.type === import_utils6.AST_NODE_TYPES.Identifier) {
|
|
813
822
|
return property.key.name;
|
|
814
823
|
}
|
|
815
|
-
|
|
816
|
-
return property.key.value;
|
|
817
|
-
}
|
|
818
|
-
return void 0;
|
|
824
|
+
return typeof property.key.value === "string" ? property.key.value : void 0;
|
|
819
825
|
};
|
|
820
826
|
var getStaticStringValue = (node) => {
|
|
821
|
-
if (node.type ===
|
|
827
|
+
if (node.type === import_utils6.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
822
828
|
return node.value;
|
|
823
829
|
}
|
|
824
|
-
if (node.type ===
|
|
830
|
+
if (node.type === import_utils6.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
825
831
|
return (0, import_ts_extras5.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
826
832
|
}
|
|
827
833
|
return void 0;
|
|
@@ -830,16 +836,16 @@ var getStaticJsxAttributeStringValue = (attributeValue) => {
|
|
|
830
836
|
if (attributeValue === null) {
|
|
831
837
|
return void 0;
|
|
832
838
|
}
|
|
833
|
-
if (attributeValue.type ===
|
|
839
|
+
if (attributeValue.type === import_utils6.AST_NODE_TYPES.Literal && typeof attributeValue.value === "string") {
|
|
834
840
|
return attributeValue.value;
|
|
835
841
|
}
|
|
836
|
-
if (attributeValue.type !==
|
|
842
|
+
if (attributeValue.type !== import_utils6.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
837
843
|
return void 0;
|
|
838
844
|
}
|
|
839
|
-
if (attributeValue.expression.type ===
|
|
845
|
+
if (attributeValue.expression.type === import_utils6.AST_NODE_TYPES.Literal && typeof attributeValue.expression.value === "string") {
|
|
840
846
|
return attributeValue.expression.value;
|
|
841
847
|
}
|
|
842
|
-
if (attributeValue.expression.type ===
|
|
848
|
+
if (attributeValue.expression.type === import_utils6.AST_NODE_TYPES.TemplateLiteral && attributeValue.expression.expressions.length === 0) {
|
|
843
849
|
return (0, import_ts_extras5.arrayFirst)(attributeValue.expression.quasis)?.value.cooked ?? void 0;
|
|
844
850
|
}
|
|
845
851
|
return void 0;
|
|
@@ -854,17 +860,17 @@ var DISALLOWED_CHILD_PROCESS_METHOD_NAMES = /* @__PURE__ */ new Set(["exec", "ex
|
|
|
854
860
|
var isDisallowedChildProcessMethodName = (value) => (0, import_ts_extras6.isDefined)(value) && (0, import_ts_extras6.setHas)(DISALLOWED_CHILD_PROCESS_METHOD_NAMES, value);
|
|
855
861
|
var isChildProcessModuleSource = (value) => (0, import_ts_extras6.setHas)(CHILD_PROCESS_MODULE_NAMES, value);
|
|
856
862
|
var isRequireCallFromChildProcess = (expression) => {
|
|
857
|
-
if (expression?.type !==
|
|
863
|
+
if (expression?.type !== import_utils7.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils7.AST_NODE_TYPES.Identifier || expression.callee.name !== "require") {
|
|
858
864
|
return false;
|
|
859
865
|
}
|
|
860
866
|
const [firstArgument] = expression.arguments;
|
|
861
|
-
return firstArgument !== void 0 && firstArgument.type !==
|
|
867
|
+
return firstArgument !== void 0 && firstArgument.type !== import_utils7.AST_NODE_TYPES.SpreadElement && firstArgument.type === import_utils7.AST_NODE_TYPES.Literal && typeof firstArgument.value === "string" && isChildProcessModuleSource(firstArgument.value);
|
|
862
868
|
};
|
|
863
869
|
var getPatternIdentifier = (pattern) => {
|
|
864
|
-
if (pattern.type ===
|
|
870
|
+
if (pattern.type === import_utils7.AST_NODE_TYPES.Identifier) {
|
|
865
871
|
return pattern;
|
|
866
872
|
}
|
|
867
|
-
if (pattern.type ===
|
|
873
|
+
if (pattern.type === import_utils7.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils7.AST_NODE_TYPES.Identifier) {
|
|
868
874
|
return pattern.left;
|
|
869
875
|
}
|
|
870
876
|
return void 0;
|
|
@@ -875,7 +881,7 @@ var rule9 = createRule({
|
|
|
875
881
|
const childProcessNamespaceBindingNames = /* @__PURE__ */ new Set();
|
|
876
882
|
return {
|
|
877
883
|
CallExpression(node) {
|
|
878
|
-
if (node.callee.type ===
|
|
884
|
+
if (node.callee.type === import_utils7.AST_NODE_TYPES.Identifier) {
|
|
879
885
|
if (!(0, import_ts_extras6.setHas)(childProcessExecBindingNames, node.callee.name)) {
|
|
880
886
|
return;
|
|
881
887
|
}
|
|
@@ -885,21 +891,21 @@ var rule9 = createRule({
|
|
|
885
891
|
});
|
|
886
892
|
return;
|
|
887
893
|
}
|
|
888
|
-
if (node.callee.type !==
|
|
894
|
+
if (node.callee.type !== import_utils7.AST_NODE_TYPES.MemberExpression) {
|
|
889
895
|
return;
|
|
890
896
|
}
|
|
891
897
|
const methodName = getMemberPropertyName3(node.callee);
|
|
892
898
|
if (!isDisallowedChildProcessMethodName(methodName)) {
|
|
893
899
|
return;
|
|
894
900
|
}
|
|
895
|
-
if (node.callee.object.type ===
|
|
901
|
+
if (node.callee.object.type === import_utils7.AST_NODE_TYPES.Identifier && (0, import_ts_extras6.setHas)(childProcessNamespaceBindingNames, node.callee.object.name)) {
|
|
896
902
|
context.report({
|
|
897
903
|
messageId: "default",
|
|
898
904
|
node: node.callee
|
|
899
905
|
});
|
|
900
906
|
return;
|
|
901
907
|
}
|
|
902
|
-
if (node.callee.object.type ===
|
|
908
|
+
if (node.callee.object.type === import_utils7.AST_NODE_TYPES.CallExpression && isRequireCallFromChildProcess(node.callee.object)) {
|
|
903
909
|
context.report({
|
|
904
910
|
messageId: "default",
|
|
905
911
|
node: node.callee
|
|
@@ -911,11 +917,11 @@ var rule9 = createRule({
|
|
|
911
917
|
return;
|
|
912
918
|
}
|
|
913
919
|
for (const specifierNode of node.specifiers) {
|
|
914
|
-
if (specifierNode.type ===
|
|
920
|
+
if (specifierNode.type === import_utils7.AST_NODE_TYPES.ImportDefaultSpecifier || specifierNode.type === import_utils7.AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
915
921
|
childProcessNamespaceBindingNames.add(specifierNode.local.name);
|
|
916
922
|
continue;
|
|
917
923
|
}
|
|
918
|
-
const importedName = specifierNode.imported.type ===
|
|
924
|
+
const importedName = specifierNode.imported.type === import_utils7.AST_NODE_TYPES.Identifier ? specifierNode.imported.name : specifierNode.imported.value;
|
|
919
925
|
if (!isDisallowedChildProcessMethodName(importedName)) {
|
|
920
926
|
continue;
|
|
921
927
|
}
|
|
@@ -926,15 +932,15 @@ var rule9 = createRule({
|
|
|
926
932
|
if (!isRequireCallFromChildProcess(node.init)) {
|
|
927
933
|
return;
|
|
928
934
|
}
|
|
929
|
-
if (node.id.type ===
|
|
935
|
+
if (node.id.type === import_utils7.AST_NODE_TYPES.Identifier) {
|
|
930
936
|
childProcessNamespaceBindingNames.add(node.id.name);
|
|
931
937
|
return;
|
|
932
938
|
}
|
|
933
|
-
if (node.id.type !==
|
|
939
|
+
if (node.id.type !== import_utils7.AST_NODE_TYPES.ObjectPattern) {
|
|
934
940
|
return;
|
|
935
941
|
}
|
|
936
942
|
for (const propertyNode of node.id.properties) {
|
|
937
|
-
if (propertyNode.type !==
|
|
943
|
+
if (propertyNode.type !== import_utils7.AST_NODE_TYPES.Property || propertyNode.computed) {
|
|
938
944
|
continue;
|
|
939
945
|
}
|
|
940
946
|
const importedName = getPropertyName(propertyNode);
|
|
@@ -969,25 +975,26 @@ var rule9 = createRule({
|
|
|
969
975
|
var no_child_process_exec_default = rule9;
|
|
970
976
|
|
|
971
977
|
// dist/rules/no-child-process-shell-true.js
|
|
978
|
+
var import_utils8 = require("@typescript-eslint/utils");
|
|
972
979
|
var getMemberPropertyName4 = (memberExpression) => {
|
|
973
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
980
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils8.AST_NODE_TYPES.Identifier) {
|
|
974
981
|
return memberExpression.property.name;
|
|
975
982
|
}
|
|
976
|
-
if (memberExpression.property.type ===
|
|
983
|
+
if (memberExpression.property.type === import_utils8.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
977
984
|
return memberExpression.property.value;
|
|
978
985
|
}
|
|
979
986
|
return void 0;
|
|
980
987
|
};
|
|
981
|
-
var isTruthyLiteral = (node) => node.type ===
|
|
988
|
+
var isTruthyLiteral = (node) => node.type === import_utils8.AST_NODE_TYPES.Literal && node.value === true;
|
|
982
989
|
var hasShellTrueOption = (optionsNode) => {
|
|
983
|
-
if (optionsNode.type !==
|
|
990
|
+
if (optionsNode.type !== import_utils8.AST_NODE_TYPES.ObjectExpression) {
|
|
984
991
|
return false;
|
|
985
992
|
}
|
|
986
993
|
for (const propertyNode of optionsNode.properties) {
|
|
987
|
-
if (propertyNode.type !==
|
|
994
|
+
if (propertyNode.type !== import_utils8.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
988
995
|
continue;
|
|
989
996
|
}
|
|
990
|
-
const keyName = propertyNode.key.type ===
|
|
997
|
+
const keyName = propertyNode.key.type === import_utils8.AST_NODE_TYPES.Identifier ? propertyNode.key.name : propertyNode.key.type === import_utils8.AST_NODE_TYPES.Literal && typeof propertyNode.key.value === "string" ? propertyNode.key.value : void 0;
|
|
991
998
|
if (keyName !== "shell") {
|
|
992
999
|
continue;
|
|
993
1000
|
}
|
|
@@ -998,10 +1005,10 @@ var hasShellTrueOption = (optionsNode) => {
|
|
|
998
1005
|
return false;
|
|
999
1006
|
};
|
|
1000
1007
|
var isTargetChildProcessMethod = (node) => {
|
|
1001
|
-
if (node.callee.type ===
|
|
1008
|
+
if (node.callee.type === import_utils8.AST_NODE_TYPES.Identifier) {
|
|
1002
1009
|
return node.callee.name === "spawn" || node.callee.name === "execFile";
|
|
1003
1010
|
}
|
|
1004
|
-
if (node.callee.type !==
|
|
1011
|
+
if (node.callee.type !== import_utils8.AST_NODE_TYPES.MemberExpression) {
|
|
1005
1012
|
return false;
|
|
1006
1013
|
}
|
|
1007
1014
|
const methodName = getMemberPropertyName4(node.callee);
|
|
@@ -1015,7 +1022,7 @@ var rule10 = createRule({
|
|
|
1015
1022
|
return;
|
|
1016
1023
|
}
|
|
1017
1024
|
for (const argumentNode of node.arguments) {
|
|
1018
|
-
if (argumentNode.type ===
|
|
1025
|
+
if (argumentNode.type === import_utils8.AST_NODE_TYPES.SpreadElement) {
|
|
1019
1026
|
continue;
|
|
1020
1027
|
}
|
|
1021
1028
|
if (!hasShellTrueOption(argumentNode)) {
|
|
@@ -1048,6 +1055,7 @@ var rule10 = createRule({
|
|
|
1048
1055
|
var no_child_process_shell_true_default = rule10;
|
|
1049
1056
|
|
|
1050
1057
|
// dist/_internal/ast-utils.js
|
|
1058
|
+
var import_utils9 = require("@typescript-eslint/utils");
|
|
1051
1059
|
var import_ts_extras7 = require("ts-extras");
|
|
1052
1060
|
var isUnknownRecord = (value) => typeof value === "object" && value !== null;
|
|
1053
1061
|
var isMapLike = (value) => isUnknownRecord(value) && typeof value["get"] === "function";
|
|
@@ -1089,10 +1097,10 @@ var getNodeTypeAsString = (fullTypeChecker, node, context) => {
|
|
|
1089
1097
|
};
|
|
1090
1098
|
var isWindowIdentifierName = (name) => name.toLowerCase().endsWith("window");
|
|
1091
1099
|
var getMemberPropertyName5 = (node) => {
|
|
1092
|
-
if (node.property.type ===
|
|
1100
|
+
if (node.property.type === import_utils9.AST_NODE_TYPES.Identifier) {
|
|
1093
1101
|
return node.property.name;
|
|
1094
1102
|
}
|
|
1095
|
-
if (node.property.type ===
|
|
1103
|
+
if (node.property.type === import_utils9.AST_NODE_TYPES.Literal && typeof node.property.value === "string") {
|
|
1096
1104
|
return node.property.value;
|
|
1097
1105
|
}
|
|
1098
1106
|
return void 0;
|
|
@@ -1102,29 +1110,29 @@ var isDocumentMemberReference = (node) => {
|
|
|
1102
1110
|
if (propertyName !== "document") {
|
|
1103
1111
|
return false;
|
|
1104
1112
|
}
|
|
1105
|
-
if (node.object.type ===
|
|
1113
|
+
if (node.object.type === import_utils9.AST_NODE_TYPES.Identifier) {
|
|
1106
1114
|
return isWindowIdentifierName(node.object.name);
|
|
1107
1115
|
}
|
|
1108
|
-
if (node.object.type !==
|
|
1116
|
+
if (node.object.type !== import_utils9.AST_NODE_TYPES.MemberExpression) {
|
|
1109
1117
|
return false;
|
|
1110
1118
|
}
|
|
1111
1119
|
const nestedPropertyName = getMemberPropertyName5(node.object);
|
|
1112
1120
|
if (nestedPropertyName !== "window") {
|
|
1113
1121
|
return false;
|
|
1114
1122
|
}
|
|
1115
|
-
if (node.object.object.type ===
|
|
1123
|
+
if (node.object.object.type === import_utils9.AST_NODE_TYPES.ThisExpression) {
|
|
1116
1124
|
return true;
|
|
1117
1125
|
}
|
|
1118
|
-
return node.object.object.type ===
|
|
1126
|
+
return node.object.object.type === import_utils9.AST_NODE_TYPES.Identifier && node.object.object.name === "globalThis";
|
|
1119
1127
|
};
|
|
1120
1128
|
var isDocumentObject = (node, context, fullTypeChecker) => {
|
|
1121
1129
|
if (fullTypeChecker !== void 0) {
|
|
1122
1130
|
return getNodeTypeAsString(fullTypeChecker, node, context) === "Document";
|
|
1123
1131
|
}
|
|
1124
|
-
if (node.type ===
|
|
1132
|
+
if (node.type === import_utils9.AST_NODE_TYPES.Identifier) {
|
|
1125
1133
|
return node.name === "document";
|
|
1126
1134
|
}
|
|
1127
|
-
if (node.type ===
|
|
1135
|
+
if (node.type === import_utils9.AST_NODE_TYPES.MemberExpression) {
|
|
1128
1136
|
return isDocumentMemberReference(node);
|
|
1129
1137
|
}
|
|
1130
1138
|
return false;
|
|
@@ -1165,12 +1173,13 @@ var rule11 = createRule({
|
|
|
1165
1173
|
var no_cookies_default = rule11;
|
|
1166
1174
|
|
|
1167
1175
|
// dist/rules/no-document-domain.js
|
|
1176
|
+
var import_utils10 = require("@typescript-eslint/utils");
|
|
1168
1177
|
var rule12 = createRule({
|
|
1169
1178
|
create(context) {
|
|
1170
1179
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
1171
1180
|
return {
|
|
1172
1181
|
"AssignmentExpression[operator='='][left.property.name='domain']"(node) {
|
|
1173
|
-
if (node.left.type !==
|
|
1182
|
+
if (node.left.type !== import_utils10.AST_NODE_TYPES.MemberExpression) {
|
|
1174
1183
|
return;
|
|
1175
1184
|
}
|
|
1176
1185
|
if (!isDocumentObject(node.left.object, context, fullTypeChecker)) {
|
|
@@ -1202,13 +1211,14 @@ var rule12 = createRule({
|
|
|
1202
1211
|
var no_document_domain_default = rule12;
|
|
1203
1212
|
|
|
1204
1213
|
// dist/rules/no-document-execcommand-insert-html.js
|
|
1214
|
+
var import_utils11 = require("@typescript-eslint/utils");
|
|
1205
1215
|
var isInsertHtmlCommand = (expression) => getStaticStringValue(expression)?.toLowerCase() === "inserthtml";
|
|
1206
1216
|
var rule13 = createRule({
|
|
1207
1217
|
create(context) {
|
|
1208
1218
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
1209
1219
|
return {
|
|
1210
1220
|
CallExpression(node) {
|
|
1211
|
-
if (node.callee.type !==
|
|
1221
|
+
if (node.callee.type !== import_utils11.AST_NODE_TYPES.MemberExpression) {
|
|
1212
1222
|
return;
|
|
1213
1223
|
}
|
|
1214
1224
|
if (getMemberPropertyName3(node.callee) !== "execCommand") {
|
|
@@ -1218,10 +1228,10 @@ var rule13 = createRule({
|
|
|
1218
1228
|
return;
|
|
1219
1229
|
}
|
|
1220
1230
|
const [firstArgument, , thirdArgument] = node.arguments;
|
|
1221
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
1231
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils11.AST_NODE_TYPES.SpreadElement || !isInsertHtmlCommand(firstArgument)) {
|
|
1222
1232
|
return;
|
|
1223
1233
|
}
|
|
1224
|
-
if (thirdArgument === void 0 || thirdArgument.type ===
|
|
1234
|
+
if (thirdArgument === void 0 || thirdArgument.type === import_utils11.AST_NODE_TYPES.SpreadElement || getStaticStringValue(thirdArgument) === "") {
|
|
1225
1235
|
return;
|
|
1226
1236
|
}
|
|
1227
1237
|
context.report({
|
|
@@ -1250,20 +1260,21 @@ var rule13 = createRule({
|
|
|
1250
1260
|
var no_document_execcommand_insert_html_default = rule13;
|
|
1251
1261
|
|
|
1252
1262
|
// dist/rules/no-document-parse-html-unsafe.js
|
|
1263
|
+
var import_utils12 = require("@typescript-eslint/utils");
|
|
1253
1264
|
var isDocumentConstructorReference = (expression) => {
|
|
1254
|
-
if (expression.type ===
|
|
1265
|
+
if (expression.type === import_utils12.AST_NODE_TYPES.Identifier) {
|
|
1255
1266
|
return expression.name === "Document";
|
|
1256
1267
|
}
|
|
1257
|
-
if (expression.type !==
|
|
1268
|
+
if (expression.type !== import_utils12.AST_NODE_TYPES.MemberExpression) {
|
|
1258
1269
|
return false;
|
|
1259
1270
|
}
|
|
1260
1271
|
if (getMemberPropertyName3(expression) !== "Document") {
|
|
1261
1272
|
return false;
|
|
1262
1273
|
}
|
|
1263
|
-
return expression.object.type ===
|
|
1274
|
+
return expression.object.type === import_utils12.AST_NODE_TYPES.Identifier && (expression.object.name === "globalThis" || expression.object.name === "self" || expression.object.name === "window");
|
|
1264
1275
|
};
|
|
1265
1276
|
var isDocumentParseHtmlUnsafeCall = (node) => {
|
|
1266
|
-
if (node.callee.type !==
|
|
1277
|
+
if (node.callee.type !== import_utils12.AST_NODE_TYPES.MemberExpression) {
|
|
1267
1278
|
return false;
|
|
1268
1279
|
}
|
|
1269
1280
|
if (getMemberPropertyName3(node.callee) !== "parseHTMLUnsafe") {
|
|
@@ -1279,7 +1290,7 @@ var rule14 = createRule({
|
|
|
1279
1290
|
return;
|
|
1280
1291
|
}
|
|
1281
1292
|
const [firstArgument] = node.arguments;
|
|
1282
|
-
if (firstArgument !== void 0 && firstArgument.type !==
|
|
1293
|
+
if (firstArgument !== void 0 && firstArgument.type !== import_utils12.AST_NODE_TYPES.SpreadElement && getStaticStringValue(firstArgument) === "") {
|
|
1283
1294
|
return;
|
|
1284
1295
|
}
|
|
1285
1296
|
context.report({
|
|
@@ -1308,12 +1319,13 @@ var rule14 = createRule({
|
|
|
1308
1319
|
var no_document_parse_html_unsafe_default = rule14;
|
|
1309
1320
|
|
|
1310
1321
|
// dist/rules/no-document-write.js
|
|
1322
|
+
var import_utils13 = require("@typescript-eslint/utils");
|
|
1311
1323
|
var rule15 = createRule({
|
|
1312
1324
|
create(context) {
|
|
1313
1325
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
1314
1326
|
return {
|
|
1315
1327
|
"CallExpression[arguments.length=1][callee.property.name=/^(?:write|writeln)$/]"(node) {
|
|
1316
|
-
if (node.callee.type !==
|
|
1328
|
+
if (node.callee.type !== import_utils13.AST_NODE_TYPES.MemberExpression) {
|
|
1317
1329
|
return;
|
|
1318
1330
|
}
|
|
1319
1331
|
if (!isDocumentObject(node.callee.object, context, fullTypeChecker)) {
|
|
@@ -1345,30 +1357,32 @@ var rule15 = createRule({
|
|
|
1345
1357
|
var no_document_write_default = rule15;
|
|
1346
1358
|
|
|
1347
1359
|
// dist/rules/no-domparser-html-without-sanitization.js
|
|
1360
|
+
var import_utils15 = require("@typescript-eslint/utils");
|
|
1348
1361
|
var import_ts_extras8 = require("ts-extras");
|
|
1349
1362
|
|
|
1350
1363
|
// dist/_internal/domparser.js
|
|
1351
|
-
var
|
|
1364
|
+
var import_utils14 = require("@typescript-eslint/utils");
|
|
1365
|
+
var SANITIZER_NAME_PATTERN = /createhtml|sanitize|trusted/v;
|
|
1352
1366
|
var isDomParserParseFromStringCall = (node) => {
|
|
1353
|
-
if (node.callee.type !==
|
|
1367
|
+
if (node.callee.type !== import_utils14.AST_NODE_TYPES.MemberExpression) {
|
|
1354
1368
|
return false;
|
|
1355
1369
|
}
|
|
1356
1370
|
if (getMemberPropertyName3(node.callee) !== "parseFromString") {
|
|
1357
1371
|
return false;
|
|
1358
1372
|
}
|
|
1359
|
-
if (node.callee.object.type !==
|
|
1373
|
+
if (node.callee.object.type !== import_utils14.AST_NODE_TYPES.NewExpression) {
|
|
1360
1374
|
return false;
|
|
1361
1375
|
}
|
|
1362
|
-
return node.callee.object.callee.type ===
|
|
1376
|
+
return node.callee.object.callee.type === import_utils14.AST_NODE_TYPES.Identifier && node.callee.object.callee.name === "DOMParser";
|
|
1363
1377
|
};
|
|
1364
1378
|
var isSanitizedExpression = (node) => {
|
|
1365
|
-
if (node.type !==
|
|
1379
|
+
if (node.type !== import_utils14.AST_NODE_TYPES.CallExpression) {
|
|
1366
1380
|
return false;
|
|
1367
1381
|
}
|
|
1368
|
-
if (node.callee.type ===
|
|
1382
|
+
if (node.callee.type === import_utils14.AST_NODE_TYPES.Identifier) {
|
|
1369
1383
|
return SANITIZER_NAME_PATTERN.test(node.callee.name.toLowerCase());
|
|
1370
1384
|
}
|
|
1371
|
-
if (node.callee.type !==
|
|
1385
|
+
if (node.callee.type !== import_utils14.AST_NODE_TYPES.MemberExpression) {
|
|
1372
1386
|
return false;
|
|
1373
1387
|
}
|
|
1374
1388
|
const propertyName = getMemberPropertyName3(node.callee);
|
|
@@ -1390,7 +1404,7 @@ var rule16 = createRule({
|
|
|
1390
1404
|
if (!(0, import_ts_extras8.isDefined)(firstArgument) || !(0, import_ts_extras8.isDefined)(secondArgument)) {
|
|
1391
1405
|
return;
|
|
1392
1406
|
}
|
|
1393
|
-
if (firstArgument.type ===
|
|
1407
|
+
if (firstArgument.type === import_utils15.AST_NODE_TYPES.SpreadElement || secondArgument.type === import_utils15.AST_NODE_TYPES.SpreadElement) {
|
|
1394
1408
|
return;
|
|
1395
1409
|
}
|
|
1396
1410
|
const mimeTypeValue = getStaticStringValue(secondArgument);
|
|
@@ -1426,6 +1440,7 @@ var rule16 = createRule({
|
|
|
1426
1440
|
var no_domparser_html_without_sanitization_default = rule16;
|
|
1427
1441
|
|
|
1428
1442
|
// dist/rules/no-domparser-svg-without-sanitization.js
|
|
1443
|
+
var import_utils16 = require("@typescript-eslint/utils");
|
|
1429
1444
|
var import_ts_extras9 = require("ts-extras");
|
|
1430
1445
|
var rule17 = createRule({
|
|
1431
1446
|
create(context) {
|
|
@@ -1441,7 +1456,7 @@ var rule17 = createRule({
|
|
|
1441
1456
|
if (!(0, import_ts_extras9.isDefined)(firstArgument) || !(0, import_ts_extras9.isDefined)(secondArgument)) {
|
|
1442
1457
|
return;
|
|
1443
1458
|
}
|
|
1444
|
-
if (firstArgument.type ===
|
|
1459
|
+
if (firstArgument.type === import_utils16.AST_NODE_TYPES.SpreadElement || secondArgument.type === import_utils16.AST_NODE_TYPES.SpreadElement) {
|
|
1445
1460
|
return;
|
|
1446
1461
|
}
|
|
1447
1462
|
const mimeTypeValue = getStaticStringValue(secondArgument);
|
|
@@ -1477,6 +1492,7 @@ var rule17 = createRule({
|
|
|
1477
1492
|
var no_domparser_svg_without_sanitization_default = rule17;
|
|
1478
1493
|
|
|
1479
1494
|
// dist/_internal/worker-code-loading.js
|
|
1495
|
+
var import_utils17 = require("@typescript-eslint/utils");
|
|
1480
1496
|
var import_ts_extras10 = require("ts-extras");
|
|
1481
1497
|
var WORKER_CONSTRUCTOR_NAMES = /* @__PURE__ */ new Set(["SharedWorker", "Worker"]);
|
|
1482
1498
|
var GLOBAL_OBJECT_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -1485,62 +1501,62 @@ var GLOBAL_OBJECT_NAMES = /* @__PURE__ */ new Set([
|
|
|
1485
1501
|
"window"
|
|
1486
1502
|
]);
|
|
1487
1503
|
var isNavigatorObject = (value) => {
|
|
1488
|
-
if (value.type ===
|
|
1504
|
+
if (value.type === import_utils17.AST_NODE_TYPES.Identifier) {
|
|
1489
1505
|
return value.name === "navigator";
|
|
1490
1506
|
}
|
|
1491
|
-
if (value.type !==
|
|
1507
|
+
if (value.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1492
1508
|
return false;
|
|
1493
1509
|
}
|
|
1494
|
-
return getMemberPropertyName3(value) === "navigator" && value.object.type ===
|
|
1510
|
+
return getMemberPropertyName3(value) === "navigator" && value.object.type === import_utils17.AST_NODE_TYPES.Identifier && (0, import_ts_extras10.setHas)(GLOBAL_OBJECT_NAMES, value.object.name);
|
|
1495
1511
|
};
|
|
1496
|
-
var isBlobUrl = (value) => /^\s*blob:/
|
|
1497
|
-
var isDataUrl = (value) => /^\s*data:/
|
|
1512
|
+
var isBlobUrl = (value) => /^\s*blob:/iv.test(value);
|
|
1513
|
+
var isDataUrl = (value) => /^\s*data:/iv.test(value);
|
|
1498
1514
|
var isWorkerConstructorName = (value) => (0, import_ts_extras10.isDefined)(value) && (0, import_ts_extras10.setHas)(WORKER_CONSTRUCTOR_NAMES, value);
|
|
1499
1515
|
var isGlobalObjectName = (value) => (0, import_ts_extras10.setHas)(GLOBAL_OBJECT_NAMES, value);
|
|
1500
|
-
var isWorkerGlobalObject = (value) => value.type ===
|
|
1516
|
+
var isWorkerGlobalObject = (value) => value.type === import_utils17.AST_NODE_TYPES.Identifier && isGlobalObjectName(value.name);
|
|
1501
1517
|
var isWorkerConstructor = (callee) => {
|
|
1502
|
-
if (callee.type ===
|
|
1518
|
+
if (callee.type === import_utils17.AST_NODE_TYPES.Identifier) {
|
|
1503
1519
|
return isWorkerConstructorName(callee.name);
|
|
1504
1520
|
}
|
|
1505
|
-
if (callee.type !==
|
|
1521
|
+
if (callee.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1506
1522
|
return false;
|
|
1507
1523
|
}
|
|
1508
1524
|
return isWorkerConstructorName(getMemberPropertyName3(callee)) && isWorkerGlobalObject(callee.object);
|
|
1509
1525
|
};
|
|
1510
1526
|
var isImportScriptsCall = (callee) => {
|
|
1511
|
-
if (callee.type ===
|
|
1527
|
+
if (callee.type === import_utils17.AST_NODE_TYPES.Identifier) {
|
|
1512
1528
|
return callee.name === "importScripts";
|
|
1513
1529
|
}
|
|
1514
|
-
if (callee.type !==
|
|
1530
|
+
if (callee.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1515
1531
|
return false;
|
|
1516
1532
|
}
|
|
1517
1533
|
return getMemberPropertyName3(callee) === "importScripts" && isWorkerGlobalObject(callee.object);
|
|
1518
1534
|
};
|
|
1519
1535
|
var isServiceWorkerContainerAccess = (value) => {
|
|
1520
|
-
if (value.type !==
|
|
1536
|
+
if (value.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1521
1537
|
return false;
|
|
1522
1538
|
}
|
|
1523
1539
|
return getMemberPropertyName3(value) === "serviceWorker" && isNavigatorObject(value.object);
|
|
1524
1540
|
};
|
|
1525
|
-
var isServiceWorkerRegisterCall = (callee) => callee.type ===
|
|
1541
|
+
var isServiceWorkerRegisterCall = (callee) => callee.type === import_utils17.AST_NODE_TYPES.MemberExpression && getMemberPropertyName3(callee) === "register" && isServiceWorkerContainerAccess(callee.object);
|
|
1526
1542
|
var isGlobalUrlObject = (node) => {
|
|
1527
1543
|
if (getMemberPropertyName3(node) !== "URL") {
|
|
1528
1544
|
return false;
|
|
1529
1545
|
}
|
|
1530
|
-
return node.object.type ===
|
|
1546
|
+
return node.object.type === import_utils17.AST_NODE_TYPES.Identifier && isGlobalObjectName(node.object.name);
|
|
1531
1547
|
};
|
|
1532
1548
|
var isUrlCreateObjectUrlCall = (node) => {
|
|
1533
|
-
if (node.type !==
|
|
1549
|
+
if (node.type !== import_utils17.AST_NODE_TYPES.CallExpression || node.callee.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1534
1550
|
return false;
|
|
1535
1551
|
}
|
|
1536
1552
|
if (getMemberPropertyName3(node.callee) !== "createObjectURL") {
|
|
1537
1553
|
return false;
|
|
1538
1554
|
}
|
|
1539
|
-
return node.callee.object.type ===
|
|
1555
|
+
return node.callee.object.type === import_utils17.AST_NODE_TYPES.Identifier && node.callee.object.name === "URL" || node.callee.object.type === import_utils17.AST_NODE_TYPES.MemberExpression && isGlobalUrlObject(node.callee.object);
|
|
1540
1556
|
};
|
|
1541
1557
|
|
|
1542
1558
|
// dist/rules/no-dynamic-import-unsafe-url.js
|
|
1543
|
-
var isJavaScriptUrl = (value) => /^\s*javascript\s*:/
|
|
1559
|
+
var isJavaScriptUrl = (value) => /^\s*javascript\s*:/iv.test(value);
|
|
1544
1560
|
var isUnsafeDynamicImportSource = (expression) => {
|
|
1545
1561
|
const configuredValue = getStaticStringValue(expression);
|
|
1546
1562
|
return typeof configuredValue === "string" && (isBlobUrl(configuredValue) || isDataUrl(configuredValue) || isJavaScriptUrl(configuredValue)) || isUrlCreateObjectUrlCall(expression);
|
|
@@ -1578,21 +1594,19 @@ var rule18 = createRule({
|
|
|
1578
1594
|
var no_dynamic_import_unsafe_url_default = rule18;
|
|
1579
1595
|
|
|
1580
1596
|
// dist/_internal/electron-web-preferences.js
|
|
1597
|
+
var import_utils18 = require("@typescript-eslint/utils");
|
|
1581
1598
|
var getPropertyName2 = (property) => {
|
|
1582
1599
|
if (property.computed) {
|
|
1583
1600
|
return void 0;
|
|
1584
1601
|
}
|
|
1585
|
-
if (property.key.type ===
|
|
1602
|
+
if (property.key.type === import_utils18.AST_NODE_TYPES.Identifier) {
|
|
1586
1603
|
return property.key.name;
|
|
1587
1604
|
}
|
|
1588
|
-
|
|
1589
|
-
return property.key.value;
|
|
1590
|
-
}
|
|
1591
|
-
return void 0;
|
|
1605
|
+
return typeof property.key.value === "string" ? property.key.value : void 0;
|
|
1592
1606
|
};
|
|
1593
1607
|
var getPropertyByName = (objectExpression, propertyName) => {
|
|
1594
1608
|
for (const propertyNode of objectExpression.properties) {
|
|
1595
|
-
if (propertyNode.type !==
|
|
1609
|
+
if (propertyNode.type !== import_utils18.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
1596
1610
|
continue;
|
|
1597
1611
|
}
|
|
1598
1612
|
if (getPropertyName2(propertyNode) === propertyName) {
|
|
@@ -1602,7 +1616,7 @@ var getPropertyByName = (objectExpression, propertyName) => {
|
|
|
1602
1616
|
return void 0;
|
|
1603
1617
|
};
|
|
1604
1618
|
var getBooleanLiteralValue = (valueNode) => {
|
|
1605
|
-
if (valueNode.type !==
|
|
1619
|
+
if (valueNode.type !== import_utils18.AST_NODE_TYPES.Literal || typeof valueNode.value !== "boolean") {
|
|
1606
1620
|
return void 0;
|
|
1607
1621
|
}
|
|
1608
1622
|
return valueNode.value;
|
|
@@ -1610,11 +1624,11 @@ var getBooleanLiteralValue = (valueNode) => {
|
|
|
1610
1624
|
var createElectronWebPreferencesBooleanListener = (context, check) => ({
|
|
1611
1625
|
"NewExpression[callee.name=/^(?:BrowserWindow|BrowserView)$/]"(node) {
|
|
1612
1626
|
const [firstArgument] = node.arguments;
|
|
1613
|
-
if (firstArgument?.type !==
|
|
1627
|
+
if (firstArgument?.type !== import_utils18.AST_NODE_TYPES.ObjectExpression) {
|
|
1614
1628
|
return;
|
|
1615
1629
|
}
|
|
1616
1630
|
const webPreferencesProperty = getPropertyByName(firstArgument, "webPreferences");
|
|
1617
|
-
if (webPreferencesProperty?.value.type !==
|
|
1631
|
+
if (webPreferencesProperty?.value.type !== import_utils18.AST_NODE_TYPES.ObjectExpression) {
|
|
1618
1632
|
return;
|
|
1619
1633
|
}
|
|
1620
1634
|
const preferenceProperty = getPropertyByName(webPreferencesProperty.value, check.preferenceName);
|
|
@@ -1664,22 +1678,20 @@ var rule19 = createRule({
|
|
|
1664
1678
|
var no_electron_allow_running_insecure_content_default = rule19;
|
|
1665
1679
|
|
|
1666
1680
|
// dist/rules/no-electron-dangerous-blink-features.js
|
|
1681
|
+
var import_utils19 = require("@typescript-eslint/utils");
|
|
1667
1682
|
var import_ts_extras11 = require("ts-extras");
|
|
1668
1683
|
var getPropertyName3 = (property) => {
|
|
1669
1684
|
if (property.computed) {
|
|
1670
1685
|
return void 0;
|
|
1671
1686
|
}
|
|
1672
|
-
if (property.key.type ===
|
|
1687
|
+
if (property.key.type === import_utils19.AST_NODE_TYPES.Identifier) {
|
|
1673
1688
|
return property.key.name;
|
|
1674
1689
|
}
|
|
1675
|
-
|
|
1676
|
-
return property.key.value;
|
|
1677
|
-
}
|
|
1678
|
-
return void 0;
|
|
1690
|
+
return typeof property.key.value === "string" ? property.key.value : void 0;
|
|
1679
1691
|
};
|
|
1680
1692
|
var getPropertyByName2 = (objectExpression, propertyName) => {
|
|
1681
1693
|
for (const propertyNode of objectExpression.properties) {
|
|
1682
|
-
if (propertyNode.type !==
|
|
1694
|
+
if (propertyNode.type !== import_utils19.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
1683
1695
|
continue;
|
|
1684
1696
|
}
|
|
1685
1697
|
if (getPropertyName3(propertyNode) === propertyName) {
|
|
@@ -1689,10 +1701,10 @@ var getPropertyByName2 = (objectExpression, propertyName) => {
|
|
|
1689
1701
|
return void 0;
|
|
1690
1702
|
};
|
|
1691
1703
|
var getStaticStringValue2 = (node) => {
|
|
1692
|
-
if (node.type ===
|
|
1704
|
+
if (node.type === import_utils19.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
1693
1705
|
return node.value;
|
|
1694
1706
|
}
|
|
1695
|
-
if (node.type ===
|
|
1707
|
+
if (node.type === import_utils19.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
1696
1708
|
return (0, import_ts_extras11.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
1697
1709
|
}
|
|
1698
1710
|
return void 0;
|
|
@@ -1709,11 +1721,11 @@ var rule20 = createRule({
|
|
|
1709
1721
|
return {
|
|
1710
1722
|
"NewExpression[callee.name=/^(?:BrowserWindow|BrowserView)$/]"(node) {
|
|
1711
1723
|
const [firstArgument] = node.arguments;
|
|
1712
|
-
if (firstArgument?.type !==
|
|
1724
|
+
if (firstArgument?.type !== import_utils19.AST_NODE_TYPES.ObjectExpression) {
|
|
1713
1725
|
return;
|
|
1714
1726
|
}
|
|
1715
1727
|
const webPreferencesProperty = getPropertyByName2(firstArgument, "webPreferences");
|
|
1716
|
-
if (webPreferencesProperty?.value.type !==
|
|
1728
|
+
if (webPreferencesProperty?.value.type !== import_utils19.AST_NODE_TYPES.ObjectExpression) {
|
|
1717
1729
|
return;
|
|
1718
1730
|
}
|
|
1719
1731
|
const enableBlinkFeaturesProperty = getPropertyByName2(webPreferencesProperty.value, "enableBlinkFeatures");
|
|
@@ -1911,18 +1923,19 @@ var rule26 = createRule({
|
|
|
1911
1923
|
var no_electron_experimental_features_default = rule26;
|
|
1912
1924
|
|
|
1913
1925
|
// dist/rules/no-electron-expose-raw-ipc-renderer.js
|
|
1914
|
-
var
|
|
1926
|
+
var import_utils20 = require("@typescript-eslint/utils");
|
|
1927
|
+
var isExpressionNode = (node) => node.type !== import_utils20.AST_NODE_TYPES.ArrayPattern && node.type !== import_utils20.AST_NODE_TYPES.AssignmentPattern && node.type !== import_utils20.AST_NODE_TYPES.ObjectPattern;
|
|
1915
1928
|
var isContextBridgeObjectExpression = (expression) => {
|
|
1916
|
-
if (expression.type ===
|
|
1929
|
+
if (expression.type === import_utils20.AST_NODE_TYPES.Identifier) {
|
|
1917
1930
|
return expression.name === "contextBridge";
|
|
1918
1931
|
}
|
|
1919
|
-
if (expression.type !==
|
|
1932
|
+
if (expression.type !== import_utils20.AST_NODE_TYPES.MemberExpression) {
|
|
1920
1933
|
return false;
|
|
1921
1934
|
}
|
|
1922
1935
|
return getMemberPropertyName3(expression) === "contextBridge";
|
|
1923
1936
|
};
|
|
1924
1937
|
var isContextBridgeExposeCall = (node) => {
|
|
1925
|
-
if (node.callee.type !==
|
|
1938
|
+
if (node.callee.type !== import_utils20.AST_NODE_TYPES.MemberExpression) {
|
|
1926
1939
|
return false;
|
|
1927
1940
|
}
|
|
1928
1941
|
const methodName = getMemberPropertyName3(node.callee);
|
|
@@ -1932,16 +1945,16 @@ var isContextBridgeExposeCall = (node) => {
|
|
|
1932
1945
|
return isContextBridgeObjectExpression(node.callee.object);
|
|
1933
1946
|
};
|
|
1934
1947
|
var isIpcRendererReference = (expression) => {
|
|
1935
|
-
if (expression.type ===
|
|
1948
|
+
if (expression.type === import_utils20.AST_NODE_TYPES.Identifier) {
|
|
1936
1949
|
return expression.name === "ipcRenderer";
|
|
1937
1950
|
}
|
|
1938
|
-
if (expression.type !==
|
|
1951
|
+
if (expression.type !== import_utils20.AST_NODE_TYPES.MemberExpression) {
|
|
1939
1952
|
return false;
|
|
1940
1953
|
}
|
|
1941
|
-
if (expression.object.type ===
|
|
1954
|
+
if (expression.object.type === import_utils20.AST_NODE_TYPES.Identifier) {
|
|
1942
1955
|
return expression.object.name === "ipcRenderer";
|
|
1943
1956
|
}
|
|
1944
|
-
if (expression.object.type !==
|
|
1957
|
+
if (expression.object.type !== import_utils20.AST_NODE_TYPES.MemberExpression) {
|
|
1945
1958
|
return false;
|
|
1946
1959
|
}
|
|
1947
1960
|
return getMemberPropertyName3(expression.object) === "ipcRenderer";
|
|
@@ -1950,17 +1963,17 @@ var isUnsafeExposedValue = (expression) => {
|
|
|
1950
1963
|
if (isIpcRendererReference(expression)) {
|
|
1951
1964
|
return true;
|
|
1952
1965
|
}
|
|
1953
|
-
if (expression.type ===
|
|
1966
|
+
if (expression.type === import_utils20.AST_NODE_TYPES.CallExpression && expression.callee.type === import_utils20.AST_NODE_TYPES.MemberExpression && getMemberPropertyName3(expression.callee) === "bind" && expression.callee.object.type === import_utils20.AST_NODE_TYPES.MemberExpression) {
|
|
1954
1967
|
return isIpcRendererReference(expression.callee.object);
|
|
1955
1968
|
}
|
|
1956
|
-
if (expression.type ===
|
|
1957
|
-
return expression.elements.some((element) => element !== null && element.type !==
|
|
1969
|
+
if (expression.type === import_utils20.AST_NODE_TYPES.ArrayExpression) {
|
|
1970
|
+
return expression.elements.some((element) => element !== null && element.type !== import_utils20.AST_NODE_TYPES.SpreadElement && isUnsafeExposedValue(element));
|
|
1958
1971
|
}
|
|
1959
|
-
if (expression.type !==
|
|
1972
|
+
if (expression.type !== import_utils20.AST_NODE_TYPES.ObjectExpression) {
|
|
1960
1973
|
return false;
|
|
1961
1974
|
}
|
|
1962
1975
|
return expression.properties.some((propertyNode) => {
|
|
1963
|
-
if (propertyNode.type ===
|
|
1976
|
+
if (propertyNode.type === import_utils20.AST_NODE_TYPES.SpreadElement) {
|
|
1964
1977
|
return isUnsafeExposedValue(propertyNode.argument);
|
|
1965
1978
|
}
|
|
1966
1979
|
return propertyNode.kind === "init" && isExpressionNode(propertyNode.value) && isUnsafeExposedValue(propertyNode.value);
|
|
@@ -1974,7 +1987,7 @@ var rule27 = createRule({
|
|
|
1974
1987
|
return;
|
|
1975
1988
|
}
|
|
1976
1989
|
const [, exposedValue] = node.arguments;
|
|
1977
|
-
if (exposedValue === void 0 || exposedValue.type ===
|
|
1990
|
+
if (exposedValue === void 0 || exposedValue.type === import_utils20.AST_NODE_TYPES.SpreadElement || !isUnsafeExposedValue(exposedValue)) {
|
|
1978
1991
|
return;
|
|
1979
1992
|
}
|
|
1980
1993
|
context.report({
|
|
@@ -2003,25 +2016,26 @@ var rule27 = createRule({
|
|
|
2003
2016
|
var no_electron_expose_raw_ipc_renderer_default = rule27;
|
|
2004
2017
|
|
|
2005
2018
|
// dist/rules/no-electron-insecure-certificate-error-handler.js
|
|
2019
|
+
var import_utils21 = require("@typescript-eslint/utils");
|
|
2006
2020
|
var import_ts_extras12 = require("ts-extras");
|
|
2007
2021
|
var getStaticStringValue3 = (node) => {
|
|
2008
|
-
if (node.type ===
|
|
2022
|
+
if (node.type === import_utils21.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
2009
2023
|
return node.value;
|
|
2010
2024
|
}
|
|
2011
|
-
if (node.type ===
|
|
2025
|
+
if (node.type === import_utils21.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
2012
2026
|
return (0, import_ts_extras12.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
2013
2027
|
}
|
|
2014
2028
|
return void 0;
|
|
2015
2029
|
};
|
|
2016
2030
|
var isOnMemberExpression = (callee) => {
|
|
2017
|
-
if (callee.type !==
|
|
2031
|
+
if (callee.type !== import_utils21.AST_NODE_TYPES.MemberExpression || callee.computed) {
|
|
2018
2032
|
return false;
|
|
2019
2033
|
}
|
|
2020
|
-
return callee.property.type ===
|
|
2034
|
+
return callee.property.type === import_utils21.AST_NODE_TYPES.Identifier && callee.property.name === "on";
|
|
2021
2035
|
};
|
|
2022
2036
|
var getCallbackParameterName = (node) => {
|
|
2023
2037
|
const callbackParameter = (0, import_ts_extras12.arrayAt)(node.params, -1);
|
|
2024
|
-
return callbackParameter?.type ===
|
|
2038
|
+
return callbackParameter?.type === import_utils21.AST_NODE_TYPES.Identifier ? callbackParameter.name : void 0;
|
|
2025
2039
|
};
|
|
2026
2040
|
var toUnsafeCallbackTruePattern = (callbackName) => (
|
|
2027
2041
|
// eslint-disable-next-line security/detect-non-literal-regexp -- Callback identifier is static source text and safely interpolated for targeted pattern matching.
|
|
@@ -2036,7 +2050,7 @@ var isCertificateErrorEventRegistration = (node) => {
|
|
|
2036
2050
|
return false;
|
|
2037
2051
|
}
|
|
2038
2052
|
const [firstArgument] = node.arguments;
|
|
2039
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2053
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils21.AST_NODE_TYPES.SpreadElement) {
|
|
2040
2054
|
return false;
|
|
2041
2055
|
}
|
|
2042
2056
|
return getStaticStringValue3(firstArgument) === "certificate-error";
|
|
@@ -2049,10 +2063,10 @@ var rule28 = createRule({
|
|
|
2049
2063
|
return;
|
|
2050
2064
|
}
|
|
2051
2065
|
const [, secondArgument] = node.arguments;
|
|
2052
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
2066
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils21.AST_NODE_TYPES.SpreadElement) {
|
|
2053
2067
|
return;
|
|
2054
2068
|
}
|
|
2055
|
-
if (secondArgument.type !==
|
|
2069
|
+
if (secondArgument.type !== import_utils21.AST_NODE_TYPES.ArrowFunctionExpression && secondArgument.type !== import_utils21.AST_NODE_TYPES.FunctionExpression) {
|
|
2056
2070
|
return;
|
|
2057
2071
|
}
|
|
2058
2072
|
const callbackParameterName = getCallbackParameterName(secondArgument);
|
|
@@ -2088,39 +2102,45 @@ var rule28 = createRule({
|
|
|
2088
2102
|
var no_electron_insecure_certificate_error_handler_default = rule28;
|
|
2089
2103
|
|
|
2090
2104
|
// dist/rules/no-electron-insecure-certificate-verify-proc.js
|
|
2105
|
+
var import_utils22 = require("@typescript-eslint/utils");
|
|
2091
2106
|
var import_ts_extras13 = require("ts-extras");
|
|
2092
2107
|
var getMemberPropertyName6 = (memberExpression) => {
|
|
2093
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2108
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils22.AST_NODE_TYPES.Identifier) {
|
|
2094
2109
|
return memberExpression.property.name;
|
|
2095
2110
|
}
|
|
2096
|
-
if (memberExpression.property.type ===
|
|
2111
|
+
if (memberExpression.property.type === import_utils22.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2097
2112
|
return memberExpression.property.value;
|
|
2098
2113
|
}
|
|
2099
2114
|
return void 0;
|
|
2100
2115
|
};
|
|
2101
|
-
var isFunctionExpression = (expression) => expression.type ===
|
|
2116
|
+
var isFunctionExpression = (expression) => expression.type === import_utils22.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils22.AST_NODE_TYPES.FunctionExpression;
|
|
2102
2117
|
var hasInsecureCertificateOverride = (callbackNode, context, callbackParameterName) => {
|
|
2103
2118
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
2104
|
-
const escapedName = callbackParameterName.replaceAll(
|
|
2119
|
+
const escapedName = callbackParameterName.replaceAll(
|
|
2120
|
+
"$",
|
|
2121
|
+
// eslint-disable-next-line unicorn/prefer-string-raw -- Replacement callback avoids `$` replacement-token semantics.
|
|
2122
|
+
() => "\\$"
|
|
2123
|
+
);
|
|
2105
2124
|
const callbackPattern = new RegExp(String.raw`\b${escapedName}\s*\(\s*0\b`, "u");
|
|
2106
|
-
return callbackPattern.test(callbackSourceText) ||
|
|
2125
|
+
return callbackPattern.test(callbackSourceText) || // eslint-disable-next-line regexp/require-unicode-sets-regexp -- `/v` is not yet parseable in the current TypeScript-ESLint parser stack.
|
|
2126
|
+
/\breturn\s+0\b/u.test(callbackSourceText);
|
|
2107
2127
|
};
|
|
2108
2128
|
var rule29 = createRule({
|
|
2109
2129
|
create(context) {
|
|
2110
2130
|
return {
|
|
2111
2131
|
CallExpression(node) {
|
|
2112
|
-
if (node.callee.type !==
|
|
2132
|
+
if (node.callee.type !== import_utils22.AST_NODE_TYPES.MemberExpression) {
|
|
2113
2133
|
return;
|
|
2114
2134
|
}
|
|
2115
2135
|
if (getMemberPropertyName6(node.callee) !== "setCertificateVerifyProc") {
|
|
2116
2136
|
return;
|
|
2117
2137
|
}
|
|
2118
2138
|
const [firstArgument] = node.arguments;
|
|
2119
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2139
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils22.AST_NODE_TYPES.SpreadElement || !isFunctionExpression(firstArgument)) {
|
|
2120
2140
|
return;
|
|
2121
2141
|
}
|
|
2122
2142
|
const callbackParameter = (0, import_ts_extras13.arrayAt)(firstArgument.params, -1);
|
|
2123
|
-
if (callbackParameter?.type !==
|
|
2143
|
+
if (callbackParameter?.type !== import_utils22.AST_NODE_TYPES.Identifier) {
|
|
2124
2144
|
return;
|
|
2125
2145
|
}
|
|
2126
2146
|
if (!hasInsecureCertificateOverride(firstArgument, context, callbackParameter.name)) {
|
|
@@ -2152,39 +2172,45 @@ var rule29 = createRule({
|
|
|
2152
2172
|
var no_electron_insecure_certificate_verify_proc_default = rule29;
|
|
2153
2173
|
|
|
2154
2174
|
// dist/rules/no-electron-insecure-permission-request-handler.js
|
|
2175
|
+
var import_utils23 = require("@typescript-eslint/utils");
|
|
2155
2176
|
var import_ts_extras14 = require("ts-extras");
|
|
2156
2177
|
var getMemberPropertyName7 = (memberExpression) => {
|
|
2157
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2178
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils23.AST_NODE_TYPES.Identifier) {
|
|
2158
2179
|
return memberExpression.property.name;
|
|
2159
2180
|
}
|
|
2160
|
-
if (memberExpression.property.type ===
|
|
2181
|
+
if (memberExpression.property.type === import_utils23.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2161
2182
|
return memberExpression.property.value;
|
|
2162
2183
|
}
|
|
2163
2184
|
return void 0;
|
|
2164
2185
|
};
|
|
2165
|
-
var isFunctionExpression2 = (expression) => expression.type ===
|
|
2186
|
+
var isFunctionExpression2 = (expression) => expression.type === import_utils23.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils23.AST_NODE_TYPES.FunctionExpression;
|
|
2166
2187
|
var hasUnsafePermissionAllowPattern = (callbackNode, context, callbackParameterName) => {
|
|
2167
2188
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
2168
|
-
const escapedName = callbackParameterName.replaceAll(
|
|
2189
|
+
const escapedName = callbackParameterName.replaceAll(
|
|
2190
|
+
"$",
|
|
2191
|
+
// eslint-disable-next-line unicorn/prefer-string-raw -- Replacement callback avoids `$` replacement-token semantics.
|
|
2192
|
+
() => "\\$"
|
|
2193
|
+
);
|
|
2169
2194
|
const callbackPattern = new RegExp(String.raw`\b${escapedName}\s*\(\s*true\b`, "u");
|
|
2170
|
-
return callbackPattern.test(callbackSourceText) ||
|
|
2195
|
+
return callbackPattern.test(callbackSourceText) || // eslint-disable-next-line regexp/require-unicode-sets-regexp -- `/v` is not yet parseable in the current TypeScript-ESLint parser stack.
|
|
2196
|
+
/\breturn\s+true\b/u.test(callbackSourceText);
|
|
2171
2197
|
};
|
|
2172
2198
|
var rule30 = createRule({
|
|
2173
2199
|
create(context) {
|
|
2174
2200
|
return {
|
|
2175
2201
|
CallExpression(node) {
|
|
2176
|
-
if (node.callee.type !==
|
|
2202
|
+
if (node.callee.type !== import_utils23.AST_NODE_TYPES.MemberExpression) {
|
|
2177
2203
|
return;
|
|
2178
2204
|
}
|
|
2179
2205
|
if (getMemberPropertyName7(node.callee) !== "setPermissionRequestHandler") {
|
|
2180
2206
|
return;
|
|
2181
2207
|
}
|
|
2182
2208
|
const [firstArgument] = node.arguments;
|
|
2183
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2209
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils23.AST_NODE_TYPES.SpreadElement || !isFunctionExpression2(firstArgument)) {
|
|
2184
2210
|
return;
|
|
2185
2211
|
}
|
|
2186
2212
|
const callbackParameter = (0, import_ts_extras14.arrayAt)(firstArgument.params, -1);
|
|
2187
|
-
if (callbackParameter?.type !==
|
|
2213
|
+
if (callbackParameter?.type !== import_utils23.AST_NODE_TYPES.Identifier) {
|
|
2188
2214
|
return;
|
|
2189
2215
|
}
|
|
2190
2216
|
if (!hasUnsafePermissionAllowPattern(firstArgument, context, callbackParameter.name)) {
|
|
@@ -2266,31 +2292,32 @@ var rule31 = createRule({
|
|
|
2266
2292
|
var no_electron_node_integration_default = rule31;
|
|
2267
2293
|
|
|
2268
2294
|
// dist/rules/no-electron-permission-check-handler-allow-all.js
|
|
2295
|
+
var import_utils24 = require("@typescript-eslint/utils");
|
|
2269
2296
|
var import_ts_extras15 = require("ts-extras");
|
|
2270
|
-
var isFunctionExpression3 = (expression) => expression.type ===
|
|
2271
|
-
var isBooleanTrueLiteral = (expression) => expression?.type ===
|
|
2297
|
+
var isFunctionExpression3 = (expression) => expression.type === import_utils24.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils24.AST_NODE_TYPES.FunctionExpression;
|
|
2298
|
+
var isBooleanTrueLiteral = (expression) => expression?.type === import_utils24.AST_NODE_TYPES.Literal && expression.value === true;
|
|
2272
2299
|
var isAllowAllPermissionCheckHandler = (callbackNode) => {
|
|
2273
|
-
if (callbackNode.body.type !==
|
|
2300
|
+
if (callbackNode.body.type !== import_utils24.AST_NODE_TYPES.BlockStatement) {
|
|
2274
2301
|
return isBooleanTrueLiteral(callbackNode.body);
|
|
2275
2302
|
}
|
|
2276
2303
|
if (callbackNode.body.body.length !== 1) {
|
|
2277
2304
|
return false;
|
|
2278
2305
|
}
|
|
2279
2306
|
const onlyStatement = (0, import_ts_extras15.arrayFirst)(callbackNode.body.body);
|
|
2280
|
-
return onlyStatement?.type ===
|
|
2307
|
+
return onlyStatement?.type === import_utils24.AST_NODE_TYPES.ReturnStatement && isBooleanTrueLiteral(onlyStatement.argument);
|
|
2281
2308
|
};
|
|
2282
2309
|
var rule32 = createRule({
|
|
2283
2310
|
create(context) {
|
|
2284
2311
|
return {
|
|
2285
2312
|
CallExpression(node) {
|
|
2286
|
-
if (node.callee.type !==
|
|
2313
|
+
if (node.callee.type !== import_utils24.AST_NODE_TYPES.MemberExpression) {
|
|
2287
2314
|
return;
|
|
2288
2315
|
}
|
|
2289
2316
|
if (getMemberPropertyName3(node.callee) !== "setPermissionCheckHandler") {
|
|
2290
2317
|
return;
|
|
2291
2318
|
}
|
|
2292
2319
|
const [firstArgument] = node.arguments;
|
|
2293
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2320
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils24.AST_NODE_TYPES.SpreadElement || !isFunctionExpression3(firstArgument) || !isAllowAllPermissionCheckHandler(firstArgument)) {
|
|
2294
2321
|
return;
|
|
2295
2322
|
}
|
|
2296
2323
|
context.report({
|
|
@@ -2319,27 +2346,28 @@ var rule32 = createRule({
|
|
|
2319
2346
|
var no_electron_permission_check_handler_allow_all_default = rule32;
|
|
2320
2347
|
|
|
2321
2348
|
// dist/rules/no-electron-unchecked-ipc-sender.js
|
|
2349
|
+
var import_utils25 = require("@typescript-eslint/utils");
|
|
2322
2350
|
var import_ts_extras16 = require("ts-extras");
|
|
2323
2351
|
var getMemberPropertyName8 = (memberExpression) => {
|
|
2324
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2352
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils25.AST_NODE_TYPES.Identifier) {
|
|
2325
2353
|
return memberExpression.property.name;
|
|
2326
2354
|
}
|
|
2327
|
-
if (memberExpression.property.type ===
|
|
2355
|
+
if (memberExpression.property.type === import_utils25.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2328
2356
|
return memberExpression.property.value;
|
|
2329
2357
|
}
|
|
2330
2358
|
return void 0;
|
|
2331
2359
|
};
|
|
2332
2360
|
var isIpcMainObjectExpression = (expression) => {
|
|
2333
|
-
if (expression.type ===
|
|
2361
|
+
if (expression.type === import_utils25.AST_NODE_TYPES.Identifier) {
|
|
2334
2362
|
return expression.name === "ipcMain";
|
|
2335
2363
|
}
|
|
2336
|
-
if (expression.type !==
|
|
2364
|
+
if (expression.type !== import_utils25.AST_NODE_TYPES.MemberExpression) {
|
|
2337
2365
|
return false;
|
|
2338
2366
|
}
|
|
2339
2367
|
return getMemberPropertyName8(expression) === "ipcMain";
|
|
2340
2368
|
};
|
|
2341
2369
|
var isIpcMainHandlerRegistration = (node) => {
|
|
2342
|
-
if (node.callee.type !==
|
|
2370
|
+
if (node.callee.type !== import_utils25.AST_NODE_TYPES.MemberExpression) {
|
|
2343
2371
|
return false;
|
|
2344
2372
|
}
|
|
2345
2373
|
const methodName = getMemberPropertyName8(node.callee);
|
|
@@ -2348,12 +2376,17 @@ var isIpcMainHandlerRegistration = (node) => {
|
|
|
2348
2376
|
}
|
|
2349
2377
|
return isIpcMainObjectExpression(node.callee.object);
|
|
2350
2378
|
};
|
|
2351
|
-
var isFunctionExpression4 = (expression) => expression.type ===
|
|
2379
|
+
var isFunctionExpression4 = (expression) => expression.type === import_utils25.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils25.AST_NODE_TYPES.FunctionExpression;
|
|
2352
2380
|
var hasSenderValidationPattern = (callbackNode, context, eventParameterName) => {
|
|
2353
2381
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
2354
|
-
const escapedEventName = eventParameterName.replaceAll(
|
|
2382
|
+
const escapedEventName = eventParameterName.replaceAll(
|
|
2383
|
+
"$",
|
|
2384
|
+
// eslint-disable-next-line etc-misc/no-unnecessary-template-literal -- String.raw preserves the intended regex-escape backslash.
|
|
2385
|
+
() => String.raw`\$`
|
|
2386
|
+
);
|
|
2355
2387
|
const eventSenderPattern = new RegExp(String.raw`\b${escapedEventName}\s*\.\s*(?:sender|senderFrame)\b`, "u");
|
|
2356
|
-
return eventSenderPattern.test(callbackSourceText) ||
|
|
2388
|
+
return eventSenderPattern.test(callbackSourceText) || // eslint-disable-next-line regexp/require-unicode-sets-regexp -- `/v` is not yet parseable in the current TypeScript-ESLint parser stack.
|
|
2389
|
+
/\b(?:allowlist|getURL|isTrusted|origin|validate|whitelist)\b/u.test(callbackSourceText);
|
|
2357
2390
|
};
|
|
2358
2391
|
var rule33 = createRule({
|
|
2359
2392
|
create(context) {
|
|
@@ -2363,11 +2396,11 @@ var rule33 = createRule({
|
|
|
2363
2396
|
return;
|
|
2364
2397
|
}
|
|
2365
2398
|
const [, handlerNode] = node.arguments;
|
|
2366
|
-
if (handlerNode === void 0 || handlerNode.type ===
|
|
2399
|
+
if (handlerNode === void 0 || handlerNode.type === import_utils25.AST_NODE_TYPES.SpreadElement || !isFunctionExpression4(handlerNode)) {
|
|
2367
2400
|
return;
|
|
2368
2401
|
}
|
|
2369
2402
|
const eventParameter = (0, import_ts_extras16.arrayFirst)(handlerNode.params);
|
|
2370
|
-
if (eventParameter?.type !==
|
|
2403
|
+
if (eventParameter?.type !== import_utils25.AST_NODE_TYPES.Identifier) {
|
|
2371
2404
|
return;
|
|
2372
2405
|
}
|
|
2373
2406
|
if (hasSenderValidationPattern(handlerNode, context, eventParameter.name)) {
|
|
@@ -2399,24 +2432,29 @@ var rule33 = createRule({
|
|
|
2399
2432
|
var no_electron_unchecked_ipc_sender_default = rule33;
|
|
2400
2433
|
|
|
2401
2434
|
// dist/rules/no-electron-unrestricted-navigation.js
|
|
2435
|
+
var import_utils26 = require("@typescript-eslint/utils");
|
|
2402
2436
|
var import_ts_extras17 = require("ts-extras");
|
|
2403
2437
|
var getMemberPropertyName9 = (memberExpression) => {
|
|
2404
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2438
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils26.AST_NODE_TYPES.Identifier) {
|
|
2405
2439
|
return memberExpression.property.name;
|
|
2406
2440
|
}
|
|
2407
|
-
if (memberExpression.property.type ===
|
|
2441
|
+
if (memberExpression.property.type === import_utils26.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2408
2442
|
return memberExpression.property.value;
|
|
2409
2443
|
}
|
|
2410
2444
|
return void 0;
|
|
2411
2445
|
};
|
|
2412
|
-
var isFunctionExpression5 = (expression) => expression.type ===
|
|
2446
|
+
var isFunctionExpression5 = (expression) => expression.type === import_utils26.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils26.AST_NODE_TYPES.FunctionExpression;
|
|
2413
2447
|
var hasUnsafeAllowAction = (callbackNode, context) => {
|
|
2414
2448
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
2415
2449
|
return /\baction\s*:\s*["'`]allow["'`]/u.test(callbackSourceText);
|
|
2416
2450
|
};
|
|
2417
2451
|
var hasPreventDefaultCall = (callbackNode, context, eventParameterName) => {
|
|
2418
2452
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
2419
|
-
const escapedName = eventParameterName.replaceAll(
|
|
2453
|
+
const escapedName = eventParameterName.replaceAll(
|
|
2454
|
+
"$",
|
|
2455
|
+
// eslint-disable-next-line unicorn/prefer-string-raw -- Replacement callback avoids `$` replacement-token semantics.
|
|
2456
|
+
() => "\\$"
|
|
2457
|
+
);
|
|
2420
2458
|
const preventDefaultPattern = new RegExp(String.raw`\b${escapedName}\s*\.\s*preventDefault\s*\(`, "u");
|
|
2421
2459
|
return preventDefaultPattern.test(callbackSourceText);
|
|
2422
2460
|
};
|
|
@@ -2424,13 +2462,13 @@ var rule34 = createRule({
|
|
|
2424
2462
|
create(context) {
|
|
2425
2463
|
return {
|
|
2426
2464
|
CallExpression(node) {
|
|
2427
|
-
if (node.callee.type !==
|
|
2465
|
+
if (node.callee.type !== import_utils26.AST_NODE_TYPES.MemberExpression) {
|
|
2428
2466
|
return;
|
|
2429
2467
|
}
|
|
2430
2468
|
const methodName = getMemberPropertyName9(node.callee);
|
|
2431
2469
|
if (methodName === "setWindowOpenHandler") {
|
|
2432
2470
|
const [firstArgument2] = node.arguments;
|
|
2433
|
-
if (firstArgument2 === void 0 || firstArgument2.type ===
|
|
2471
|
+
if (firstArgument2 === void 0 || firstArgument2.type === import_utils26.AST_NODE_TYPES.SpreadElement || !isFunctionExpression5(firstArgument2)) {
|
|
2434
2472
|
return;
|
|
2435
2473
|
}
|
|
2436
2474
|
if (!hasUnsafeAllowAction(firstArgument2, context)) {
|
|
@@ -2446,14 +2484,14 @@ var rule34 = createRule({
|
|
|
2446
2484
|
return;
|
|
2447
2485
|
}
|
|
2448
2486
|
const [firstArgument, secondArgument] = node.arguments;
|
|
2449
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2487
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils26.AST_NODE_TYPES.SpreadElement || secondArgument === void 0 || secondArgument.type === import_utils26.AST_NODE_TYPES.SpreadElement || !isFunctionExpression5(secondArgument)) {
|
|
2450
2488
|
return;
|
|
2451
2489
|
}
|
|
2452
|
-
if (firstArgument.type !==
|
|
2490
|
+
if (firstArgument.type !== import_utils26.AST_NODE_TYPES.Literal || firstArgument.value !== "will-navigate") {
|
|
2453
2491
|
return;
|
|
2454
2492
|
}
|
|
2455
2493
|
const eventParameter = (0, import_ts_extras17.arrayFirst)(secondArgument.params);
|
|
2456
|
-
if (eventParameter?.type !==
|
|
2494
|
+
if (eventParameter?.type !== import_utils26.AST_NODE_TYPES.Identifier) {
|
|
2457
2495
|
return;
|
|
2458
2496
|
}
|
|
2459
2497
|
if (hasPreventDefaultCall(secondArgument, context, eventParameter.name)) {
|
|
@@ -2485,6 +2523,7 @@ var rule34 = createRule({
|
|
|
2485
2523
|
var no_electron_unrestricted_navigation_default = rule34;
|
|
2486
2524
|
|
|
2487
2525
|
// dist/rules/no-electron-untrusted-open-external.js
|
|
2526
|
+
var import_utils27 = require("@typescript-eslint/utils");
|
|
2488
2527
|
var import_ts_extras18 = require("ts-extras");
|
|
2489
2528
|
var getStaticTemplateLiteralValue = (templateLiteral) => {
|
|
2490
2529
|
if (templateLiteral.expressions.length > 0) {
|
|
@@ -2493,35 +2532,35 @@ var getStaticTemplateLiteralValue = (templateLiteral) => {
|
|
|
2493
2532
|
return (0, import_ts_extras18.arrayFirst)(templateLiteral.quasis)?.value.cooked ?? void 0;
|
|
2494
2533
|
};
|
|
2495
2534
|
var getStringValue = (node) => {
|
|
2496
|
-
if (node.type ===
|
|
2535
|
+
if (node.type === import_utils27.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
2497
2536
|
return node.value;
|
|
2498
2537
|
}
|
|
2499
|
-
if (node.type ===
|
|
2538
|
+
if (node.type === import_utils27.AST_NODE_TYPES.TemplateLiteral) {
|
|
2500
2539
|
return getStaticTemplateLiteralValue(node);
|
|
2501
2540
|
}
|
|
2502
2541
|
return void 0;
|
|
2503
2542
|
};
|
|
2504
|
-
var isAllowedExternalProtocol = (value) => /^(?:https|mailto):/
|
|
2543
|
+
var isAllowedExternalProtocol = (value) => /^(?:https|mailto):/iv.test(value.trim());
|
|
2505
2544
|
var getMemberPropertyName10 = (memberExpression) => {
|
|
2506
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2545
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils27.AST_NODE_TYPES.Identifier) {
|
|
2507
2546
|
return memberExpression.property.name;
|
|
2508
2547
|
}
|
|
2509
|
-
if (memberExpression.property.type ===
|
|
2548
|
+
if (memberExpression.property.type === import_utils27.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2510
2549
|
return memberExpression.property.value;
|
|
2511
2550
|
}
|
|
2512
2551
|
return void 0;
|
|
2513
2552
|
};
|
|
2514
2553
|
var isShellObjectExpression = (node) => {
|
|
2515
|
-
if (node.type ===
|
|
2554
|
+
if (node.type === import_utils27.AST_NODE_TYPES.Identifier) {
|
|
2516
2555
|
return node.name === "shell";
|
|
2517
2556
|
}
|
|
2518
|
-
if (node.type !==
|
|
2557
|
+
if (node.type !== import_utils27.AST_NODE_TYPES.MemberExpression) {
|
|
2519
2558
|
return false;
|
|
2520
2559
|
}
|
|
2521
2560
|
return getMemberPropertyName10(node) === "shell";
|
|
2522
2561
|
};
|
|
2523
2562
|
var isShellOpenExternalCallee = (callee) => {
|
|
2524
|
-
if (callee.type !==
|
|
2563
|
+
if (callee.type !== import_utils27.AST_NODE_TYPES.MemberExpression) {
|
|
2525
2564
|
return false;
|
|
2526
2565
|
}
|
|
2527
2566
|
if (getMemberPropertyName10(callee) !== "openExternal") {
|
|
@@ -2537,7 +2576,7 @@ var rule35 = createRule({
|
|
|
2537
2576
|
return;
|
|
2538
2577
|
}
|
|
2539
2578
|
const [firstArgument] = node.arguments;
|
|
2540
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2579
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils27.AST_NODE_TYPES.SpreadElement) {
|
|
2541
2580
|
return;
|
|
2542
2581
|
}
|
|
2543
2582
|
const firstArgumentValue = getStringValue(firstArgument);
|
|
@@ -2570,14 +2609,15 @@ var rule35 = createRule({
|
|
|
2570
2609
|
var no_electron_untrusted_open_external_default = rule35;
|
|
2571
2610
|
|
|
2572
2611
|
// dist/rules/no-electron-webview-allowpopups.js
|
|
2612
|
+
var import_utils28 = require("@typescript-eslint/utils");
|
|
2573
2613
|
var isJsxWebviewElement = (node) => {
|
|
2574
|
-
if (node.name.type ===
|
|
2614
|
+
if (node.name.type === import_utils28.AST_NODE_TYPES.JSXIdentifier) {
|
|
2575
2615
|
return node.name.name.toLowerCase() === "webview";
|
|
2576
2616
|
}
|
|
2577
2617
|
return false;
|
|
2578
2618
|
};
|
|
2579
2619
|
var getJsxAttributeName = (attributeNode) => {
|
|
2580
|
-
if (attributeNode.name.type !==
|
|
2620
|
+
if (attributeNode.name.type !== import_utils28.AST_NODE_TYPES.JSXIdentifier) {
|
|
2581
2621
|
return void 0;
|
|
2582
2622
|
}
|
|
2583
2623
|
return attributeNode.name.name.toLowerCase();
|
|
@@ -2586,7 +2626,7 @@ var isTruthyJsxAttributeValue = (attributeValue) => {
|
|
|
2586
2626
|
if (attributeValue === null) {
|
|
2587
2627
|
return true;
|
|
2588
2628
|
}
|
|
2589
|
-
if (attributeValue.type ===
|
|
2629
|
+
if (attributeValue.type === import_utils28.AST_NODE_TYPES.Literal) {
|
|
2590
2630
|
if (typeof attributeValue.value === "boolean") {
|
|
2591
2631
|
return attributeValue.value;
|
|
2592
2632
|
}
|
|
@@ -2595,10 +2635,10 @@ var isTruthyJsxAttributeValue = (attributeValue) => {
|
|
|
2595
2635
|
}
|
|
2596
2636
|
return false;
|
|
2597
2637
|
}
|
|
2598
|
-
if (attributeValue.type !==
|
|
2638
|
+
if (attributeValue.type !== import_utils28.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
2599
2639
|
return false;
|
|
2600
2640
|
}
|
|
2601
|
-
if (attributeValue.expression.type ===
|
|
2641
|
+
if (attributeValue.expression.type === import_utils28.AST_NODE_TYPES.Literal && typeof attributeValue.expression.value === "boolean") {
|
|
2602
2642
|
return attributeValue.expression.value;
|
|
2603
2643
|
}
|
|
2604
2644
|
return true;
|
|
@@ -2611,7 +2651,7 @@ var rule36 = createRule({
|
|
|
2611
2651
|
return;
|
|
2612
2652
|
}
|
|
2613
2653
|
for (const attributeNode of node.attributes) {
|
|
2614
|
-
if (attributeNode.type !==
|
|
2654
|
+
if (attributeNode.type !== import_utils28.AST_NODE_TYPES.JSXAttribute) {
|
|
2615
2655
|
continue;
|
|
2616
2656
|
}
|
|
2617
2657
|
if (getJsxAttributeName(attributeNode) !== "allowpopups") {
|
|
@@ -2651,32 +2691,33 @@ var rule36 = createRule({
|
|
|
2651
2691
|
var no_electron_webview_allowpopups_default = rule36;
|
|
2652
2692
|
|
|
2653
2693
|
// dist/rules/no-electron-webview-insecure-webpreferences.js
|
|
2694
|
+
var import_utils29 = require("@typescript-eslint/utils");
|
|
2654
2695
|
var import_ts_extras19 = require("ts-extras");
|
|
2655
2696
|
var UNSAFE_WEBPREFERENCES_PATTERNS = [
|
|
2656
2697
|
{
|
|
2657
2698
|
flagName: "allowRunningInsecureContent",
|
|
2658
|
-
pattern: /\ballowrunninginsecurecontent\s*=\s*(?:1|on|true|yes)\b/
|
|
2699
|
+
pattern: /\ballowrunninginsecurecontent\s*=\s*(?:1|on|true|yes)\b/iv
|
|
2659
2700
|
},
|
|
2660
2701
|
{
|
|
2661
2702
|
flagName: "contextIsolation",
|
|
2662
|
-
pattern: /\bcontextisolation\s*=\s*(?:0|false|no|off)\b/
|
|
2703
|
+
pattern: /\bcontextisolation\s*=\s*(?:0|false|no|off)\b/iv
|
|
2663
2704
|
},
|
|
2664
2705
|
{
|
|
2665
2706
|
flagName: "experimentalFeatures",
|
|
2666
|
-
pattern: /\bexperimentalfeatures\s*=\s*(?:1|on|true|yes)\b/
|
|
2707
|
+
pattern: /\bexperimentalfeatures\s*=\s*(?:1|on|true|yes)\b/iv
|
|
2667
2708
|
},
|
|
2668
2709
|
{
|
|
2669
2710
|
flagName: "sandbox",
|
|
2670
|
-
pattern: /\bsandbox\s*=\s*(?:0|false|no|off)\b/
|
|
2711
|
+
pattern: /\bsandbox\s*=\s*(?:0|false|no|off)\b/iv
|
|
2671
2712
|
},
|
|
2672
2713
|
{
|
|
2673
2714
|
flagName: "webSecurity",
|
|
2674
|
-
pattern: /\bwebsecurity\s*=\s*(?:0|false|no|off)\b/
|
|
2715
|
+
pattern: /\bwebsecurity\s*=\s*(?:0|false|no|off)\b/iv
|
|
2675
2716
|
}
|
|
2676
2717
|
];
|
|
2677
|
-
var isJsxWebviewElement2 = (node) => node.name.type ===
|
|
2718
|
+
var isJsxWebviewElement2 = (node) => node.name.type === import_utils29.AST_NODE_TYPES.JSXIdentifier && node.name.name.toLowerCase() === "webview";
|
|
2678
2719
|
var getJsxAttributeName2 = (attributeNode) => {
|
|
2679
|
-
if (attributeNode.name.type ===
|
|
2720
|
+
if (attributeNode.name.type === import_utils29.AST_NODE_TYPES.JSXIdentifier) {
|
|
2680
2721
|
return attributeNode.name.name.toLowerCase();
|
|
2681
2722
|
}
|
|
2682
2723
|
return `${attributeNode.name.namespace.name}:${attributeNode.name.name.name}`.toLowerCase();
|
|
@@ -2690,7 +2731,7 @@ var rule37 = createRule({
|
|
|
2690
2731
|
return;
|
|
2691
2732
|
}
|
|
2692
2733
|
for (const attributeNode of node.attributes) {
|
|
2693
|
-
if (attributeNode.type !==
|
|
2734
|
+
if (attributeNode.type !== import_utils29.AST_NODE_TYPES.JSXAttribute) {
|
|
2694
2735
|
continue;
|
|
2695
2736
|
}
|
|
2696
2737
|
if (getJsxAttributeName2(attributeNode) !== "webpreferences") {
|
|
@@ -2734,9 +2775,10 @@ var rule37 = createRule({
|
|
|
2734
2775
|
var no_electron_webview_insecure_webpreferences_default = rule37;
|
|
2735
2776
|
|
|
2736
2777
|
// dist/rules/no-electron-webview-node-integration.js
|
|
2737
|
-
var
|
|
2778
|
+
var import_utils30 = require("@typescript-eslint/utils");
|
|
2779
|
+
var isJsxWebviewElement3 = (node) => node.name.type === import_utils30.AST_NODE_TYPES.JSXIdentifier && node.name.name.toLowerCase() === "webview";
|
|
2738
2780
|
var getJsxAttributeName3 = (attributeNode) => {
|
|
2739
|
-
if (attributeNode.name.type ===
|
|
2781
|
+
if (attributeNode.name.type === import_utils30.AST_NODE_TYPES.JSXIdentifier) {
|
|
2740
2782
|
return attributeNode.name.name.toLowerCase();
|
|
2741
2783
|
}
|
|
2742
2784
|
return `${attributeNode.name.namespace.name}:${attributeNode.name.name.name}`.toLowerCase();
|
|
@@ -2749,7 +2791,7 @@ var isTruthyJsxAttributeValue2 = (attributeValue) => {
|
|
|
2749
2791
|
if (attributeValue === null) {
|
|
2750
2792
|
return true;
|
|
2751
2793
|
}
|
|
2752
|
-
if (attributeValue.type ===
|
|
2794
|
+
if (attributeValue.type === import_utils30.AST_NODE_TYPES.Literal) {
|
|
2753
2795
|
if (typeof attributeValue.value === "boolean") {
|
|
2754
2796
|
return attributeValue.value;
|
|
2755
2797
|
}
|
|
@@ -2758,10 +2800,10 @@ var isTruthyJsxAttributeValue2 = (attributeValue) => {
|
|
|
2758
2800
|
}
|
|
2759
2801
|
return false;
|
|
2760
2802
|
}
|
|
2761
|
-
if (attributeValue.type !==
|
|
2803
|
+
if (attributeValue.type !== import_utils30.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
2762
2804
|
return false;
|
|
2763
2805
|
}
|
|
2764
|
-
if (attributeValue.expression.type ===
|
|
2806
|
+
if (attributeValue.expression.type === import_utils30.AST_NODE_TYPES.Literal && typeof attributeValue.expression.value === "boolean") {
|
|
2765
2807
|
return attributeValue.expression.value;
|
|
2766
2808
|
}
|
|
2767
2809
|
return true;
|
|
@@ -2770,8 +2812,8 @@ var webPreferencesHasNodeIntegration = (attributeValue) => {
|
|
|
2770
2812
|
if (attributeValue === null) {
|
|
2771
2813
|
return false;
|
|
2772
2814
|
}
|
|
2773
|
-
if (attributeValue.type ===
|
|
2774
|
-
return /\bnodeintegration\b/
|
|
2815
|
+
if (attributeValue.type === import_utils30.AST_NODE_TYPES.Literal && typeof attributeValue.value === "string") {
|
|
2816
|
+
return /\bnodeintegration\b/iv.test(attributeValue.value);
|
|
2775
2817
|
}
|
|
2776
2818
|
return false;
|
|
2777
2819
|
};
|
|
@@ -2783,7 +2825,7 @@ var rule38 = createRule({
|
|
|
2783
2825
|
return;
|
|
2784
2826
|
}
|
|
2785
2827
|
for (const attributeNode of node.attributes) {
|
|
2786
|
-
if (attributeNode.type !==
|
|
2828
|
+
if (attributeNode.type !== import_utils30.AST_NODE_TYPES.JSXAttribute) {
|
|
2787
2829
|
continue;
|
|
2788
2830
|
}
|
|
2789
2831
|
const attributeName = getJsxAttributeName3(attributeNode);
|
|
@@ -2834,16 +2876,17 @@ var rule38 = createRule({
|
|
|
2834
2876
|
var no_electron_webview_node_integration_default = rule38;
|
|
2835
2877
|
|
|
2836
2878
|
// dist/rules/no-html-method.js
|
|
2879
|
+
var import_utils31 = require("@typescript-eslint/utils");
|
|
2837
2880
|
var rule39 = createRule({
|
|
2838
2881
|
create(context) {
|
|
2839
2882
|
return {
|
|
2840
2883
|
"CallExpression[arguments.length=1] > MemberExpression.callee[property.name='html']"(node) {
|
|
2841
2884
|
const parentCall = node.parent;
|
|
2842
|
-
if (parentCall.type !==
|
|
2885
|
+
if (parentCall.type !== import_utils31.AST_NODE_TYPES.CallExpression) {
|
|
2843
2886
|
return;
|
|
2844
2887
|
}
|
|
2845
2888
|
const [firstArgument] = parentCall.arguments;
|
|
2846
|
-
if (firstArgument?.type ===
|
|
2889
|
+
if (firstArgument?.type === import_utils31.AST_NODE_TYPES.Literal && (firstArgument.value === "" || firstArgument.value === null)) {
|
|
2847
2890
|
return;
|
|
2848
2891
|
}
|
|
2849
2892
|
context.report({
|
|
@@ -2872,38 +2915,39 @@ var rule39 = createRule({
|
|
|
2872
2915
|
var no_html_method_default = rule39;
|
|
2873
2916
|
|
|
2874
2917
|
// dist/rules/no-http-request-to-insecure-protocol.js
|
|
2918
|
+
var import_utils32 = require("@typescript-eslint/utils");
|
|
2875
2919
|
var import_ts_extras20 = require("ts-extras");
|
|
2876
2920
|
var getMemberPropertyName11 = (memberExpression) => {
|
|
2877
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2921
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils32.AST_NODE_TYPES.Identifier) {
|
|
2878
2922
|
return memberExpression.property.name;
|
|
2879
2923
|
}
|
|
2880
|
-
if (memberExpression.property.type ===
|
|
2924
|
+
if (memberExpression.property.type === import_utils32.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2881
2925
|
return memberExpression.property.value;
|
|
2882
2926
|
}
|
|
2883
2927
|
return void 0;
|
|
2884
2928
|
};
|
|
2885
2929
|
var getStaticStringValue4 = (node) => {
|
|
2886
|
-
if (node.type ===
|
|
2930
|
+
if (node.type === import_utils32.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
2887
2931
|
return node.value;
|
|
2888
2932
|
}
|
|
2889
|
-
if (node.type ===
|
|
2933
|
+
if (node.type === import_utils32.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
2890
2934
|
return (0, import_ts_extras20.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
2891
2935
|
}
|
|
2892
2936
|
return void 0;
|
|
2893
2937
|
};
|
|
2894
|
-
var isInsecureHttpUrl = (value) => /^http:\/\//
|
|
2938
|
+
var isInsecureHttpUrl = (value) => /^http:\/\//iv.test(value.trim());
|
|
2895
2939
|
var isTargetRequestMethod = (node) => {
|
|
2896
|
-
if (node.callee.type ===
|
|
2940
|
+
if (node.callee.type === import_utils32.AST_NODE_TYPES.Identifier) {
|
|
2897
2941
|
return node.callee.name === "fetch";
|
|
2898
2942
|
}
|
|
2899
|
-
if (node.callee.type !==
|
|
2943
|
+
if (node.callee.type !== import_utils32.AST_NODE_TYPES.MemberExpression) {
|
|
2900
2944
|
return false;
|
|
2901
2945
|
}
|
|
2902
2946
|
const methodName = getMemberPropertyName11(node.callee);
|
|
2903
2947
|
if (methodName !== "request" && methodName !== "get") {
|
|
2904
2948
|
return false;
|
|
2905
2949
|
}
|
|
2906
|
-
if (node.callee.object.type !==
|
|
2950
|
+
if (node.callee.object.type !== import_utils32.AST_NODE_TYPES.Identifier) {
|
|
2907
2951
|
return false;
|
|
2908
2952
|
}
|
|
2909
2953
|
return node.callee.object.name === "http" || node.callee.object.name === "https";
|
|
@@ -2916,7 +2960,7 @@ var rule40 = createRule({
|
|
|
2916
2960
|
return;
|
|
2917
2961
|
}
|
|
2918
2962
|
const [firstArgument] = node.arguments;
|
|
2919
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2963
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils32.AST_NODE_TYPES.SpreadElement) {
|
|
2920
2964
|
return;
|
|
2921
2965
|
}
|
|
2922
2966
|
const firstArgumentValue = getStaticStringValue4(firstArgument);
|
|
@@ -2926,7 +2970,7 @@ var rule40 = createRule({
|
|
|
2926
2970
|
context.report({
|
|
2927
2971
|
fix(fixer) {
|
|
2928
2972
|
const sourceText = context.sourceCode.getText(firstArgument);
|
|
2929
|
-
const fixedSourceText = sourceText.replace(/^(?<quote>["'`]?)http:\/\//
|
|
2973
|
+
const fixedSourceText = sourceText.replace(/^(?<quote>["'`]?)http:\/\//iv, "$<quote>https://");
|
|
2930
2974
|
if (fixedSourceText === sourceText) {
|
|
2931
2975
|
return null;
|
|
2932
2976
|
}
|
|
@@ -2958,27 +3002,28 @@ var rule40 = createRule({
|
|
|
2958
3002
|
var no_http_request_to_insecure_protocol_default = rule40;
|
|
2959
3003
|
|
|
2960
3004
|
// dist/rules/no-iframe-srcdoc.js
|
|
3005
|
+
var import_utils33 = require("@typescript-eslint/utils");
|
|
2961
3006
|
var isJsxIframeElement = (node) => {
|
|
2962
|
-
if (node.name.type !==
|
|
3007
|
+
if (node.name.type !== import_utils33.AST_NODE_TYPES.JSXIdentifier) {
|
|
2963
3008
|
return false;
|
|
2964
3009
|
}
|
|
2965
3010
|
return node.name.name.toLowerCase() === "iframe";
|
|
2966
3011
|
};
|
|
2967
3012
|
var getJsxAttributeName4 = (attributeNode) => {
|
|
2968
|
-
if (attributeNode.name.type !==
|
|
3013
|
+
if (attributeNode.name.type !== import_utils33.AST_NODE_TYPES.JSXIdentifier) {
|
|
2969
3014
|
return void 0;
|
|
2970
3015
|
}
|
|
2971
3016
|
return attributeNode.name.name.toLowerCase();
|
|
2972
3017
|
};
|
|
2973
3018
|
var isCreateElementIFrameCall = (node) => {
|
|
2974
|
-
if (node.type !==
|
|
3019
|
+
if (node.type !== import_utils33.AST_NODE_TYPES.CallExpression || node.callee.type !== import_utils33.AST_NODE_TYPES.MemberExpression) {
|
|
2975
3020
|
return false;
|
|
2976
3021
|
}
|
|
2977
3022
|
if (getMemberPropertyName3(node.callee) !== "createElement") {
|
|
2978
3023
|
return false;
|
|
2979
3024
|
}
|
|
2980
3025
|
const [firstArgument] = node.arguments;
|
|
2981
|
-
return firstArgument !== void 0 && firstArgument.type !==
|
|
3026
|
+
return firstArgument !== void 0 && firstArgument.type !== import_utils33.AST_NODE_TYPES.SpreadElement && getStaticStringValue(firstArgument) === "iframe";
|
|
2982
3027
|
};
|
|
2983
3028
|
var isLikelyIFrameElement = (node, context, fullTypeChecker) => {
|
|
2984
3029
|
if (fullTypeChecker !== void 0) {
|
|
@@ -2990,11 +3035,11 @@ var isLikelyIFrameElement = (node, context, fullTypeChecker) => {
|
|
|
2990
3035
|
if (isCreateElementIFrameCall(node)) {
|
|
2991
3036
|
return true;
|
|
2992
3037
|
}
|
|
2993
|
-
if (node.type ===
|
|
3038
|
+
if (node.type === import_utils33.AST_NODE_TYPES.Identifier) {
|
|
2994
3039
|
const normalizedName = node.name.toLowerCase();
|
|
2995
3040
|
return normalizedName === "frame" || normalizedName.endsWith("iframe");
|
|
2996
3041
|
}
|
|
2997
|
-
if (node.type !==
|
|
3042
|
+
if (node.type !== import_utils33.AST_NODE_TYPES.MemberExpression) {
|
|
2998
3043
|
return false;
|
|
2999
3044
|
}
|
|
3000
3045
|
const propertyName = getMemberPropertyName3(node);
|
|
@@ -3008,7 +3053,7 @@ var rule41 = createRule({
|
|
|
3008
3053
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
3009
3054
|
return {
|
|
3010
3055
|
AssignmentExpression(node) {
|
|
3011
|
-
if (node.left.type !==
|
|
3056
|
+
if (node.left.type !== import_utils33.AST_NODE_TYPES.MemberExpression) {
|
|
3012
3057
|
return;
|
|
3013
3058
|
}
|
|
3014
3059
|
if (getMemberPropertyName3(node.left) !== "srcdoc") {
|
|
@@ -3026,7 +3071,7 @@ var rule41 = createRule({
|
|
|
3026
3071
|
});
|
|
3027
3072
|
},
|
|
3028
3073
|
CallExpression(node) {
|
|
3029
|
-
if (node.callee.type !==
|
|
3074
|
+
if (node.callee.type !== import_utils33.AST_NODE_TYPES.MemberExpression) {
|
|
3030
3075
|
return;
|
|
3031
3076
|
}
|
|
3032
3077
|
const methodName = getMemberPropertyName3(node.callee);
|
|
@@ -3034,10 +3079,10 @@ var rule41 = createRule({
|
|
|
3034
3079
|
return;
|
|
3035
3080
|
}
|
|
3036
3081
|
const [firstArgument, secondArgument] = node.arguments;
|
|
3037
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
3082
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils33.AST_NODE_TYPES.SpreadElement || getStaticStringValue(firstArgument) !== "srcdoc") {
|
|
3038
3083
|
return;
|
|
3039
3084
|
}
|
|
3040
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
3085
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils33.AST_NODE_TYPES.SpreadElement || getStaticStringValue(secondArgument) === "") {
|
|
3041
3086
|
return;
|
|
3042
3087
|
}
|
|
3043
3088
|
if (!isLikelyIFrameElement(node.callee.object, context, fullTypeChecker)) {
|
|
@@ -3053,7 +3098,7 @@ var rule41 = createRule({
|
|
|
3053
3098
|
return;
|
|
3054
3099
|
}
|
|
3055
3100
|
for (const attributeNode of node.attributes) {
|
|
3056
|
-
if (attributeNode.type !==
|
|
3101
|
+
if (attributeNode.type !== import_utils33.AST_NODE_TYPES.JSXAttribute) {
|
|
3057
3102
|
continue;
|
|
3058
3103
|
}
|
|
3059
3104
|
if (getJsxAttributeName4(attributeNode) !== "srcdoc") {
|
|
@@ -3089,20 +3134,21 @@ var rule41 = createRule({
|
|
|
3089
3134
|
var no_iframe_srcdoc_default = rule41;
|
|
3090
3135
|
|
|
3091
3136
|
// dist/rules/no-inner-html.js
|
|
3092
|
-
var
|
|
3137
|
+
var import_utils34 = require("@typescript-eslint/utils");
|
|
3138
|
+
var isEmptyStringLiteral = (node) => node.type === import_utils34.AST_NODE_TYPES.Literal && node.value === "";
|
|
3093
3139
|
var rule42 = createRule({
|
|
3094
3140
|
create(context) {
|
|
3095
3141
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
3096
3142
|
const mightBeHTMLElement = (node) => {
|
|
3097
3143
|
const nodeType = getNodeTypeAsString(fullTypeChecker, node, context);
|
|
3098
|
-
return /HTML.*Element/
|
|
3144
|
+
return /HTML.*Element/v.test(nodeType) || nodeType === "any";
|
|
3099
3145
|
};
|
|
3100
3146
|
return {
|
|
3101
3147
|
"AssignmentExpression[left.type='MemberExpression'][left.property.name=/^(?:innerHTML|outerHTML)$/]"(node) {
|
|
3102
3148
|
if (isEmptyStringLiteral(node.right)) {
|
|
3103
3149
|
return;
|
|
3104
3150
|
}
|
|
3105
|
-
if (node.left.type !==
|
|
3151
|
+
if (node.left.type !== import_utils34.AST_NODE_TYPES.MemberExpression) {
|
|
3106
3152
|
return;
|
|
3107
3153
|
}
|
|
3108
3154
|
if (!mightBeHTMLElement(node.left.object)) {
|
|
@@ -3114,7 +3160,7 @@ var rule42 = createRule({
|
|
|
3114
3160
|
});
|
|
3115
3161
|
},
|
|
3116
3162
|
"CallExpression[arguments.length=2] > MemberExpression.callee[property.name='insertAdjacentHTML']"(node) {
|
|
3117
|
-
if (node.parent.type !==
|
|
3163
|
+
if (node.parent.type !== import_utils34.AST_NODE_TYPES.CallExpression) {
|
|
3118
3164
|
return;
|
|
3119
3165
|
}
|
|
3120
3166
|
const secondArgument = node.parent.arguments[1];
|
|
@@ -3151,23 +3197,25 @@ var rule42 = createRule({
|
|
|
3151
3197
|
var no_inner_html_default = rule42;
|
|
3152
3198
|
|
|
3153
3199
|
// dist/rules/no-insecure-random.js
|
|
3154
|
-
var
|
|
3200
|
+
var import_utils35 = require("@typescript-eslint/utils");
|
|
3201
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
3155
3202
|
var import_ts_extras21 = require("ts-extras");
|
|
3156
3203
|
var bannedRandomLibraries = [
|
|
3157
3204
|
"chance",
|
|
3158
|
-
"random-number",
|
|
3159
|
-
"random-int",
|
|
3160
3205
|
"random-float",
|
|
3206
|
+
"random-int",
|
|
3207
|
+
"random-number",
|
|
3161
3208
|
"random-seed",
|
|
3162
3209
|
"unique-random"
|
|
3163
3210
|
];
|
|
3164
|
-
var
|
|
3211
|
+
var bannedRandomLibrarySet = new Set(bannedRandomLibraries);
|
|
3212
|
+
var isBannedRandomLibrary = (value) => (0, import_ts_extras21.setHas)(bannedRandomLibrarySet, value);
|
|
3165
3213
|
var rule43 = createRule({
|
|
3166
3214
|
create(context) {
|
|
3167
3215
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
3168
3216
|
return {
|
|
3169
3217
|
"CallExpression > MemberExpression[property.name='pseudoRandomBytes']"(node) {
|
|
3170
|
-
const isUnsafe = (0, import_ts_extras21.isDefined)(fullTypeChecker) ? (0, import_ts_extras21.arrayIncludes)(["any", "Crypto"], getNodeTypeAsString(fullTypeChecker, node.object, context)) : node.object.type ===
|
|
3218
|
+
const isUnsafe = (0, import_ts_extras21.isDefined)(fullTypeChecker) ? (0, import_ts_extras21.arrayIncludes)(["any", "Crypto"], getNodeTypeAsString(fullTypeChecker, node.object, context)) : node.object.type === import_utils35.AST_NODE_TYPES.Identifier && node.object.name === "crypto";
|
|
3171
3219
|
if (!isUnsafe) {
|
|
3172
3220
|
return;
|
|
3173
3221
|
}
|
|
@@ -3177,7 +3225,7 @@ var rule43 = createRule({
|
|
|
3177
3225
|
});
|
|
3178
3226
|
},
|
|
3179
3227
|
"CallExpression > MemberExpression[property.name='random']"(node) {
|
|
3180
|
-
const isUnsafe = (0, import_ts_extras21.isDefined)(fullTypeChecker) ? (0, import_ts_extras21.arrayIncludes)(["any", "Math"], getNodeTypeAsString(fullTypeChecker, node.object, context)) : node.object.type ===
|
|
3228
|
+
const isUnsafe = (0, import_ts_extras21.isDefined)(fullTypeChecker) ? (0, import_ts_extras21.arrayIncludes)(["any", "Math"], getNodeTypeAsString(fullTypeChecker, node.object, context)) : node.object.type === import_utils35.AST_NODE_TYPES.Identifier && node.object.name === "Math";
|
|
3181
3229
|
if (!isUnsafe) {
|
|
3182
3230
|
return;
|
|
3183
3231
|
}
|
|
@@ -3188,10 +3236,10 @@ var rule43 = createRule({
|
|
|
3188
3236
|
},
|
|
3189
3237
|
"CallExpression[callee.name='require'][arguments.length=1]"(node) {
|
|
3190
3238
|
const [sourceArgument] = node.arguments;
|
|
3191
|
-
if (!(0, import_ts_extras21.isDefined)(sourceArgument) || sourceArgument.type !==
|
|
3239
|
+
if (!(0, import_ts_extras21.isDefined)(sourceArgument) || sourceArgument.type !== import_utils35.AST_NODE_TYPES.Literal || typeof sourceArgument.value !== "string") {
|
|
3192
3240
|
return;
|
|
3193
3241
|
}
|
|
3194
|
-
const requireName =
|
|
3242
|
+
const requireName = import_node_path.default.parse(import_node_path.default.basename(sourceArgument.value)).name;
|
|
3195
3243
|
if (!isBannedRandomLibrary(requireName)) {
|
|
3196
3244
|
return;
|
|
3197
3245
|
}
|
|
@@ -3205,7 +3253,7 @@ var rule43 = createRule({
|
|
|
3205
3253
|
if (typeof sourceText !== "string") {
|
|
3206
3254
|
return;
|
|
3207
3255
|
}
|
|
3208
|
-
if (!isBannedRandomLibrary(
|
|
3256
|
+
if (!isBannedRandomLibrary(import_node_path.default.basename(sourceText))) {
|
|
3209
3257
|
return;
|
|
3210
3258
|
}
|
|
3211
3259
|
context.report({
|
|
@@ -3234,22 +3282,20 @@ var rule43 = createRule({
|
|
|
3234
3282
|
var no_insecure_random_default = rule43;
|
|
3235
3283
|
|
|
3236
3284
|
// dist/rules/no-insecure-tls-agent-options.js
|
|
3237
|
-
var
|
|
3285
|
+
var import_utils36 = require("@typescript-eslint/utils");
|
|
3286
|
+
var isFalseLiteral = (node) => node.type === import_utils36.AST_NODE_TYPES.Literal && node.value === false;
|
|
3238
3287
|
var getObjectPropertyName = (propertyNode) => {
|
|
3239
3288
|
if (propertyNode.computed) {
|
|
3240
3289
|
return void 0;
|
|
3241
3290
|
}
|
|
3242
|
-
if (propertyNode.key.type ===
|
|
3291
|
+
if (propertyNode.key.type === import_utils36.AST_NODE_TYPES.Identifier) {
|
|
3243
3292
|
return propertyNode.key.name;
|
|
3244
3293
|
}
|
|
3245
|
-
|
|
3246
|
-
return propertyNode.key.value;
|
|
3247
|
-
}
|
|
3248
|
-
return void 0;
|
|
3294
|
+
return typeof propertyNode.key.value === "string" ? propertyNode.key.value : void 0;
|
|
3249
3295
|
};
|
|
3250
3296
|
var findRejectUnauthorizedFalseProperty = (objectExpression) => {
|
|
3251
3297
|
for (const propertyNode of objectExpression.properties) {
|
|
3252
|
-
if (propertyNode.type !==
|
|
3298
|
+
if (propertyNode.type !== import_utils36.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
3253
3299
|
continue;
|
|
3254
3300
|
}
|
|
3255
3301
|
if (getObjectPropertyName(propertyNode) !== "rejectUnauthorized") {
|
|
@@ -3271,7 +3317,7 @@ var rule44 = createRule({
|
|
|
3271
3317
|
}
|
|
3272
3318
|
context.report({
|
|
3273
3319
|
fix(fixer) {
|
|
3274
|
-
if (insecureOptionProperty.value.type !==
|
|
3320
|
+
if (insecureOptionProperty.value.type !== import_utils36.AST_NODE_TYPES.Literal || insecureOptionProperty.value.value !== false) {
|
|
3275
3321
|
return null;
|
|
3276
3322
|
}
|
|
3277
3323
|
return fixer.replaceText(insecureOptionProperty.value, "true");
|
|
@@ -3302,13 +3348,14 @@ var rule44 = createRule({
|
|
|
3302
3348
|
var no_insecure_tls_agent_options_default = rule44;
|
|
3303
3349
|
|
|
3304
3350
|
// dist/rules/no-insecure-url.js
|
|
3305
|
-
var
|
|
3351
|
+
var import_utils37 = require("@typescript-eslint/utils");
|
|
3352
|
+
var defaultBlocklist = [/^(?:ftp|http|telnet|ws):\/\//iv];
|
|
3306
3353
|
var defaultExceptions = [
|
|
3307
|
-
/^http:(?:\/\/|\\u002f\\u002f)schemas\.microsoft\.com.*/
|
|
3308
|
-
/^http:(?:\/\/|\\u002f\\u002f)schemas\.openxmlformats\.org.*/
|
|
3309
|
-
/^http:(?:\/|\\u002f){2}localhost(?::|\/|\\u002f)*/
|
|
3310
|
-
/^http:\/\/w{3}\.w3\.org\/1999\/xhtml/
|
|
3311
|
-
/^http:\/\/w{3}\.w3\.org\/2000\/svg/
|
|
3354
|
+
/^http:(?:\/\/|\\u002f\\u002f)schemas\.microsoft\.com.*/iv,
|
|
3355
|
+
/^http:(?:\/\/|\\u002f\\u002f)schemas\.openxmlformats\.org.*/iv,
|
|
3356
|
+
/^http:(?:\/|\\u002f){2}localhost(?::|\/|\\u002f)*/iv,
|
|
3357
|
+
/^http:\/\/w{3}\.w3\.org\/1999\/xhtml/iv,
|
|
3358
|
+
/^http:\/\/w{3}\.w3\.org\/2000\/svg/iv
|
|
3312
3359
|
];
|
|
3313
3360
|
var defaultVariableExceptions = [];
|
|
3314
3361
|
var asCaseInsensitiveRegex = (pattern) => {
|
|
@@ -3327,10 +3374,10 @@ var shouldAttemptFix = (variableExceptions, context, node) => {
|
|
|
3327
3374
|
var reportInsecureUrl = (context, node, replacementSourceText) => {
|
|
3328
3375
|
context.report({
|
|
3329
3376
|
fix(fixer) {
|
|
3330
|
-
if (!/http:/
|
|
3377
|
+
if (!/http:/iv.test(replacementSourceText)) {
|
|
3331
3378
|
return null;
|
|
3332
3379
|
}
|
|
3333
|
-
return fixer.replaceText(node, replacementSourceText.replace(/http:/
|
|
3380
|
+
return fixer.replaceText(node, replacementSourceText.replace(/http:/iv, "https:"));
|
|
3334
3381
|
},
|
|
3335
3382
|
messageId: "doNotUseInsecureUrl",
|
|
3336
3383
|
node
|
|
@@ -3347,7 +3394,7 @@ var rule45 = createRule({
|
|
|
3347
3394
|
if (typeof node.value !== "string") {
|
|
3348
3395
|
return;
|
|
3349
3396
|
}
|
|
3350
|
-
if (node.parent
|
|
3397
|
+
if (node.parent.type === import_utils37.AST_NODE_TYPES.JSXAttribute && node.parent.name.type === import_utils37.AST_NODE_TYPES.JSXIdentifier && node.parent.name.name === "xmlns") {
|
|
3351
3398
|
return;
|
|
3352
3399
|
}
|
|
3353
3400
|
if (!matches(blocklist, node.value) || matches(exceptions, node.value)) {
|
|
@@ -3421,28 +3468,29 @@ var rule45 = createRule({
|
|
|
3421
3468
|
var no_insecure_url_default = rule45;
|
|
3422
3469
|
|
|
3423
3470
|
// dist/rules/no-location-javascript-url.js
|
|
3471
|
+
var import_utils38 = require("@typescript-eslint/utils");
|
|
3424
3472
|
var import_ts_extras22 = require("ts-extras");
|
|
3425
3473
|
var getMemberPropertyName12 = (memberExpression) => {
|
|
3426
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
3474
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils38.AST_NODE_TYPES.Identifier) {
|
|
3427
3475
|
return memberExpression.property.name;
|
|
3428
3476
|
}
|
|
3429
|
-
if (memberExpression.property.type ===
|
|
3477
|
+
if (memberExpression.property.type === import_utils38.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
3430
3478
|
return memberExpression.property.value;
|
|
3431
3479
|
}
|
|
3432
3480
|
return void 0;
|
|
3433
3481
|
};
|
|
3434
3482
|
var getStaticStringValue5 = (node) => {
|
|
3435
|
-
if (node.type ===
|
|
3483
|
+
if (node.type === import_utils38.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
3436
3484
|
return node.value;
|
|
3437
3485
|
}
|
|
3438
|
-
if (node.type ===
|
|
3486
|
+
if (node.type === import_utils38.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
3439
3487
|
return (0, import_ts_extras22.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
3440
3488
|
}
|
|
3441
3489
|
return void 0;
|
|
3442
3490
|
};
|
|
3443
|
-
var isJavaScriptUrl2 = (value) => /^\s*javascript\s*:/
|
|
3491
|
+
var isJavaScriptUrl2 = (value) => /^\s*javascript\s*:/iv.test(value);
|
|
3444
3492
|
var isLocationLikeLeftHand = (expression) => {
|
|
3445
|
-
if (expression.type !==
|
|
3493
|
+
if (expression.type !== import_utils38.AST_NODE_TYPES.MemberExpression) {
|
|
3446
3494
|
return false;
|
|
3447
3495
|
}
|
|
3448
3496
|
const propertyName = getMemberPropertyName12(expression);
|
|
@@ -3468,7 +3516,7 @@ var rule46 = createRule({
|
|
|
3468
3516
|
});
|
|
3469
3517
|
},
|
|
3470
3518
|
CallExpression(node) {
|
|
3471
|
-
if (node.callee.type !==
|
|
3519
|
+
if (node.callee.type !== import_utils38.AST_NODE_TYPES.MemberExpression) {
|
|
3472
3520
|
return;
|
|
3473
3521
|
}
|
|
3474
3522
|
const methodName = getMemberPropertyName12(node.callee);
|
|
@@ -3476,7 +3524,7 @@ var rule46 = createRule({
|
|
|
3476
3524
|
return;
|
|
3477
3525
|
}
|
|
3478
3526
|
const [firstArgument] = node.arguments;
|
|
3479
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
3527
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils38.AST_NODE_TYPES.SpreadElement) {
|
|
3480
3528
|
return;
|
|
3481
3529
|
}
|
|
3482
3530
|
const argumentValue = getStaticStringValue5(firstArgument);
|
|
@@ -3509,19 +3557,13 @@ var rule46 = createRule({
|
|
|
3509
3557
|
var no_location_javascript_url_default = rule46;
|
|
3510
3558
|
|
|
3511
3559
|
// dist/rules/no-message-event-without-origin-check.js
|
|
3560
|
+
var import_utils39 = require("@typescript-eslint/utils");
|
|
3512
3561
|
var import_ts_extras23 = require("ts-extras");
|
|
3513
|
-
var isFunctionExpression6 = (expression) => expression.type ===
|
|
3514
|
-
var hasMessageEventGuardKeywords = (callbackText) => /\b(?:allowlist|origin|trusted|validate|verify|whitelist)\b/
|
|
3515
|
-
var
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
}
|
|
3519
|
-
const recordValue = value;
|
|
3520
|
-
if (!(0, import_ts_extras23.keyIn)(recordValue, "type") || typeof recordValue["type"] !== "string") {
|
|
3521
|
-
return void 0;
|
|
3522
|
-
}
|
|
3523
|
-
return recordValue;
|
|
3524
|
-
};
|
|
3562
|
+
var isFunctionExpression6 = (expression) => expression.type === import_utils39.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils39.AST_NODE_TYPES.FunctionExpression;
|
|
3563
|
+
var hasMessageEventGuardKeywords = (callbackText) => /\b(?:allowlist|origin|trusted|validate|verify|whitelist)\b/iv.test(callbackText);
|
|
3564
|
+
var isUnknownRecord2 = (value) => typeof value === "object" && value !== null;
|
|
3565
|
+
var isNodeLike = (value) => isUnknownRecord2(value) && (0, import_ts_extras23.keyIn)(value, "type") && typeof value["type"] === "string";
|
|
3566
|
+
var toNode = (value) => isNodeLike(value) ? value : void 0;
|
|
3525
3567
|
var someDescendantNode = (node, predicate) => {
|
|
3526
3568
|
if (predicate(node)) {
|
|
3527
3569
|
return true;
|
|
@@ -3546,26 +3588,26 @@ var someDescendantNode = (node, predicate) => {
|
|
|
3546
3588
|
}
|
|
3547
3589
|
return false;
|
|
3548
3590
|
};
|
|
3549
|
-
var isIdentifierNamed = (node, identifierName) => node.type ===
|
|
3591
|
+
var isIdentifierNamed = (node, identifierName) => node.type === import_utils39.AST_NODE_TYPES.Identifier && node.name === identifierName;
|
|
3550
3592
|
var isStaticPropertyMatch = (memberExpression, objectName, propertyName) => isIdentifierNamed(memberExpression.object, objectName) && getMemberPropertyName3(memberExpression) === propertyName;
|
|
3551
3593
|
var patternContainsProperty = (pattern, propertyName) => pattern.properties.some((propertyNode) => {
|
|
3552
|
-
if (propertyNode.type !==
|
|
3594
|
+
if (propertyNode.type !== import_utils39.AST_NODE_TYPES.Property) {
|
|
3553
3595
|
return false;
|
|
3554
3596
|
}
|
|
3555
3597
|
return getPropertyName(propertyNode) === propertyName;
|
|
3556
3598
|
});
|
|
3557
3599
|
var containsObjectDestructureFromIdentifier = (rootNode, sourceName, propertyName) => someDescendantNode(rootNode, (node) => {
|
|
3558
|
-
if (node.type ===
|
|
3559
|
-
return node.id.type ===
|
|
3600
|
+
if (node.type === import_utils39.AST_NODE_TYPES.VariableDeclarator) {
|
|
3601
|
+
return node.id.type === import_utils39.AST_NODE_TYPES.ObjectPattern && node.init !== null && isIdentifierNamed(node.init, sourceName) && patternContainsProperty(node.id, propertyName);
|
|
3560
3602
|
}
|
|
3561
|
-
if (node.type !==
|
|
3603
|
+
if (node.type !== import_utils39.AST_NODE_TYPES.AssignmentExpression) {
|
|
3562
3604
|
return false;
|
|
3563
3605
|
}
|
|
3564
|
-
return node.left.type ===
|
|
3606
|
+
return node.left.type === import_utils39.AST_NODE_TYPES.ObjectPattern && isIdentifierNamed(node.right, sourceName) && patternContainsProperty(node.left, propertyName);
|
|
3565
3607
|
});
|
|
3566
|
-
var containsMemberPropertyAccess = (rootNode, objectName, propertyName) => someDescendantNode(rootNode, (node) => node.type ===
|
|
3608
|
+
var containsMemberPropertyAccess = (rootNode, objectName, propertyName) => someDescendantNode(rootNode, (node) => node.type === import_utils39.AST_NODE_TYPES.MemberExpression ? isStaticPropertyMatch(node, objectName, propertyName) : false);
|
|
3567
3609
|
var hasObjectPatternProperty = (objectPattern, propertyName) => objectPattern.properties.some((propertyNode) => {
|
|
3568
|
-
if (propertyNode.type !==
|
|
3610
|
+
if (propertyNode.type !== import_utils39.AST_NODE_TYPES.Property) {
|
|
3569
3611
|
return false;
|
|
3570
3612
|
}
|
|
3571
3613
|
return getPropertyName(propertyNode) === propertyName;
|
|
@@ -3587,28 +3629,28 @@ var reportsObjectPatternCallback = (callbackNode, context, eventParameter) => {
|
|
|
3587
3629
|
};
|
|
3588
3630
|
var shouldReportMessageEventCallback = (callbackNode, context) => {
|
|
3589
3631
|
const [firstParameter] = callbackNode.params;
|
|
3590
|
-
if (firstParameter === void 0 || firstParameter.type ===
|
|
3632
|
+
if (firstParameter === void 0 || firstParameter.type === import_utils39.AST_NODE_TYPES.RestElement) {
|
|
3591
3633
|
return false;
|
|
3592
3634
|
}
|
|
3593
|
-
if (firstParameter.type ===
|
|
3635
|
+
if (firstParameter.type === import_utils39.AST_NODE_TYPES.Identifier) {
|
|
3594
3636
|
return reportsIdentifierCallback(callbackNode, context, firstParameter);
|
|
3595
3637
|
}
|
|
3596
|
-
if (firstParameter.type ===
|
|
3638
|
+
if (firstParameter.type === import_utils39.AST_NODE_TYPES.ObjectPattern) {
|
|
3597
3639
|
return reportsObjectPatternCallback(callbackNode, context, firstParameter);
|
|
3598
3640
|
}
|
|
3599
3641
|
return false;
|
|
3600
3642
|
};
|
|
3601
3643
|
var isMessageEventListenerCall = (node) => {
|
|
3602
|
-
if (node.callee.type !==
|
|
3644
|
+
if (node.callee.type !== import_utils39.AST_NODE_TYPES.MemberExpression) {
|
|
3603
3645
|
return false;
|
|
3604
3646
|
}
|
|
3605
3647
|
if (getMemberPropertyName3(node.callee) !== "addEventListener") {
|
|
3606
3648
|
return false;
|
|
3607
3649
|
}
|
|
3608
3650
|
const [firstArgument] = node.arguments;
|
|
3609
|
-
return firstArgument !== void 0 && firstArgument.type !==
|
|
3651
|
+
return firstArgument !== void 0 && firstArgument.type !== import_utils39.AST_NODE_TYPES.SpreadElement && getStaticStringValue(firstArgument) === "message";
|
|
3610
3652
|
};
|
|
3611
|
-
var isOnMessageAssignment = (node) => node.operator === "=" && node.left.type ===
|
|
3653
|
+
var isOnMessageAssignment = (node) => node.operator === "=" && node.left.type === import_utils39.AST_NODE_TYPES.MemberExpression && getMemberPropertyName3(node.left) === "onmessage";
|
|
3612
3654
|
var rule47 = createRule({
|
|
3613
3655
|
create(context) {
|
|
3614
3656
|
return {
|
|
@@ -3632,7 +3674,7 @@ var rule47 = createRule({
|
|
|
3632
3674
|
return;
|
|
3633
3675
|
}
|
|
3634
3676
|
const [, secondArgument] = node.arguments;
|
|
3635
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
3677
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils39.AST_NODE_TYPES.SpreadElement) {
|
|
3636
3678
|
return;
|
|
3637
3679
|
}
|
|
3638
3680
|
if (!isFunctionExpression6(secondArgument)) {
|
|
@@ -3697,9 +3739,11 @@ var rule48 = createRule({
|
|
|
3697
3739
|
var no_msapp_exec_unsafe_default = rule48;
|
|
3698
3740
|
|
|
3699
3741
|
// dist/rules/no-node-tls-check-server-identity-bypass.js
|
|
3742
|
+
var import_utils41 = require("@typescript-eslint/utils");
|
|
3700
3743
|
var import_ts_extras25 = require("ts-extras");
|
|
3701
3744
|
|
|
3702
3745
|
// dist/_internal/node-tls-config.js
|
|
3746
|
+
var import_utils40 = require("@typescript-eslint/utils");
|
|
3703
3747
|
var import_ts_extras24 = require("ts-extras");
|
|
3704
3748
|
var NODE_TLS_OBJECT_NAMES = /* @__PURE__ */ new Set([
|
|
3705
3749
|
"http2",
|
|
@@ -3715,43 +3759,43 @@ var NODE_TLS_CALL_METHOD_NAMES = /* @__PURE__ */ new Set([
|
|
|
3715
3759
|
"request"
|
|
3716
3760
|
]);
|
|
3717
3761
|
var isNodeTlsObjectExpression = (expression) => {
|
|
3718
|
-
if (expression.type ===
|
|
3762
|
+
if (expression.type === import_utils40.AST_NODE_TYPES.Identifier) {
|
|
3719
3763
|
return (0, import_ts_extras24.setHas)(NODE_TLS_OBJECT_NAMES, expression.name);
|
|
3720
3764
|
}
|
|
3721
|
-
if (expression.type !==
|
|
3765
|
+
if (expression.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
3722
3766
|
return false;
|
|
3723
3767
|
}
|
|
3724
3768
|
const propertyName = getMemberPropertyName3(expression);
|
|
3725
3769
|
return (0, import_ts_extras24.isDefined)(propertyName) && (0, import_ts_extras24.setHas)(NODE_TLS_OBJECT_NAMES, propertyName);
|
|
3726
3770
|
};
|
|
3727
3771
|
var isRelevantNodeTlsCall = (callee) => {
|
|
3728
|
-
if (callee.type ===
|
|
3772
|
+
if (callee.type === import_utils40.AST_NODE_TYPES.Identifier) {
|
|
3729
3773
|
return callee.name === "createSecureContext";
|
|
3730
3774
|
}
|
|
3731
|
-
if (callee.type !==
|
|
3775
|
+
if (callee.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
3732
3776
|
return false;
|
|
3733
3777
|
}
|
|
3734
3778
|
const methodName = getMemberPropertyName3(callee);
|
|
3735
3779
|
return (0, import_ts_extras24.isDefined)(methodName) && (0, import_ts_extras24.setHas)(NODE_TLS_CALL_METHOD_NAMES, methodName) && isNodeTlsObjectExpression(callee.object);
|
|
3736
3780
|
};
|
|
3737
3781
|
var isRelevantNodeTlsConstructor = (callee) => {
|
|
3738
|
-
if (callee.type !==
|
|
3782
|
+
if (callee.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
3739
3783
|
return false;
|
|
3740
3784
|
}
|
|
3741
3785
|
return getMemberPropertyName3(callee) === "Agent" && isNodeTlsObjectExpression(callee.object);
|
|
3742
3786
|
};
|
|
3743
3787
|
var isRelevantNodeTlsOptionsObject = (node) => {
|
|
3744
3788
|
const parentNode = node.parent;
|
|
3745
|
-
if (parentNode
|
|
3789
|
+
if (parentNode.type === import_utils40.AST_NODE_TYPES.CallExpression) {
|
|
3746
3790
|
return isRelevantNodeTlsCall(parentNode.callee);
|
|
3747
3791
|
}
|
|
3748
|
-
if (parentNode
|
|
3792
|
+
if (parentNode.type === import_utils40.AST_NODE_TYPES.NewExpression) {
|
|
3749
3793
|
return isRelevantNodeTlsConstructor(parentNode.callee);
|
|
3750
3794
|
}
|
|
3751
3795
|
return false;
|
|
3752
3796
|
};
|
|
3753
3797
|
var isNodeTlsStaticMember = (node, propertyNames) => {
|
|
3754
|
-
if (node.type !==
|
|
3798
|
+
if (node.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
3755
3799
|
return false;
|
|
3756
3800
|
}
|
|
3757
3801
|
const propertyName = getMemberPropertyName3(node);
|
|
@@ -3760,19 +3804,19 @@ var isNodeTlsStaticMember = (node, propertyNames) => {
|
|
|
3760
3804
|
|
|
3761
3805
|
// dist/rules/no-node-tls-check-server-identity-bypass.js
|
|
3762
3806
|
var CHECK_SERVER_IDENTITY_PROPERTY_NAMES = /* @__PURE__ */ new Set(["checkServerIdentity"]);
|
|
3763
|
-
var isFunctionExpression7 = (expression) => expression.type ===
|
|
3764
|
-
var isExpressionNode2 = (node) => node.type !==
|
|
3807
|
+
var isFunctionExpression7 = (expression) => expression.type === import_utils41.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils41.AST_NODE_TYPES.FunctionExpression;
|
|
3808
|
+
var isExpressionNode2 = (node) => node.type !== import_utils41.AST_NODE_TYPES.ArrayPattern && node.type !== import_utils41.AST_NODE_TYPES.AssignmentPattern && node.type !== import_utils41.AST_NODE_TYPES.ObjectPattern;
|
|
3765
3809
|
var isAlwaysSuccessfulReturnExpression = (expression) => {
|
|
3766
|
-
if (expression.type ===
|
|
3810
|
+
if (expression.type === import_utils41.AST_NODE_TYPES.Identifier) {
|
|
3767
3811
|
return expression.name === "undefined";
|
|
3768
3812
|
}
|
|
3769
|
-
if (expression.type ===
|
|
3813
|
+
if (expression.type === import_utils41.AST_NODE_TYPES.Literal) {
|
|
3770
3814
|
return expression.value === null;
|
|
3771
3815
|
}
|
|
3772
|
-
return expression.type ===
|
|
3816
|
+
return expression.type === import_utils41.AST_NODE_TYPES.UnaryExpression && expression.operator === "void";
|
|
3773
3817
|
};
|
|
3774
3818
|
var isAlwaysSuccessfulCheckServerIdentity = (callbackNode) => {
|
|
3775
|
-
if (callbackNode.body.type !==
|
|
3819
|
+
if (callbackNode.body.type !== import_utils41.AST_NODE_TYPES.BlockStatement) {
|
|
3776
3820
|
return isAlwaysSuccessfulReturnExpression(callbackNode.body);
|
|
3777
3821
|
}
|
|
3778
3822
|
if (callbackNode.body.body.length === 0) {
|
|
@@ -3782,10 +3826,10 @@ var isAlwaysSuccessfulCheckServerIdentity = (callbackNode) => {
|
|
|
3782
3826
|
return false;
|
|
3783
3827
|
}
|
|
3784
3828
|
const onlyStatement = (0, import_ts_extras25.arrayFirst)(callbackNode.body.body);
|
|
3785
|
-
if (onlyStatement?.type !==
|
|
3829
|
+
if (onlyStatement?.type !== import_utils41.AST_NODE_TYPES.ReturnStatement) {
|
|
3786
3830
|
return false;
|
|
3787
3831
|
}
|
|
3788
|
-
return onlyStatement.argument === null ||
|
|
3832
|
+
return onlyStatement.argument === null || isAlwaysSuccessfulReturnExpression(onlyStatement.argument);
|
|
3789
3833
|
};
|
|
3790
3834
|
var rule49 = createRule({
|
|
3791
3835
|
create(context) {
|
|
@@ -3804,7 +3848,7 @@ var rule49 = createRule({
|
|
|
3804
3848
|
return;
|
|
3805
3849
|
}
|
|
3806
3850
|
for (const propertyNode of node.properties) {
|
|
3807
|
-
if (propertyNode.type !==
|
|
3851
|
+
if (propertyNode.type !== import_utils41.AST_NODE_TYPES.Property || propertyNode.kind !== "init" || getPropertyName(propertyNode) !== "checkServerIdentity" || !isExpressionNode2(propertyNode.value) || !isFunctionExpression7(propertyNode.value) || !isAlwaysSuccessfulCheckServerIdentity(propertyNode.value)) {
|
|
3808
3852
|
continue;
|
|
3809
3853
|
}
|
|
3810
3854
|
context.report({
|
|
@@ -3834,14 +3878,15 @@ var rule49 = createRule({
|
|
|
3834
3878
|
var no_node_tls_check_server_identity_bypass_default = rule49;
|
|
3835
3879
|
|
|
3836
3880
|
// dist/rules/no-node-tls-legacy-protocol.js
|
|
3881
|
+
var import_utils42 = require("@typescript-eslint/utils");
|
|
3837
3882
|
var import_ts_extras26 = require("ts-extras");
|
|
3838
3883
|
var LEGACY_TLS_VERSION_VALUES = /* @__PURE__ */ new Set([
|
|
3839
3884
|
"TLSv1",
|
|
3840
3885
|
"TLSv1.0",
|
|
3841
3886
|
"TLSv1.1"
|
|
3842
3887
|
]);
|
|
3843
|
-
var isLegacySecureProtocolValue = (value) => /^(?:SSLv2|SSLv3|TLSv1(?:_1)?)(?:_(?:client|server))?_method$/
|
|
3844
|
-
var isExpressionNode3 = (node) => node.type !==
|
|
3888
|
+
var isLegacySecureProtocolValue = (value) => /^(?:SSLv2|SSLv3|TLSv1(?:_1)?)(?:_(?:client|server))?_method$/v.test(value);
|
|
3889
|
+
var isExpressionNode3 = (node) => node.type !== import_utils42.AST_NODE_TYPES.ArrayPattern && node.type !== import_utils42.AST_NODE_TYPES.AssignmentPattern && node.type !== import_utils42.AST_NODE_TYPES.ObjectPattern;
|
|
3845
3890
|
var isLegacyTlsPropertyValue = (propertyName, configuredValue) => {
|
|
3846
3891
|
if (propertyName === "secureProtocol") {
|
|
3847
3892
|
return isLegacySecureProtocolValue(configuredValue);
|
|
@@ -3881,7 +3926,7 @@ var rule50 = createRule({
|
|
|
3881
3926
|
return;
|
|
3882
3927
|
}
|
|
3883
3928
|
for (const propertyNode of node.properties) {
|
|
3884
|
-
if (propertyNode.type !==
|
|
3929
|
+
if (propertyNode.type !== import_utils42.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
3885
3930
|
continue;
|
|
3886
3931
|
}
|
|
3887
3932
|
if (!isExpressionNode3(propertyNode.value)) {
|
|
@@ -3926,27 +3971,28 @@ var rule50 = createRule({
|
|
|
3926
3971
|
var no_node_tls_legacy_protocol_default = rule50;
|
|
3927
3972
|
|
|
3928
3973
|
// dist/rules/no-node-tls-reject-unauthorized-zero.js
|
|
3974
|
+
var import_utils43 = require("@typescript-eslint/utils");
|
|
3929
3975
|
var import_ts_extras27 = require("ts-extras");
|
|
3930
3976
|
var getMemberPropertyName13 = (memberExpression) => {
|
|
3931
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
3977
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils43.AST_NODE_TYPES.Identifier) {
|
|
3932
3978
|
return memberExpression.property.name;
|
|
3933
3979
|
}
|
|
3934
|
-
if (memberExpression.property.type ===
|
|
3980
|
+
if (memberExpression.property.type === import_utils43.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
3935
3981
|
return memberExpression.property.value;
|
|
3936
3982
|
}
|
|
3937
3983
|
return void 0;
|
|
3938
3984
|
};
|
|
3939
3985
|
var isProcessEnvAccess = (node) => {
|
|
3940
|
-
if (node.type !==
|
|
3986
|
+
if (node.type !== import_utils43.AST_NODE_TYPES.MemberExpression) {
|
|
3941
3987
|
return false;
|
|
3942
3988
|
}
|
|
3943
3989
|
if (getMemberPropertyName13(node) !== "env") {
|
|
3944
3990
|
return false;
|
|
3945
3991
|
}
|
|
3946
|
-
return node.object.type ===
|
|
3992
|
+
return node.object.type === import_utils43.AST_NODE_TYPES.Identifier && node.object.name === "process";
|
|
3947
3993
|
};
|
|
3948
3994
|
var isTlsRejectUnauthorizedMember = (node) => {
|
|
3949
|
-
if (node.type !==
|
|
3995
|
+
if (node.type !== import_utils43.AST_NODE_TYPES.MemberExpression) {
|
|
3950
3996
|
return false;
|
|
3951
3997
|
}
|
|
3952
3998
|
if (getMemberPropertyName13(node) !== "NODE_TLS_REJECT_UNAUTHORIZED") {
|
|
@@ -3955,10 +4001,10 @@ var isTlsRejectUnauthorizedMember = (node) => {
|
|
|
3955
4001
|
return isProcessEnvAccess(node.object);
|
|
3956
4002
|
};
|
|
3957
4003
|
var isUnsafeOverrideValue = (node) => {
|
|
3958
|
-
if (node.type ===
|
|
4004
|
+
if (node.type === import_utils43.AST_NODE_TYPES.Literal) {
|
|
3959
4005
|
return node.value === 0 || node.value === "0";
|
|
3960
4006
|
}
|
|
3961
|
-
return node.type ===
|
|
4007
|
+
return node.type === import_utils43.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0 && (0, import_ts_extras27.arrayFirst)(node.quasis)?.value.cooked === "0";
|
|
3962
4008
|
};
|
|
3963
4009
|
var rule51 = createRule({
|
|
3964
4010
|
create(context) {
|
|
@@ -3979,7 +4025,7 @@ var rule51 = createRule({
|
|
|
3979
4025
|
suggest: [
|
|
3980
4026
|
{
|
|
3981
4027
|
fix(fixer) {
|
|
3982
|
-
const replacementValue = node.right.type ===
|
|
4028
|
+
const replacementValue = node.right.type === import_utils43.AST_NODE_TYPES.TemplateLiteral ? "`1`" : "'1'";
|
|
3983
4029
|
return fixer.replaceText(node.right, replacementValue);
|
|
3984
4030
|
},
|
|
3985
4031
|
messageId: "replaceWithTlsRejectUnauthorizedOne"
|
|
@@ -4010,9 +4056,10 @@ var rule51 = createRule({
|
|
|
4010
4056
|
var no_node_tls_reject_unauthorized_zero_default = rule51;
|
|
4011
4057
|
|
|
4012
4058
|
// dist/rules/no-node-tls-security-level-zero.js
|
|
4059
|
+
var import_utils44 = require("@typescript-eslint/utils");
|
|
4013
4060
|
var TLS_DEFAULT_CIPHERS_PROPERTY_NAMES = /* @__PURE__ */ new Set(["DEFAULT_CIPHERS"]);
|
|
4014
|
-
var TLS_SECURITY_LEVEL_ZERO_PATTERN = /@seclevel\s*=\s*0\b/
|
|
4015
|
-
var isExpressionNode4 = (node) => node.type !==
|
|
4061
|
+
var TLS_SECURITY_LEVEL_ZERO_PATTERN = /@seclevel\s*=\s*0\b/iv;
|
|
4062
|
+
var isExpressionNode4 = (node) => node.type !== import_utils44.AST_NODE_TYPES.ArrayPattern && node.type !== import_utils44.AST_NODE_TYPES.AssignmentPattern && node.type !== import_utils44.AST_NODE_TYPES.ObjectPattern;
|
|
4016
4063
|
var isSecurityLevelZeroCipherString = (value) => TLS_SECURITY_LEVEL_ZERO_PATTERN.test(value);
|
|
4017
4064
|
var rule52 = createRule({
|
|
4018
4065
|
create(context) {
|
|
@@ -4039,7 +4086,7 @@ var rule52 = createRule({
|
|
|
4039
4086
|
return;
|
|
4040
4087
|
}
|
|
4041
4088
|
for (const propertyNode of node.properties) {
|
|
4042
|
-
if (propertyNode.type !==
|
|
4089
|
+
if (propertyNode.type !== import_utils44.AST_NODE_TYPES.Property || propertyNode.kind !== "init" || getPropertyName(propertyNode) !== "ciphers" || !isExpressionNode4(propertyNode.value)) {
|
|
4043
4090
|
continue;
|
|
4044
4091
|
}
|
|
4045
4092
|
const configuredValue = getStaticStringValue(propertyNode.value);
|
|
@@ -4077,6 +4124,7 @@ var rule52 = createRule({
|
|
|
4077
4124
|
var no_node_tls_security_level_zero_default = rule52;
|
|
4078
4125
|
|
|
4079
4126
|
// dist/rules/no-node-vm-run-in-context.js
|
|
4127
|
+
var import_utils45 = require("@typescript-eslint/utils");
|
|
4080
4128
|
var import_ts_extras28 = require("ts-extras");
|
|
4081
4129
|
var VM_MODULE_NAMES = /* @__PURE__ */ new Set(["node:vm", "vm"]);
|
|
4082
4130
|
var DISALLOWED_VM_CALL_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -4090,17 +4138,17 @@ var isVmModuleSource = (value) => (0, import_ts_extras28.setHas)(VM_MODULE_NAMES
|
|
|
4090
4138
|
var isDisallowedVmCallName = (value) => (0, import_ts_extras28.isDefined)(value) && (0, import_ts_extras28.setHas)(DISALLOWED_VM_CALL_NAMES, value);
|
|
4091
4139
|
var isDisallowedVmConstructorName = (value) => (0, import_ts_extras28.isDefined)(value) && (0, import_ts_extras28.setHas)(DISALLOWED_VM_CONSTRUCTOR_NAMES, value);
|
|
4092
4140
|
var isRequireCallFromVmModule = (expression) => {
|
|
4093
|
-
if (expression?.type !==
|
|
4141
|
+
if (expression?.type !== import_utils45.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils45.AST_NODE_TYPES.Identifier || expression.callee.name !== "require") {
|
|
4094
4142
|
return false;
|
|
4095
4143
|
}
|
|
4096
4144
|
const [firstArgument] = expression.arguments;
|
|
4097
|
-
return firstArgument !== void 0 && firstArgument.type !==
|
|
4145
|
+
return firstArgument !== void 0 && firstArgument.type !== import_utils45.AST_NODE_TYPES.SpreadElement && firstArgument.type === import_utils45.AST_NODE_TYPES.Literal && typeof firstArgument.value === "string" && isVmModuleSource(firstArgument.value);
|
|
4098
4146
|
};
|
|
4099
4147
|
var getPatternIdentifier2 = (pattern) => {
|
|
4100
|
-
if (pattern.type ===
|
|
4148
|
+
if (pattern.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4101
4149
|
return pattern;
|
|
4102
4150
|
}
|
|
4103
|
-
if (pattern.type ===
|
|
4151
|
+
if (pattern.type === import_utils45.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4104
4152
|
return pattern.left;
|
|
4105
4153
|
}
|
|
4106
4154
|
return void 0;
|
|
@@ -4112,7 +4160,7 @@ var rule53 = createRule({
|
|
|
4112
4160
|
const vmNamespaceBindingNames = /* @__PURE__ */ new Set();
|
|
4113
4161
|
return {
|
|
4114
4162
|
CallExpression(node) {
|
|
4115
|
-
if (node.callee.type ===
|
|
4163
|
+
if (node.callee.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4116
4164
|
if (!(0, import_ts_extras28.setHas)(vmCallBindingNames, node.callee.name)) {
|
|
4117
4165
|
return;
|
|
4118
4166
|
}
|
|
@@ -4122,21 +4170,21 @@ var rule53 = createRule({
|
|
|
4122
4170
|
});
|
|
4123
4171
|
return;
|
|
4124
4172
|
}
|
|
4125
|
-
if (node.callee.type !==
|
|
4173
|
+
if (node.callee.type !== import_utils45.AST_NODE_TYPES.MemberExpression) {
|
|
4126
4174
|
return;
|
|
4127
4175
|
}
|
|
4128
4176
|
const methodName = getMemberPropertyName3(node.callee);
|
|
4129
4177
|
if (!isDisallowedVmCallName(methodName)) {
|
|
4130
4178
|
return;
|
|
4131
4179
|
}
|
|
4132
|
-
if (node.callee.object.type ===
|
|
4180
|
+
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.Identifier && (0, import_ts_extras28.setHas)(vmNamespaceBindingNames, node.callee.object.name)) {
|
|
4133
4181
|
context.report({
|
|
4134
4182
|
messageId: "default",
|
|
4135
4183
|
node: node.callee
|
|
4136
4184
|
});
|
|
4137
4185
|
return;
|
|
4138
4186
|
}
|
|
4139
|
-
if (node.callee.object.type ===
|
|
4187
|
+
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.CallExpression && isRequireCallFromVmModule(node.callee.object)) {
|
|
4140
4188
|
context.report({
|
|
4141
4189
|
messageId: "default",
|
|
4142
4190
|
node: node.callee
|
|
@@ -4148,11 +4196,11 @@ var rule53 = createRule({
|
|
|
4148
4196
|
return;
|
|
4149
4197
|
}
|
|
4150
4198
|
for (const specifierNode of node.specifiers) {
|
|
4151
|
-
if (specifierNode.type ===
|
|
4199
|
+
if (specifierNode.type === import_utils45.AST_NODE_TYPES.ImportDefaultSpecifier || specifierNode.type === import_utils45.AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
4152
4200
|
vmNamespaceBindingNames.add(specifierNode.local.name);
|
|
4153
4201
|
continue;
|
|
4154
4202
|
}
|
|
4155
|
-
const importedName = specifierNode.imported.type ===
|
|
4203
|
+
const importedName = specifierNode.imported.type === import_utils45.AST_NODE_TYPES.Identifier ? specifierNode.imported.name : specifierNode.imported.value;
|
|
4156
4204
|
if (isDisallowedVmCallName(importedName)) {
|
|
4157
4205
|
vmCallBindingNames.add(specifierNode.local.name);
|
|
4158
4206
|
continue;
|
|
@@ -4163,7 +4211,7 @@ var rule53 = createRule({
|
|
|
4163
4211
|
}
|
|
4164
4212
|
},
|
|
4165
4213
|
NewExpression(node) {
|
|
4166
|
-
if (node.callee.type ===
|
|
4214
|
+
if (node.callee.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4167
4215
|
if (!(0, import_ts_extras28.setHas)(vmConstructorBindingNames, node.callee.name)) {
|
|
4168
4216
|
return;
|
|
4169
4217
|
}
|
|
@@ -4173,21 +4221,21 @@ var rule53 = createRule({
|
|
|
4173
4221
|
});
|
|
4174
4222
|
return;
|
|
4175
4223
|
}
|
|
4176
|
-
if (node.callee.type !==
|
|
4224
|
+
if (node.callee.type !== import_utils45.AST_NODE_TYPES.MemberExpression) {
|
|
4177
4225
|
return;
|
|
4178
4226
|
}
|
|
4179
4227
|
const constructorName = getMemberPropertyName3(node.callee);
|
|
4180
4228
|
if (!isDisallowedVmConstructorName(constructorName)) {
|
|
4181
4229
|
return;
|
|
4182
4230
|
}
|
|
4183
|
-
if (node.callee.object.type ===
|
|
4231
|
+
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.Identifier && (0, import_ts_extras28.setHas)(vmNamespaceBindingNames, node.callee.object.name)) {
|
|
4184
4232
|
context.report({
|
|
4185
4233
|
messageId: "default",
|
|
4186
4234
|
node: node.callee
|
|
4187
4235
|
});
|
|
4188
4236
|
return;
|
|
4189
4237
|
}
|
|
4190
|
-
if (node.callee.object.type ===
|
|
4238
|
+
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.CallExpression && isRequireCallFromVmModule(node.callee.object)) {
|
|
4191
4239
|
context.report({
|
|
4192
4240
|
messageId: "default",
|
|
4193
4241
|
node: node.callee
|
|
@@ -4198,15 +4246,15 @@ var rule53 = createRule({
|
|
|
4198
4246
|
if (!isRequireCallFromVmModule(node.init)) {
|
|
4199
4247
|
return;
|
|
4200
4248
|
}
|
|
4201
|
-
if (node.id.type ===
|
|
4249
|
+
if (node.id.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4202
4250
|
vmNamespaceBindingNames.add(node.id.name);
|
|
4203
4251
|
return;
|
|
4204
4252
|
}
|
|
4205
|
-
if (node.id.type !==
|
|
4253
|
+
if (node.id.type !== import_utils45.AST_NODE_TYPES.ObjectPattern) {
|
|
4206
4254
|
return;
|
|
4207
4255
|
}
|
|
4208
4256
|
for (const propertyNode of node.id.properties) {
|
|
4209
|
-
if (propertyNode.type !==
|
|
4257
|
+
if (propertyNode.type !== import_utils45.AST_NODE_TYPES.Property || propertyNode.computed) {
|
|
4210
4258
|
continue;
|
|
4211
4259
|
}
|
|
4212
4260
|
const importedName = getPropertyName(propertyNode);
|
|
@@ -4244,37 +4292,38 @@ var rule53 = createRule({
|
|
|
4244
4292
|
var no_node_vm_run_in_context_default = rule53;
|
|
4245
4293
|
|
|
4246
4294
|
// dist/rules/no-node-vm-source-text-module.js
|
|
4295
|
+
var import_utils46 = require("@typescript-eslint/utils");
|
|
4247
4296
|
var import_ts_extras29 = require("ts-extras");
|
|
4248
4297
|
var VM_MODULE_NAMES2 = /* @__PURE__ */ new Set(["node:vm", "vm"]);
|
|
4249
4298
|
var SOURCE_TEXT_MODULE_NAME = "SourceTextModule";
|
|
4250
4299
|
var isVmModuleSource2 = (value) => (0, import_ts_extras29.setHas)(VM_MODULE_NAMES2, value);
|
|
4251
4300
|
var isRequireCallFromVmModule2 = (expression) => {
|
|
4252
|
-
if (expression?.type !==
|
|
4301
|
+
if (expression?.type !== import_utils46.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils46.AST_NODE_TYPES.Identifier || expression.callee.name !== "require") {
|
|
4253
4302
|
return false;
|
|
4254
4303
|
}
|
|
4255
4304
|
const [firstArgument] = expression.arguments;
|
|
4256
|
-
return firstArgument !== void 0 && firstArgument.type !==
|
|
4305
|
+
return firstArgument !== void 0 && firstArgument.type !== import_utils46.AST_NODE_TYPES.SpreadElement && firstArgument.type === import_utils46.AST_NODE_TYPES.Literal && typeof firstArgument.value === "string" && isVmModuleSource2(firstArgument.value);
|
|
4257
4306
|
};
|
|
4258
4307
|
var getPatternIdentifier3 = (pattern) => {
|
|
4259
|
-
if (pattern.type ===
|
|
4308
|
+
if (pattern.type === import_utils46.AST_NODE_TYPES.Identifier) {
|
|
4260
4309
|
return pattern;
|
|
4261
4310
|
}
|
|
4262
|
-
if (pattern.type ===
|
|
4311
|
+
if (pattern.type === import_utils46.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils46.AST_NODE_TYPES.Identifier) {
|
|
4263
4312
|
return pattern.left;
|
|
4264
4313
|
}
|
|
4265
4314
|
return void 0;
|
|
4266
4315
|
};
|
|
4267
4316
|
var isSourceTextModuleConstructor = (callee, sourceTextModuleBindingNames, vmNamespaceBindingNames) => {
|
|
4268
|
-
if (callee.type ===
|
|
4317
|
+
if (callee.type === import_utils46.AST_NODE_TYPES.Identifier) {
|
|
4269
4318
|
return (0, import_ts_extras29.setHas)(sourceTextModuleBindingNames, callee.name);
|
|
4270
4319
|
}
|
|
4271
|
-
if (callee.type !==
|
|
4320
|
+
if (callee.type !== import_utils46.AST_NODE_TYPES.MemberExpression) {
|
|
4272
4321
|
return false;
|
|
4273
4322
|
}
|
|
4274
4323
|
if (getMemberPropertyName3(callee) !== SOURCE_TEXT_MODULE_NAME) {
|
|
4275
4324
|
return false;
|
|
4276
4325
|
}
|
|
4277
|
-
return callee.object.type ===
|
|
4326
|
+
return callee.object.type === import_utils46.AST_NODE_TYPES.Identifier && (0, import_ts_extras29.setHas)(vmNamespaceBindingNames, callee.object.name) || callee.object.type === import_utils46.AST_NODE_TYPES.CallExpression && isRequireCallFromVmModule2(callee.object);
|
|
4278
4327
|
};
|
|
4279
4328
|
var rule54 = createRule({
|
|
4280
4329
|
create(context) {
|
|
@@ -4286,11 +4335,11 @@ var rule54 = createRule({
|
|
|
4286
4335
|
return;
|
|
4287
4336
|
}
|
|
4288
4337
|
for (const specifierNode of node.specifiers) {
|
|
4289
|
-
if (specifierNode.type ===
|
|
4338
|
+
if (specifierNode.type === import_utils46.AST_NODE_TYPES.ImportDefaultSpecifier || specifierNode.type === import_utils46.AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
4290
4339
|
vmNamespaceBindingNames.add(specifierNode.local.name);
|
|
4291
4340
|
continue;
|
|
4292
4341
|
}
|
|
4293
|
-
const importedName = specifierNode.imported.type ===
|
|
4342
|
+
const importedName = specifierNode.imported.type === import_utils46.AST_NODE_TYPES.Identifier ? specifierNode.imported.name : specifierNode.imported.value;
|
|
4294
4343
|
if (importedName === SOURCE_TEXT_MODULE_NAME) {
|
|
4295
4344
|
sourceTextModuleBindingNames.add(specifierNode.local.name);
|
|
4296
4345
|
}
|
|
@@ -4309,15 +4358,15 @@ var rule54 = createRule({
|
|
|
4309
4358
|
if (!isRequireCallFromVmModule2(node.init)) {
|
|
4310
4359
|
return;
|
|
4311
4360
|
}
|
|
4312
|
-
if (node.id.type ===
|
|
4361
|
+
if (node.id.type === import_utils46.AST_NODE_TYPES.Identifier) {
|
|
4313
4362
|
vmNamespaceBindingNames.add(node.id.name);
|
|
4314
4363
|
return;
|
|
4315
4364
|
}
|
|
4316
|
-
if (node.id.type !==
|
|
4365
|
+
if (node.id.type !== import_utils46.AST_NODE_TYPES.ObjectPattern) {
|
|
4317
4366
|
return;
|
|
4318
4367
|
}
|
|
4319
4368
|
for (const propertyNode of node.id.properties) {
|
|
4320
|
-
if (propertyNode.type !==
|
|
4369
|
+
if (propertyNode.type !== import_utils46.AST_NODE_TYPES.Property || propertyNode.computed) {
|
|
4321
4370
|
continue;
|
|
4322
4371
|
}
|
|
4323
4372
|
if (getPropertyName(propertyNode) !== SOURCE_TEXT_MODULE_NAME) {
|
|
@@ -4351,6 +4400,7 @@ var rule54 = createRule({
|
|
|
4351
4400
|
var no_node_vm_source_text_module_default = rule54;
|
|
4352
4401
|
|
|
4353
4402
|
// dist/rules/no-node-worker-threads-eval.js
|
|
4403
|
+
var import_utils47 = require("@typescript-eslint/utils");
|
|
4354
4404
|
var import_ts_extras30 = require("ts-extras");
|
|
4355
4405
|
var WORKER_THREADS_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
4356
4406
|
"node:worker_threads",
|
|
@@ -4358,49 +4408,49 @@ var WORKER_THREADS_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
|
4358
4408
|
]);
|
|
4359
4409
|
var isWorkerThreadsModuleSource = (value) => (0, import_ts_extras30.setHas)(WORKER_THREADS_MODULE_NAMES, value);
|
|
4360
4410
|
var isRequireCallFromWorkerThreads = (expression) => {
|
|
4361
|
-
if (expression?.type !==
|
|
4411
|
+
if (expression?.type !== import_utils47.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils47.AST_NODE_TYPES.Identifier || expression.callee.name !== "require") {
|
|
4362
4412
|
return false;
|
|
4363
4413
|
}
|
|
4364
4414
|
const [firstArgument] = expression.arguments;
|
|
4365
|
-
return firstArgument !== void 0 && firstArgument.type !==
|
|
4415
|
+
return firstArgument !== void 0 && firstArgument.type !== import_utils47.AST_NODE_TYPES.SpreadElement && firstArgument.type === import_utils47.AST_NODE_TYPES.Literal && typeof firstArgument.value === "string" && isWorkerThreadsModuleSource(firstArgument.value);
|
|
4366
4416
|
};
|
|
4367
4417
|
var getPatternIdentifier4 = (pattern) => {
|
|
4368
|
-
if (pattern.type ===
|
|
4418
|
+
if (pattern.type === import_utils47.AST_NODE_TYPES.Identifier) {
|
|
4369
4419
|
return pattern;
|
|
4370
4420
|
}
|
|
4371
|
-
if (pattern.type ===
|
|
4421
|
+
if (pattern.type === import_utils47.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils47.AST_NODE_TYPES.Identifier) {
|
|
4372
4422
|
return pattern.left;
|
|
4373
4423
|
}
|
|
4374
4424
|
return void 0;
|
|
4375
4425
|
};
|
|
4376
4426
|
var hasEvalTrueOption = (optionsNode) => {
|
|
4377
|
-
if (optionsNode.type !==
|
|
4427
|
+
if (optionsNode.type !== import_utils47.AST_NODE_TYPES.ObjectExpression) {
|
|
4378
4428
|
return false;
|
|
4379
4429
|
}
|
|
4380
4430
|
for (const propertyNode of optionsNode.properties) {
|
|
4381
|
-
if (propertyNode.type !==
|
|
4431
|
+
if (propertyNode.type !== import_utils47.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
4382
4432
|
continue;
|
|
4383
4433
|
}
|
|
4384
4434
|
if (getPropertyName(propertyNode) !== "eval") {
|
|
4385
4435
|
continue;
|
|
4386
4436
|
}
|
|
4387
|
-
if (propertyNode.value.type ===
|
|
4437
|
+
if (propertyNode.value.type === import_utils47.AST_NODE_TYPES.Literal && propertyNode.value.value === true) {
|
|
4388
4438
|
return true;
|
|
4389
4439
|
}
|
|
4390
4440
|
}
|
|
4391
4441
|
return false;
|
|
4392
4442
|
};
|
|
4393
4443
|
var isWorkerThreadsWorkerConstructor = (callee, workerBindingNames, workerThreadsNamespaceBindingNames) => {
|
|
4394
|
-
if (callee.type ===
|
|
4444
|
+
if (callee.type === import_utils47.AST_NODE_TYPES.Identifier) {
|
|
4395
4445
|
return (0, import_ts_extras30.setHas)(workerBindingNames, callee.name);
|
|
4396
4446
|
}
|
|
4397
|
-
if (callee.type !==
|
|
4447
|
+
if (callee.type !== import_utils47.AST_NODE_TYPES.MemberExpression) {
|
|
4398
4448
|
return false;
|
|
4399
4449
|
}
|
|
4400
4450
|
if (getMemberPropertyName3(callee) !== "Worker") {
|
|
4401
4451
|
return false;
|
|
4402
4452
|
}
|
|
4403
|
-
return callee.object.type ===
|
|
4453
|
+
return callee.object.type === import_utils47.AST_NODE_TYPES.Identifier && (0, import_ts_extras30.setHas)(workerThreadsNamespaceBindingNames, callee.object.name) || callee.object.type === import_utils47.AST_NODE_TYPES.CallExpression && isRequireCallFromWorkerThreads(callee.object);
|
|
4404
4454
|
};
|
|
4405
4455
|
var rule55 = createRule({
|
|
4406
4456
|
create(context) {
|
|
@@ -4412,11 +4462,11 @@ var rule55 = createRule({
|
|
|
4412
4462
|
return;
|
|
4413
4463
|
}
|
|
4414
4464
|
for (const specifierNode of node.specifiers) {
|
|
4415
|
-
if (specifierNode.type ===
|
|
4465
|
+
if (specifierNode.type === import_utils47.AST_NODE_TYPES.ImportDefaultSpecifier || specifierNode.type === import_utils47.AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
4416
4466
|
workerThreadsNamespaceBindingNames.add(specifierNode.local.name);
|
|
4417
4467
|
continue;
|
|
4418
4468
|
}
|
|
4419
|
-
const importedName = specifierNode.imported.type ===
|
|
4469
|
+
const importedName = specifierNode.imported.type === import_utils47.AST_NODE_TYPES.Identifier ? specifierNode.imported.name : specifierNode.imported.value;
|
|
4420
4470
|
if (importedName === "Worker") {
|
|
4421
4471
|
workerBindingNames.add(specifierNode.local.name);
|
|
4422
4472
|
}
|
|
@@ -4427,7 +4477,7 @@ var rule55 = createRule({
|
|
|
4427
4477
|
return;
|
|
4428
4478
|
}
|
|
4429
4479
|
const [, secondArgument] = node.arguments;
|
|
4430
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
4480
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils47.AST_NODE_TYPES.SpreadElement || !hasEvalTrueOption(secondArgument)) {
|
|
4431
4481
|
return;
|
|
4432
4482
|
}
|
|
4433
4483
|
context.report({
|
|
@@ -4439,15 +4489,15 @@ var rule55 = createRule({
|
|
|
4439
4489
|
if (!isRequireCallFromWorkerThreads(node.init)) {
|
|
4440
4490
|
return;
|
|
4441
4491
|
}
|
|
4442
|
-
if (node.id.type ===
|
|
4492
|
+
if (node.id.type === import_utils47.AST_NODE_TYPES.Identifier) {
|
|
4443
4493
|
workerThreadsNamespaceBindingNames.add(node.id.name);
|
|
4444
4494
|
return;
|
|
4445
4495
|
}
|
|
4446
|
-
if (node.id.type !==
|
|
4496
|
+
if (node.id.type !== import_utils47.AST_NODE_TYPES.ObjectPattern) {
|
|
4447
4497
|
return;
|
|
4448
4498
|
}
|
|
4449
4499
|
for (const propertyNode of node.id.properties) {
|
|
4450
|
-
if (propertyNode.type !==
|
|
4500
|
+
if (propertyNode.type !== import_utils47.AST_NODE_TYPES.Property || propertyNode.computed) {
|
|
4451
4501
|
continue;
|
|
4452
4502
|
}
|
|
4453
4503
|
if (getPropertyName(propertyNode) !== "Worker") {
|
|
@@ -4481,12 +4531,13 @@ var rule55 = createRule({
|
|
|
4481
4531
|
var no_node_worker_threads_eval_default = rule55;
|
|
4482
4532
|
|
|
4483
4533
|
// dist/rules/no-nonnull-assertion-on-security-input.js
|
|
4484
|
-
var
|
|
4534
|
+
var import_utils48 = require("@typescript-eslint/utils");
|
|
4535
|
+
var SECURITY_INPUT_PATTERN = /html|input|message|origin|payload|token|url/iv;
|
|
4485
4536
|
var isSecuritySensitiveExpression = (expression) => {
|
|
4486
|
-
if (expression.type ===
|
|
4537
|
+
if (expression.type === import_utils48.AST_NODE_TYPES.Identifier) {
|
|
4487
4538
|
return SECURITY_INPUT_PATTERN.test(expression.name);
|
|
4488
4539
|
}
|
|
4489
|
-
if (expression.type ===
|
|
4540
|
+
if (expression.type === import_utils48.AST_NODE_TYPES.MemberExpression && !expression.computed && expression.property.type === import_utils48.AST_NODE_TYPES.Identifier) {
|
|
4490
4541
|
return SECURITY_INPUT_PATTERN.test(expression.property.name);
|
|
4491
4542
|
}
|
|
4492
4543
|
return false;
|
|
@@ -4524,6 +4575,7 @@ var rule56 = createRule({
|
|
|
4524
4575
|
var no_nonnull_assertion_on_security_input_default = rule56;
|
|
4525
4576
|
|
|
4526
4577
|
// dist/rules/no-postmessage-star-origin.js
|
|
4578
|
+
var import_utils49 = require("@typescript-eslint/utils");
|
|
4527
4579
|
var import_ts_extras31 = require("ts-extras");
|
|
4528
4580
|
var rule57 = createRule({
|
|
4529
4581
|
create(context) {
|
|
@@ -4531,10 +4583,10 @@ var rule57 = createRule({
|
|
|
4531
4583
|
return {
|
|
4532
4584
|
"CallExpression[arguments.length>=2][arguments.length<=3][callee.property.name='postMessage']"(node) {
|
|
4533
4585
|
const [, targetOrigin] = node.arguments;
|
|
4534
|
-
if (!(0, import_ts_extras31.isDefined)(targetOrigin) || targetOrigin.type !==
|
|
4586
|
+
if (!(0, import_ts_extras31.isDefined)(targetOrigin) || targetOrigin.type !== import_utils49.AST_NODE_TYPES.Literal || targetOrigin.value !== "*") {
|
|
4535
4587
|
return;
|
|
4536
4588
|
}
|
|
4537
|
-
if ((0, import_ts_extras31.isDefined)(fullTypeChecker) && node.callee.type ===
|
|
4589
|
+
if ((0, import_ts_extras31.isDefined)(fullTypeChecker) && node.callee.type === import_utils49.AST_NODE_TYPES.MemberExpression) {
|
|
4538
4590
|
const calleeObjectType = getNodeTypeAsString(fullTypeChecker, node.callee.object, context);
|
|
4539
4591
|
if (!(0, import_ts_extras31.arrayIncludes)(["any", "Window"], calleeObjectType)) {
|
|
4540
4592
|
return;
|
|
@@ -4576,21 +4628,22 @@ var rule57 = createRule({
|
|
|
4576
4628
|
var no_postmessage_star_origin_default = rule57;
|
|
4577
4629
|
|
|
4578
4630
|
// dist/rules/no-postmessage-without-origin-allowlist.js
|
|
4631
|
+
var import_utils50 = require("@typescript-eslint/utils");
|
|
4579
4632
|
var import_ts_extras32 = require("ts-extras");
|
|
4580
4633
|
var getMemberPropertyName14 = (memberExpression) => {
|
|
4581
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
4634
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils50.AST_NODE_TYPES.Identifier) {
|
|
4582
4635
|
return memberExpression.property.name;
|
|
4583
4636
|
}
|
|
4584
|
-
if (memberExpression.property.type ===
|
|
4637
|
+
if (memberExpression.property.type === import_utils50.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
4585
4638
|
return memberExpression.property.value;
|
|
4586
4639
|
}
|
|
4587
4640
|
return void 0;
|
|
4588
4641
|
};
|
|
4589
4642
|
var getStaticStringValue6 = (node) => {
|
|
4590
|
-
if (node.type ===
|
|
4643
|
+
if (node.type === import_utils50.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
4591
4644
|
return node.value;
|
|
4592
4645
|
}
|
|
4593
|
-
if (node.type ===
|
|
4646
|
+
if (node.type === import_utils50.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
4594
4647
|
return (0, import_ts_extras32.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
4595
4648
|
}
|
|
4596
4649
|
return void 0;
|
|
@@ -4603,20 +4656,20 @@ var isAllowedOriginLiteral = (origin) => {
|
|
|
4603
4656
|
if (normalizedOrigin.includes("*")) {
|
|
4604
4657
|
return false;
|
|
4605
4658
|
}
|
|
4606
|
-
return /^https?:\/\//
|
|
4659
|
+
return /^https?:\/\//iv.test(normalizedOrigin);
|
|
4607
4660
|
};
|
|
4608
4661
|
var rule58 = createRule({
|
|
4609
4662
|
create(context) {
|
|
4610
4663
|
return {
|
|
4611
4664
|
CallExpression(node) {
|
|
4612
|
-
if (node.callee.type !==
|
|
4665
|
+
if (node.callee.type !== import_utils50.AST_NODE_TYPES.MemberExpression) {
|
|
4613
4666
|
return;
|
|
4614
4667
|
}
|
|
4615
4668
|
if (getMemberPropertyName14(node.callee) !== "postMessage") {
|
|
4616
4669
|
return;
|
|
4617
4670
|
}
|
|
4618
4671
|
const [, secondArgument] = node.arguments;
|
|
4619
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
4672
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils50.AST_NODE_TYPES.SpreadElement) {
|
|
4620
4673
|
return;
|
|
4621
4674
|
}
|
|
4622
4675
|
const secondArgumentValue = getStaticStringValue6(secondArgument);
|
|
@@ -4649,21 +4702,22 @@ var rule58 = createRule({
|
|
|
4649
4702
|
var no_postmessage_without_origin_allowlist_default = rule58;
|
|
4650
4703
|
|
|
4651
4704
|
// dist/rules/no-range-create-contextual-fragment.js
|
|
4705
|
+
var import_utils51 = require("@typescript-eslint/utils");
|
|
4652
4706
|
var isSanitizedExpression2 = (node) => {
|
|
4653
|
-
if (node.type !==
|
|
4707
|
+
if (node.type !== import_utils51.AST_NODE_TYPES.CallExpression) {
|
|
4654
4708
|
return false;
|
|
4655
4709
|
}
|
|
4656
|
-
if (node.callee.type ===
|
|
4657
|
-
return /createhtml|sanitize|trusted/
|
|
4710
|
+
if (node.callee.type === import_utils51.AST_NODE_TYPES.Identifier) {
|
|
4711
|
+
return /createhtml|sanitize|trusted/v.test(node.callee.name.toLowerCase());
|
|
4658
4712
|
}
|
|
4659
|
-
if (node.callee.type !==
|
|
4713
|
+
if (node.callee.type !== import_utils51.AST_NODE_TYPES.MemberExpression) {
|
|
4660
4714
|
return false;
|
|
4661
4715
|
}
|
|
4662
4716
|
const propertyName = getMemberPropertyName3(node.callee);
|
|
4663
|
-
return typeof propertyName === "string" && /createhtml|sanitize|trusted/
|
|
4717
|
+
return typeof propertyName === "string" && /createhtml|sanitize|trusted/v.test(propertyName.toLowerCase());
|
|
4664
4718
|
};
|
|
4665
4719
|
var isCreateContextualFragmentCall = (node) => {
|
|
4666
|
-
if (node.callee.type !==
|
|
4720
|
+
if (node.callee.type !== import_utils51.AST_NODE_TYPES.MemberExpression) {
|
|
4667
4721
|
return false;
|
|
4668
4722
|
}
|
|
4669
4723
|
return getMemberPropertyName3(node.callee) === "createContextualFragment";
|
|
@@ -4676,7 +4730,7 @@ var rule59 = createRule({
|
|
|
4676
4730
|
return;
|
|
4677
4731
|
}
|
|
4678
4732
|
const [firstArgument] = node.arguments;
|
|
4679
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
4733
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils51.AST_NODE_TYPES.SpreadElement || getStaticStringValue(firstArgument) === "" || isSanitizedExpression2(firstArgument)) {
|
|
4680
4734
|
return;
|
|
4681
4735
|
}
|
|
4682
4736
|
context.report({
|
|
@@ -4704,17 +4758,21 @@ var rule59 = createRule({
|
|
|
4704
4758
|
});
|
|
4705
4759
|
var no_range_create_contextual_fragment_default = rule59;
|
|
4706
4760
|
|
|
4761
|
+
// dist/rules/no-script-src-data-url.js
|
|
4762
|
+
var import_utils53 = require("@typescript-eslint/utils");
|
|
4763
|
+
|
|
4707
4764
|
// dist/_internal/script-element.js
|
|
4765
|
+
var import_utils52 = require("@typescript-eslint/utils");
|
|
4708
4766
|
var isLikelyScriptIdentifierName = (identifierName) => identifierName === "currentScript" || identifierName === "script" || identifierName === "scriptElement" || identifierName.endsWith("Script") || identifierName.endsWith("ScriptElement") || identifierName.endsWith("_script") || identifierName.endsWith("_script_element");
|
|
4709
4767
|
var isCreateElementScriptCall = (node) => {
|
|
4710
|
-
if (node.type !==
|
|
4768
|
+
if (node.type !== import_utils52.AST_NODE_TYPES.CallExpression || node.callee.type !== import_utils52.AST_NODE_TYPES.MemberExpression) {
|
|
4711
4769
|
return false;
|
|
4712
4770
|
}
|
|
4713
4771
|
if (getMemberPropertyName3(node.callee) !== "createElement") {
|
|
4714
4772
|
return false;
|
|
4715
4773
|
}
|
|
4716
4774
|
const [firstArgument] = node.arguments;
|
|
4717
|
-
return firstArgument !== void 0 && firstArgument.type !==
|
|
4775
|
+
return firstArgument !== void 0 && firstArgument.type !== import_utils52.AST_NODE_TYPES.SpreadElement && getStaticStringValue(firstArgument) === "script";
|
|
4718
4776
|
};
|
|
4719
4777
|
var isLikelyScriptElement = (node, context, fullTypeChecker) => {
|
|
4720
4778
|
if (fullTypeChecker !== void 0) {
|
|
@@ -4726,10 +4784,10 @@ var isLikelyScriptElement = (node, context, fullTypeChecker) => {
|
|
|
4726
4784
|
if (isCreateElementScriptCall(node)) {
|
|
4727
4785
|
return true;
|
|
4728
4786
|
}
|
|
4729
|
-
if (node.type ===
|
|
4787
|
+
if (node.type === import_utils52.AST_NODE_TYPES.Identifier) {
|
|
4730
4788
|
return isLikelyScriptIdentifierName(node.name);
|
|
4731
4789
|
}
|
|
4732
|
-
if (node.type !==
|
|
4790
|
+
if (node.type !== import_utils52.AST_NODE_TYPES.MemberExpression) {
|
|
4733
4791
|
return false;
|
|
4734
4792
|
}
|
|
4735
4793
|
const propertyName = getMemberPropertyName3(node);
|
|
@@ -4737,10 +4795,10 @@ var isLikelyScriptElement = (node, context, fullTypeChecker) => {
|
|
|
4737
4795
|
};
|
|
4738
4796
|
|
|
4739
4797
|
// dist/rules/no-script-src-data-url.js
|
|
4740
|
-
var isDataUrl2 = (value) => /^\s*data:/
|
|
4741
|
-
var isJsxScriptElement = (node) => node.name.type ===
|
|
4798
|
+
var isDataUrl2 = (value) => /^\s*data:/iv.test(value);
|
|
4799
|
+
var isJsxScriptElement = (node) => node.name.type === import_utils53.AST_NODE_TYPES.JSXIdentifier && node.name.name.toLowerCase() === "script";
|
|
4742
4800
|
var getJsxAttributeName5 = (attributeNode) => {
|
|
4743
|
-
if (attributeNode.name.type !==
|
|
4801
|
+
if (attributeNode.name.type !== import_utils53.AST_NODE_TYPES.JSXIdentifier) {
|
|
4744
4802
|
return void 0;
|
|
4745
4803
|
}
|
|
4746
4804
|
return attributeNode.name.name.toLowerCase();
|
|
@@ -4750,7 +4808,7 @@ var rule60 = createRule({
|
|
|
4750
4808
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
4751
4809
|
return {
|
|
4752
4810
|
AssignmentExpression(node) {
|
|
4753
|
-
if (node.left.type !==
|
|
4811
|
+
if (node.left.type !== import_utils53.AST_NODE_TYPES.MemberExpression) {
|
|
4754
4812
|
return;
|
|
4755
4813
|
}
|
|
4756
4814
|
if (getMemberPropertyName3(node.left) !== "src") {
|
|
@@ -4766,7 +4824,7 @@ var rule60 = createRule({
|
|
|
4766
4824
|
});
|
|
4767
4825
|
},
|
|
4768
4826
|
CallExpression(node) {
|
|
4769
|
-
if (node.callee.type !==
|
|
4827
|
+
if (node.callee.type !== import_utils53.AST_NODE_TYPES.MemberExpression) {
|
|
4770
4828
|
return;
|
|
4771
4829
|
}
|
|
4772
4830
|
const methodName = getMemberPropertyName3(node.callee);
|
|
@@ -4774,7 +4832,7 @@ var rule60 = createRule({
|
|
|
4774
4832
|
return;
|
|
4775
4833
|
}
|
|
4776
4834
|
const [firstArgument, secondArgument] = node.arguments;
|
|
4777
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
4835
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils53.AST_NODE_TYPES.SpreadElement || getStaticStringValue(firstArgument) !== "src" || secondArgument === void 0 || secondArgument.type === import_utils53.AST_NODE_TYPES.SpreadElement) {
|
|
4778
4836
|
return;
|
|
4779
4837
|
}
|
|
4780
4838
|
const configuredValue = getStaticStringValue(secondArgument);
|
|
@@ -4791,7 +4849,7 @@ var rule60 = createRule({
|
|
|
4791
4849
|
return;
|
|
4792
4850
|
}
|
|
4793
4851
|
for (const attributeNode of node.attributes) {
|
|
4794
|
-
if (attributeNode.type !==
|
|
4852
|
+
if (attributeNode.type !== import_utils53.AST_NODE_TYPES.JSXAttribute) {
|
|
4795
4853
|
continue;
|
|
4796
4854
|
}
|
|
4797
4855
|
if (getJsxAttributeName5(attributeNode) !== "src") {
|
|
@@ -4828,13 +4886,14 @@ var rule60 = createRule({
|
|
|
4828
4886
|
var no_script_src_data_url_default = rule60;
|
|
4829
4887
|
|
|
4830
4888
|
// dist/rules/no-script-text.js
|
|
4889
|
+
var import_utils54 = require("@typescript-eslint/utils");
|
|
4831
4890
|
var isScriptTextPropertyName = (propertyName) => propertyName === "innerText" || propertyName === "text" || propertyName === "textContent";
|
|
4832
4891
|
var rule61 = createRule({
|
|
4833
4892
|
create(context) {
|
|
4834
4893
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
4835
4894
|
return {
|
|
4836
4895
|
AssignmentExpression(node) {
|
|
4837
|
-
if (node.left.type !==
|
|
4896
|
+
if (node.left.type !== import_utils54.AST_NODE_TYPES.MemberExpression) {
|
|
4838
4897
|
return;
|
|
4839
4898
|
}
|
|
4840
4899
|
if (!isScriptTextPropertyName(getMemberPropertyName3(node.left))) {
|
|
@@ -4872,7 +4931,8 @@ var rule61 = createRule({
|
|
|
4872
4931
|
var no_script_text_default = rule61;
|
|
4873
4932
|
|
|
4874
4933
|
// dist/rules/no-service-worker-unsafe-script-url.js
|
|
4875
|
-
var
|
|
4934
|
+
var import_utils55 = require("@typescript-eslint/utils");
|
|
4935
|
+
var isJavaScriptUrl3 = (value) => /^\s*javascript\s*:/iv.test(value);
|
|
4876
4936
|
var isUnsafeServiceWorkerScriptUrl = (expression) => {
|
|
4877
4937
|
const configuredValue = getStaticStringValue(expression);
|
|
4878
4938
|
return typeof configuredValue === "string" && (isBlobUrl(configuredValue) || isDataUrl(configuredValue) || isJavaScriptUrl3(configuredValue)) || isUrlCreateObjectUrlCall(expression);
|
|
@@ -4885,7 +4945,7 @@ var rule62 = createRule({
|
|
|
4885
4945
|
return;
|
|
4886
4946
|
}
|
|
4887
4947
|
const [firstArgument] = node.arguments;
|
|
4888
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
4948
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils55.AST_NODE_TYPES.SpreadElement || !isUnsafeServiceWorkerScriptUrl(firstArgument)) {
|
|
4889
4949
|
return;
|
|
4890
4950
|
}
|
|
4891
4951
|
context.report({
|
|
@@ -4914,8 +4974,9 @@ var rule62 = createRule({
|
|
|
4914
4974
|
var no_service_worker_unsafe_script_url_default = rule62;
|
|
4915
4975
|
|
|
4916
4976
|
// dist/rules/no-set-html-unsafe.js
|
|
4977
|
+
var import_utils56 = require("@typescript-eslint/utils");
|
|
4917
4978
|
var isSetHtmlUnsafeCall = (node) => {
|
|
4918
|
-
if (node.callee.type !==
|
|
4979
|
+
if (node.callee.type !== import_utils56.AST_NODE_TYPES.MemberExpression) {
|
|
4919
4980
|
return false;
|
|
4920
4981
|
}
|
|
4921
4982
|
return getMemberPropertyName3(node.callee) === "setHTMLUnsafe";
|
|
@@ -4928,7 +4989,7 @@ var rule63 = createRule({
|
|
|
4928
4989
|
return;
|
|
4929
4990
|
}
|
|
4930
4991
|
const [firstArgument] = node.arguments;
|
|
4931
|
-
if (firstArgument !== void 0 && firstArgument.type !==
|
|
4992
|
+
if (firstArgument !== void 0 && firstArgument.type !== import_utils56.AST_NODE_TYPES.SpreadElement && getStaticStringValue(firstArgument) === "") {
|
|
4932
4993
|
return;
|
|
4933
4994
|
}
|
|
4934
4995
|
context.report({
|
|
@@ -4957,50 +5018,51 @@ var rule63 = createRule({
|
|
|
4957
5018
|
var no_set_html_unsafe_default = rule63;
|
|
4958
5019
|
|
|
4959
5020
|
// dist/rules/no-trusted-types-policy-pass-through.js
|
|
5021
|
+
var import_utils57 = require("@typescript-eslint/utils");
|
|
4960
5022
|
var import_ts_extras33 = require("ts-extras");
|
|
4961
|
-
var isExpressionNode5 = (node) => node.type !==
|
|
5023
|
+
var isExpressionNode5 = (node) => node.type !== import_utils57.AST_NODE_TYPES.ArrayPattern && node.type !== import_utils57.AST_NODE_TYPES.AssignmentPattern && node.type !== import_utils57.AST_NODE_TYPES.ObjectPattern;
|
|
4962
5024
|
var POLICY_FACTORY_NAMES = /* @__PURE__ */ new Set([
|
|
4963
5025
|
"createHTML",
|
|
4964
5026
|
"createScript",
|
|
4965
5027
|
"createScriptURL"
|
|
4966
5028
|
]);
|
|
4967
|
-
var isFunctionExpression8 = (expression) => expression.type ===
|
|
5029
|
+
var isFunctionExpression8 = (expression) => expression.type === import_utils57.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils57.AST_NODE_TYPES.FunctionExpression;
|
|
4968
5030
|
var unwrapTransparentExpression = (expression) => {
|
|
4969
|
-
if (expression.type ===
|
|
5031
|
+
if (expression.type === import_utils57.AST_NODE_TYPES.TSAsExpression || expression.type === import_utils57.AST_NODE_TYPES.TSTypeAssertion) {
|
|
4970
5032
|
return unwrapTransparentExpression(expression.expression);
|
|
4971
5033
|
}
|
|
4972
5034
|
return expression;
|
|
4973
5035
|
};
|
|
4974
5036
|
var isPassThroughFactory = (factoryNode) => {
|
|
4975
5037
|
const [firstParameter] = factoryNode.params;
|
|
4976
|
-
if (firstParameter?.type !==
|
|
5038
|
+
if (firstParameter?.type !== import_utils57.AST_NODE_TYPES.Identifier) {
|
|
4977
5039
|
return false;
|
|
4978
5040
|
}
|
|
4979
|
-
if (factoryNode.body.type !==
|
|
5041
|
+
if (factoryNode.body.type !== import_utils57.AST_NODE_TYPES.BlockStatement) {
|
|
4980
5042
|
const expressionBody = unwrapTransparentExpression(factoryNode.body);
|
|
4981
|
-
return expressionBody.type ===
|
|
5043
|
+
return expressionBody.type === import_utils57.AST_NODE_TYPES.Identifier && expressionBody.name === firstParameter.name;
|
|
4982
5044
|
}
|
|
4983
5045
|
if (factoryNode.body.body.length !== 1) {
|
|
4984
5046
|
return false;
|
|
4985
5047
|
}
|
|
4986
5048
|
const onlyStatement = (0, import_ts_extras33.arrayFirst)(factoryNode.body.body);
|
|
4987
|
-
if (onlyStatement?.type !==
|
|
5049
|
+
if (onlyStatement?.type !== import_utils57.AST_NODE_TYPES.ReturnStatement || onlyStatement.argument === null) {
|
|
4988
5050
|
return false;
|
|
4989
5051
|
}
|
|
4990
5052
|
const returnedExpression = unwrapTransparentExpression(onlyStatement.argument);
|
|
4991
|
-
return returnedExpression.type ===
|
|
5053
|
+
return returnedExpression.type === import_utils57.AST_NODE_TYPES.Identifier && returnedExpression.name === firstParameter.name;
|
|
4992
5054
|
};
|
|
4993
5055
|
var isTrustedTypesCreatePolicyCall = (node) => {
|
|
4994
|
-
if (node.callee.type !==
|
|
5056
|
+
if (node.callee.type !== import_utils57.AST_NODE_TYPES.MemberExpression) {
|
|
4995
5057
|
return false;
|
|
4996
5058
|
}
|
|
4997
5059
|
if (getMemberPropertyName3(node.callee) !== "createPolicy") {
|
|
4998
5060
|
return false;
|
|
4999
5061
|
}
|
|
5000
|
-
if (node.callee.object.type ===
|
|
5062
|
+
if (node.callee.object.type === import_utils57.AST_NODE_TYPES.Identifier) {
|
|
5001
5063
|
return node.callee.object.name === "trustedTypes";
|
|
5002
5064
|
}
|
|
5003
|
-
if (node.callee.object.type !==
|
|
5065
|
+
if (node.callee.object.type !== import_utils57.AST_NODE_TYPES.MemberExpression) {
|
|
5004
5066
|
return false;
|
|
5005
5067
|
}
|
|
5006
5068
|
return getMemberPropertyName3(node.callee.object) === "trustedTypes";
|
|
@@ -5013,11 +5075,11 @@ var rule64 = createRule({
|
|
|
5013
5075
|
return;
|
|
5014
5076
|
}
|
|
5015
5077
|
const [, secondArgument] = node.arguments;
|
|
5016
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
5078
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils57.AST_NODE_TYPES.SpreadElement || secondArgument.type !== import_utils57.AST_NODE_TYPES.ObjectExpression) {
|
|
5017
5079
|
return;
|
|
5018
5080
|
}
|
|
5019
5081
|
for (const propertyNode of secondArgument.properties) {
|
|
5020
|
-
if (propertyNode.type !==
|
|
5082
|
+
if (propertyNode.type !== import_utils57.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
5021
5083
|
continue;
|
|
5022
5084
|
}
|
|
5023
5085
|
const propertyName = getPropertyName(propertyNode);
|
|
@@ -5054,20 +5116,21 @@ var rule64 = createRule({
|
|
|
5054
5116
|
var no_trusted_types_policy_pass_through_default = rule64;
|
|
5055
5117
|
|
|
5056
5118
|
// dist/rules/no-unsafe-alloc.js
|
|
5119
|
+
var import_utils58 = require("@typescript-eslint/utils");
|
|
5057
5120
|
var rule65 = createRule({
|
|
5058
5121
|
create(context) {
|
|
5059
5122
|
return {
|
|
5060
5123
|
"MemberExpression[object.name='Buffer'][property.name=/^(?:allocUnsafe|allocUnsafeSlow)$/]"(node) {
|
|
5061
5124
|
const parentNode = node.parent;
|
|
5062
|
-
if (parentNode
|
|
5125
|
+
if (parentNode.type === import_utils58.AST_NODE_TYPES.CallExpression && parentNode.arguments.length === 1) {
|
|
5063
5126
|
const [firstArgument] = parentNode.arguments;
|
|
5064
|
-
if (firstArgument?.type ===
|
|
5127
|
+
if (firstArgument?.type === import_utils58.AST_NODE_TYPES.Literal && (firstArgument.value === 0 || firstArgument.value === "0")) {
|
|
5065
5128
|
return;
|
|
5066
5129
|
}
|
|
5067
5130
|
}
|
|
5068
5131
|
context.report({
|
|
5069
5132
|
fix(fixer) {
|
|
5070
|
-
if (node.computed || node.property.type !==
|
|
5133
|
+
if (node.computed || node.property.type !== import_utils58.AST_NODE_TYPES.Identifier) {
|
|
5071
5134
|
return null;
|
|
5072
5135
|
}
|
|
5073
5136
|
return fixer.replaceText(node.property, "alloc");
|
|
@@ -5098,6 +5161,7 @@ var rule65 = createRule({
|
|
|
5098
5161
|
var no_unsafe_alloc_default = rule65;
|
|
5099
5162
|
|
|
5100
5163
|
// dist/rules/no-unsafe-cast-to-trusted-types.js
|
|
5164
|
+
var import_utils59 = require("@typescript-eslint/utils");
|
|
5101
5165
|
var import_ts_extras34 = require("ts-extras");
|
|
5102
5166
|
var TRUSTED_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
5103
5167
|
"TrustedHTML",
|
|
@@ -5105,7 +5169,7 @@ var TRUSTED_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
|
5105
5169
|
"TrustedScriptURL"
|
|
5106
5170
|
]);
|
|
5107
5171
|
var getTypeName = (node) => {
|
|
5108
|
-
if (node.type ===
|
|
5172
|
+
if (node.type === import_utils59.AST_NODE_TYPES.TSTypeReference && node.typeName.type === import_utils59.AST_NODE_TYPES.Identifier) {
|
|
5109
5173
|
return node.typeName.name;
|
|
5110
5174
|
}
|
|
5111
5175
|
return void 0;
|
|
@@ -5115,13 +5179,13 @@ var isTrustedTypeNode = (node) => {
|
|
|
5115
5179
|
return (0, import_ts_extras34.isDefined)(typeName) && (0, import_ts_extras34.setHas)(TRUSTED_TYPE_NAMES, typeName);
|
|
5116
5180
|
};
|
|
5117
5181
|
var getExpressionCalleeName = (expression) => {
|
|
5118
|
-
if (expression.type !==
|
|
5182
|
+
if (expression.type !== import_utils59.AST_NODE_TYPES.CallExpression) {
|
|
5119
5183
|
return void 0;
|
|
5120
5184
|
}
|
|
5121
|
-
if (expression.callee.type ===
|
|
5185
|
+
if (expression.callee.type === import_utils59.AST_NODE_TYPES.Identifier) {
|
|
5122
5186
|
return expression.callee.name;
|
|
5123
5187
|
}
|
|
5124
|
-
if (expression.callee.type ===
|
|
5188
|
+
if (expression.callee.type === import_utils59.AST_NODE_TYPES.MemberExpression && !expression.callee.computed && expression.callee.property.type === import_utils59.AST_NODE_TYPES.Identifier) {
|
|
5125
5189
|
return expression.callee.property.name;
|
|
5126
5190
|
}
|
|
5127
5191
|
return void 0;
|
|
@@ -5131,7 +5195,7 @@ var isKnownTrustedFactoryCall = (expression) => {
|
|
|
5131
5195
|
if (!(0, import_ts_extras34.isDefined)(calleeName)) {
|
|
5132
5196
|
return false;
|
|
5133
5197
|
}
|
|
5134
|
-
return /sanitize|createhtml|createscripturl|createscript|trusted/
|
|
5198
|
+
return /sanitize|createhtml|createscripturl|createscript|trusted/v.test(calleeName.toLowerCase());
|
|
5135
5199
|
};
|
|
5136
5200
|
var rule66 = createRule({
|
|
5137
5201
|
create(context) {
|
|
@@ -5181,12 +5245,13 @@ var rule66 = createRule({
|
|
|
5181
5245
|
var no_unsafe_cast_to_trusted_types_default = rule66;
|
|
5182
5246
|
|
|
5183
5247
|
// dist/rules/no-window-open-without-noopener.js
|
|
5248
|
+
var import_utils60 = require("@typescript-eslint/utils");
|
|
5184
5249
|
var import_ts_extras35 = require("ts-extras");
|
|
5185
5250
|
var getStaticStringValue7 = (node) => {
|
|
5186
|
-
if (node.type ===
|
|
5251
|
+
if (node.type === import_utils60.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
5187
5252
|
return node.value;
|
|
5188
5253
|
}
|
|
5189
|
-
if (node.type ===
|
|
5254
|
+
if (node.type === import_utils60.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
5190
5255
|
const firstQuasi = (0, import_ts_extras35.arrayFirst)(node.quasis);
|
|
5191
5256
|
if (!(0, import_ts_extras35.isDefined)(firstQuasi) || typeof firstQuasi.value.cooked !== "string") {
|
|
5192
5257
|
return void 0;
|
|
@@ -5196,10 +5261,10 @@ var getStaticStringValue7 = (node) => {
|
|
|
5196
5261
|
return void 0;
|
|
5197
5262
|
};
|
|
5198
5263
|
var isWindowOpenCallee = (callee) => {
|
|
5199
|
-
if (callee.type !==
|
|
5264
|
+
if (callee.type !== import_utils60.AST_NODE_TYPES.MemberExpression || callee.computed) {
|
|
5200
5265
|
return false;
|
|
5201
5266
|
}
|
|
5202
|
-
return callee.object.type ===
|
|
5267
|
+
return callee.object.type === import_utils60.AST_NODE_TYPES.Identifier && callee.object.name === "window" && callee.property.type === import_utils60.AST_NODE_TYPES.Identifier && callee.property.name === "open";
|
|
5203
5268
|
};
|
|
5204
5269
|
var hasNoopenerToken = (features) => (0, import_ts_extras35.stringSplit)(features.toLowerCase(), ",").map((token) => token.trim()).some((token) => token === "noopener" || token.startsWith("noopener="));
|
|
5205
5270
|
var rule67 = createRule({
|
|
@@ -5210,14 +5275,14 @@ var rule67 = createRule({
|
|
|
5210
5275
|
return;
|
|
5211
5276
|
}
|
|
5212
5277
|
const [, secondArgument, thirdArgument] = node.arguments;
|
|
5213
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
5278
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils60.AST_NODE_TYPES.SpreadElement) {
|
|
5214
5279
|
return;
|
|
5215
5280
|
}
|
|
5216
5281
|
const targetValue = getStaticStringValue7(secondArgument);
|
|
5217
5282
|
if (targetValue !== "_blank") {
|
|
5218
5283
|
return;
|
|
5219
5284
|
}
|
|
5220
|
-
if (thirdArgument === void 0 || thirdArgument.type ===
|
|
5285
|
+
if (thirdArgument === void 0 || thirdArgument.type === import_utils60.AST_NODE_TYPES.SpreadElement) {
|
|
5221
5286
|
context.report({
|
|
5222
5287
|
messageId: "default",
|
|
5223
5288
|
node
|
|
@@ -5283,6 +5348,7 @@ var rule68 = createRule({
|
|
|
5283
5348
|
var no_winjs_html_unsafe_default = rule68;
|
|
5284
5349
|
|
|
5285
5350
|
// dist/rules/no-worker-blob-url.js
|
|
5351
|
+
var import_utils61 = require("@typescript-eslint/utils");
|
|
5286
5352
|
var isBlobBackedWorkerCodeExpression = (expression) => {
|
|
5287
5353
|
const configuredValue = getStaticStringValue(expression);
|
|
5288
5354
|
return typeof configuredValue === "string" && isBlobUrl(configuredValue) || isUrlCreateObjectUrlCall(expression);
|
|
@@ -5295,7 +5361,7 @@ var rule69 = createRule({
|
|
|
5295
5361
|
return;
|
|
5296
5362
|
}
|
|
5297
5363
|
for (const argumentNode of node.arguments) {
|
|
5298
|
-
if (argumentNode.type ===
|
|
5364
|
+
if (argumentNode.type === import_utils61.AST_NODE_TYPES.SpreadElement || !isBlobBackedWorkerCodeExpression(argumentNode)) {
|
|
5299
5365
|
continue;
|
|
5300
5366
|
}
|
|
5301
5367
|
context.report({
|
|
@@ -5309,7 +5375,7 @@ var rule69 = createRule({
|
|
|
5309
5375
|
return;
|
|
5310
5376
|
}
|
|
5311
5377
|
const [firstArgument] = node.arguments;
|
|
5312
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
5378
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils61.AST_NODE_TYPES.SpreadElement || !isBlobBackedWorkerCodeExpression(firstArgument)) {
|
|
5313
5379
|
return;
|
|
5314
5380
|
}
|
|
5315
5381
|
context.report({
|
|
@@ -5338,6 +5404,7 @@ var rule69 = createRule({
|
|
|
5338
5404
|
var no_worker_blob_url_default = rule69;
|
|
5339
5405
|
|
|
5340
5406
|
// dist/rules/no-worker-data-url.js
|
|
5407
|
+
var import_utils62 = require("@typescript-eslint/utils");
|
|
5341
5408
|
var rule70 = createRule({
|
|
5342
5409
|
create(context) {
|
|
5343
5410
|
return {
|
|
@@ -5346,7 +5413,7 @@ var rule70 = createRule({
|
|
|
5346
5413
|
return;
|
|
5347
5414
|
}
|
|
5348
5415
|
for (const argumentNode of node.arguments) {
|
|
5349
|
-
if (argumentNode.type ===
|
|
5416
|
+
if (argumentNode.type === import_utils62.AST_NODE_TYPES.SpreadElement) {
|
|
5350
5417
|
continue;
|
|
5351
5418
|
}
|
|
5352
5419
|
const configuredValue = getStaticStringValue(argumentNode);
|
|
@@ -5364,7 +5431,7 @@ var rule70 = createRule({
|
|
|
5364
5431
|
return;
|
|
5365
5432
|
}
|
|
5366
5433
|
const [firstArgument] = node.arguments;
|
|
5367
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
5434
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils62.AST_NODE_TYPES.SpreadElement) {
|
|
5368
5435
|
return;
|
|
5369
5436
|
}
|
|
5370
5437
|
const configuredValue = getStaticStringValue(firstArgument);
|
|
@@ -5473,16 +5540,30 @@ var sdlRules = {
|
|
|
5473
5540
|
var rules_registry_default = sdlRules;
|
|
5474
5541
|
|
|
5475
5542
|
// dist/plugin.js
|
|
5476
|
-
var
|
|
5477
|
-
var
|
|
5478
|
-
var
|
|
5543
|
+
var isUnknownRecord3 = (value) => typeof value === "object" && value !== null;
|
|
5544
|
+
var isEslintPlugin = (value) => isUnknownRecord3(value);
|
|
5545
|
+
var resolvePlugin = (pluginModule) => {
|
|
5546
|
+
if (isUnknownRecord3(pluginModule)) {
|
|
5547
|
+
const moduleDefault = pluginModule["default"];
|
|
5548
|
+
if (isEslintPlugin(moduleDefault)) {
|
|
5549
|
+
return moduleDefault;
|
|
5550
|
+
}
|
|
5551
|
+
}
|
|
5552
|
+
if (isEslintPlugin(pluginModule)) {
|
|
5553
|
+
return pluginModule;
|
|
5554
|
+
}
|
|
5555
|
+
throw new TypeError("Expected an ESLint plugin module.");
|
|
5556
|
+
};
|
|
5557
|
+
var typeScriptEslintPlugin = resolvePlugin(typeScriptPluginModule);
|
|
5558
|
+
var nodeEslintPlugin = resolvePlugin(nodePluginModule);
|
|
5559
|
+
var securityEslintPlugin = resolvePlugin(securityPluginModule);
|
|
5479
5560
|
var typeScriptFiles = ["**/*.{ts,tsx,mts,cts}"];
|
|
5480
5561
|
var createNamedConfig = (name, config = {}) => ({
|
|
5481
5562
|
...config,
|
|
5482
5563
|
name
|
|
5483
5564
|
});
|
|
5484
5565
|
var createAngularConfig = (plugin) => [
|
|
5485
|
-
createNamedConfig("SDL Angular Security", {
|
|
5566
|
+
createNamedConfig("\u{1F510} SDL: Angular Security", {
|
|
5486
5567
|
plugins: {
|
|
5487
5568
|
sdl: plugin
|
|
5488
5569
|
},
|
|
@@ -5495,7 +5576,7 @@ var createAngularConfig = (plugin) => [
|
|
|
5495
5576
|
})
|
|
5496
5577
|
];
|
|
5497
5578
|
var createAngularJsConfig = (plugin) => [
|
|
5498
|
-
createNamedConfig("SDL AngularJS Security", {
|
|
5579
|
+
createNamedConfig("\u{1F510} SDL: AngularJS Security", {
|
|
5499
5580
|
plugins: {
|
|
5500
5581
|
sdl: plugin
|
|
5501
5582
|
},
|
|
@@ -5509,7 +5590,7 @@ var createAngularJsConfig = (plugin) => [
|
|
|
5509
5590
|
})
|
|
5510
5591
|
];
|
|
5511
5592
|
var createCommonConfig = (plugin) => [
|
|
5512
|
-
createNamedConfig("SDL Common Web Security", {
|
|
5593
|
+
createNamedConfig("\u{1F510} SDL: Common Web Security", {
|
|
5513
5594
|
plugins: {
|
|
5514
5595
|
sdl: plugin
|
|
5515
5596
|
},
|
|
@@ -5550,7 +5631,7 @@ var createCommonConfig = (plugin) => [
|
|
|
5550
5631
|
})
|
|
5551
5632
|
];
|
|
5552
5633
|
var createElectronConfig = (plugin) => [
|
|
5553
|
-
createNamedConfig("SDL Electron Security", {
|
|
5634
|
+
createNamedConfig("\u{1F510} SDL: Electron Security", {
|
|
5554
5635
|
plugins: {
|
|
5555
5636
|
sdl: plugin
|
|
5556
5637
|
},
|
|
@@ -5579,7 +5660,7 @@ var createElectronConfig = (plugin) => [
|
|
|
5579
5660
|
})
|
|
5580
5661
|
];
|
|
5581
5662
|
var createNodeConfig = (plugin) => [
|
|
5582
|
-
createNamedConfig("SDL Node.js Runtime Safety", {
|
|
5663
|
+
createNamedConfig("\u{1F510} SDL: Node.js Runtime Safety", {
|
|
5583
5664
|
plugins: {
|
|
5584
5665
|
n: nodeEslintPlugin
|
|
5585
5666
|
},
|
|
@@ -5587,7 +5668,7 @@ var createNodeConfig = (plugin) => [
|
|
|
5587
5668
|
"n/no-deprecated-api": "error"
|
|
5588
5669
|
}
|
|
5589
5670
|
}),
|
|
5590
|
-
createNamedConfig("SDL Node.js Security", {
|
|
5671
|
+
createNamedConfig("\u{1F510} SDL: Node.js Security", {
|
|
5591
5672
|
plugins: {
|
|
5592
5673
|
sdl: plugin
|
|
5593
5674
|
},
|
|
@@ -5608,7 +5689,7 @@ var createNodeConfig = (plugin) => [
|
|
|
5608
5689
|
})
|
|
5609
5690
|
];
|
|
5610
5691
|
var createReactConfig = (plugin) => [
|
|
5611
|
-
createNamedConfig("SDL React JSX Support", {
|
|
5692
|
+
createNamedConfig("\u{1F510} SDL: React JSX Support", {
|
|
5612
5693
|
languageOptions: {
|
|
5613
5694
|
parserOptions: {
|
|
5614
5695
|
ecmaFeatures: {
|
|
@@ -5617,14 +5698,14 @@ var createReactConfig = (plugin) => [
|
|
|
5617
5698
|
}
|
|
5618
5699
|
}
|
|
5619
5700
|
}),
|
|
5620
|
-
createNamedConfig("SDL React Security", {
|
|
5701
|
+
createNamedConfig("\u{1F510} SDL: React Security", {
|
|
5621
5702
|
plugins: {
|
|
5622
5703
|
sdl: plugin
|
|
5623
5704
|
}
|
|
5624
5705
|
})
|
|
5625
5706
|
];
|
|
5626
5707
|
var createTypeScriptConfig = (plugin) => [
|
|
5627
|
-
createNamedConfig("SDL TypeScript Parser Support", {
|
|
5708
|
+
createNamedConfig("\u{1F510} SDL: TypeScript Parser Support", {
|
|
5628
5709
|
languageOptions: {
|
|
5629
5710
|
parserOptions: {
|
|
5630
5711
|
ecmaVersion: "latest",
|
|
@@ -5632,7 +5713,7 @@ var createTypeScriptConfig = (plugin) => [
|
|
|
5632
5713
|
}
|
|
5633
5714
|
}
|
|
5634
5715
|
}),
|
|
5635
|
-
createNamedConfig("SDL TypeScript Security", {
|
|
5716
|
+
createNamedConfig("\u{1F510} SDL: TypeScript Security", {
|
|
5636
5717
|
files: [...typeScriptFiles],
|
|
5637
5718
|
languageOptions: {
|
|
5638
5719
|
parser: import_parser.default,
|
|
@@ -5658,7 +5739,7 @@ var createTypeScriptConfig = (plugin) => [
|
|
|
5658
5739
|
})
|
|
5659
5740
|
];
|
|
5660
5741
|
var createRequiredConfig = (configs2) => [
|
|
5661
|
-
createNamedConfig("SDL Required Security Baseline"),
|
|
5742
|
+
createNamedConfig("\u{1F510} SDL: Required Security Baseline"),
|
|
5662
5743
|
...configs2.angular,
|
|
5663
5744
|
...configs2.angularjs,
|
|
5664
5745
|
...configs2.common,
|
|
@@ -5667,23 +5748,24 @@ var createRequiredConfig = (configs2) => [
|
|
|
5667
5748
|
...configs2.react
|
|
5668
5749
|
];
|
|
5669
5750
|
var createRecommendedConfig = (configs2) => [
|
|
5670
|
-
createNamedConfig("SDL Recommended Security Baseline"),
|
|
5751
|
+
createNamedConfig("\u{1F510} SDL: Recommended Security Baseline"),
|
|
5671
5752
|
...configs2.required,
|
|
5672
5753
|
...configs2.typescript,
|
|
5673
|
-
createNamedConfig("SDL Recommended Security Plugins", {
|
|
5754
|
+
createNamedConfig("\u{1F510} SDL: Recommended Security Plugins", {
|
|
5674
5755
|
plugins: {
|
|
5675
5756
|
security: securityEslintPlugin
|
|
5676
5757
|
}
|
|
5677
5758
|
})
|
|
5678
5759
|
];
|
|
5679
5760
|
var packageJsonVersion = typeof package_default.version === "string" && package_default.version.length > 0 ? package_default.version : "0.0.0";
|
|
5761
|
+
var pluginRules = rules_registry_default;
|
|
5680
5762
|
var pluginCore = {
|
|
5681
5763
|
meta: {
|
|
5682
5764
|
name: "eslint-plugin-sdl-2",
|
|
5683
5765
|
namespace: "sdl",
|
|
5684
5766
|
version: packageJsonVersion
|
|
5685
5767
|
},
|
|
5686
|
-
rules:
|
|
5768
|
+
rules: pluginRules
|
|
5687
5769
|
};
|
|
5688
5770
|
var configs = {
|
|
5689
5771
|
angular: createAngularConfig(pluginCore),
|
|
@@ -5701,7 +5783,7 @@ configs.recommended = createRecommendedConfig(configs);
|
|
|
5701
5783
|
var sdlPlugin = {
|
|
5702
5784
|
...pluginCore,
|
|
5703
5785
|
configs,
|
|
5704
|
-
rules:
|
|
5786
|
+
rules: pluginRules
|
|
5705
5787
|
};
|
|
5706
5788
|
var plugin_default = sdlPlugin;
|
|
5707
5789
|
module.exports = module.exports.default;
|