eslint-plugin-sdl-2 1.2.1 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +602 -534
- package/dist/plugin.cjs.map +4 -4
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +53 -30
- 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 +46 -67
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.4",
|
|
46
46
|
private: false,
|
|
47
47
|
description: "ESLint plugin providing SDL-focused security and platform hardening rules.",
|
|
48
48
|
keywords: [
|
|
@@ -119,7 +119,7 @@ var package_default = {
|
|
|
119
119
|
build: "tsc -p tsconfig.build.json && npm run build:types:cjs && npm run build:cjs",
|
|
120
120
|
"build:cjs": 'esbuild dist/plugin.js --bundle --format=cjs --platform=node --packages=external --sourcemap --outfile=dist/plugin.cjs --footer:js="module.exports = module.exports.default;"',
|
|
121
121
|
"build:clean": `node -e "require('node:fs').rmSync('dist',{recursive:true,force:true})"`,
|
|
122
|
-
"build:eslint-inspector": 'npx -y @eslint/config-inspector@
|
|
122
|
+
"build:eslint-inspector": 'npx -y @eslint/config-inspector@latest build --outDir "docs/docusaurus/static/eslint-inspector" --base "/eslint-plugin-SDL-2/eslint-inspector/"',
|
|
123
123
|
"build:eslint-inspector:local": "npx @eslint/config-inspector",
|
|
124
124
|
"build:stylelint-inspector": 'npx -y stylelint-config-inspector@latest build --outDir "docs/docusaurus/static/stylelint-inspector" --base "/eslint-plugin-SDL-2/stylelint-inspector/"',
|
|
125
125
|
"build:stylelint-inspector:local": "npx stylelint-config-inspector@latest",
|
|
@@ -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.
|
|
266
|
-
"eslint-plugin-n": "^
|
|
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
|
+
"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
|
},
|
|
@@ -271,8 +272,8 @@ var package_default = {
|
|
|
271
272
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
272
273
|
"@csstools/stylelint-formatter-github": "^2.0.0",
|
|
273
274
|
"@double-great/remark-lint-alt-text": "^1.1.1",
|
|
274
|
-
"@eslint/compat": "^2.0
|
|
275
|
-
"@eslint/config-inspector": "^
|
|
275
|
+
"@eslint/compat": "^2.1.0",
|
|
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,85 +281,63 @@ 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/postcss-clamp": "^4.1.3",
|
|
285
|
-
"@types/postcss-flexbugs-fixes": "^5.0.3",
|
|
286
|
-
"@types/postcss-html": "^1.5.3",
|
|
287
|
-
"@types/postcss-import": "^14.0.3",
|
|
288
|
-
"@types/postcss-inline-svg": "^5.0.4",
|
|
289
|
-
"@types/postcss-normalize": "^9.0.4",
|
|
290
|
-
"@types/postcss-reporter": "^7.0.5",
|
|
284
|
+
"@types/node": "^25.7.0",
|
|
291
285
|
"@types/sloc": "^0.2.3",
|
|
292
|
-
"@typescript-eslint/rule-tester": "^8.59.
|
|
293
|
-
"@vitest/coverage-v8": "^4.1.
|
|
294
|
-
"@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",
|
|
295
289
|
actionlint: "^2.0.6",
|
|
296
290
|
"all-contributors-cli": "^6.26.1",
|
|
297
291
|
"cognitive-complexity-ts": "^0.8.1",
|
|
298
|
-
commitlint: "^
|
|
292
|
+
commitlint: "^21.0.1",
|
|
299
293
|
"commitlint-config-gitmoji": "^2.3.1",
|
|
300
294
|
"cross-env": "^10.1.0",
|
|
301
|
-
depcheck: "^1.4.7",
|
|
302
295
|
"detect-secrets": "^1.0.6",
|
|
303
296
|
eslint: "^10.3.0",
|
|
304
|
-
"eslint-config-nick2bad4u": "^1.0.
|
|
297
|
+
"eslint-config-nick2bad4u": "^1.0.16",
|
|
305
298
|
"eslint-formatter-unix": "^9.0.1",
|
|
306
299
|
"eslint-rule-benchmark": "^0.8.0",
|
|
307
|
-
"fast-check": "^4.
|
|
300
|
+
"fast-check": "^4.8.0",
|
|
308
301
|
"git-cliff": "^2.13.1",
|
|
309
302
|
"gitleaks-secret-scanner": "^2.1.1",
|
|
310
303
|
htmlhint: "^1.9.2",
|
|
311
|
-
jscpd: "^4.
|
|
312
|
-
knip: "^6.
|
|
304
|
+
jscpd: "^4.1.1",
|
|
305
|
+
knip: "^6.13.1",
|
|
313
306
|
leasot: "^14.4.0",
|
|
314
307
|
madge: "^8.0.0",
|
|
315
308
|
"markdown-link-check": "^3.14.2",
|
|
316
|
-
"npm-check-updates": "^22.
|
|
309
|
+
"npm-check-updates": "^22.2.0",
|
|
317
310
|
"npm-package-json-lint": "^10.4.0",
|
|
318
311
|
picocolors: "^1.1.1",
|
|
319
|
-
postcss: "^8.5.13",
|
|
320
|
-
"postcss-assets": "^6.0.0",
|
|
321
|
-
"postcss-clamp": "^4.1.0",
|
|
322
|
-
"postcss-combine-duplicated-selectors": "^10.0.3",
|
|
323
|
-
"postcss-flexbugs-fixes": "^5.0.2",
|
|
324
|
-
"postcss-import": "^16.1.1",
|
|
325
|
-
"postcss-inline-svg": "^6.0.0",
|
|
326
|
-
"postcss-logical": "^9.0.0",
|
|
327
|
-
"postcss-normalize": "^13.0.1",
|
|
328
|
-
"postcss-reporter": "^7.1.0",
|
|
329
|
-
"postcss-round-subpixels": "^2.0.0",
|
|
330
|
-
"postcss-sort-media-queries": "^6.5.0",
|
|
331
|
-
"postcss-viewport-height-correction": "^1.1.1",
|
|
332
312
|
prettier: "^3.8.3",
|
|
333
|
-
"prettier-config-nick2bad4u": "^1.0.
|
|
334
|
-
publint: "^0.3.
|
|
313
|
+
"prettier-config-nick2bad4u": "^1.0.12",
|
|
314
|
+
publint: "^0.3.21",
|
|
335
315
|
"rehype-katex": "^7.0.1",
|
|
336
316
|
remark: "^15.0.1",
|
|
337
317
|
"remark-cli": "^12.0.1",
|
|
338
318
|
"remark-config-nick2bad4u": "^1.0.1",
|
|
339
|
-
|
|
340
|
-
secretlint: "^
|
|
341
|
-
"secretlint-config-nick2bad4u": "^1.0.3",
|
|
319
|
+
secretlint: "^13.0.0",
|
|
320
|
+
"secretlint-config-nick2bad4u": "^1.0.4",
|
|
342
321
|
sloc: "^0.3.2",
|
|
343
322
|
"sort-package-json": "^3.6.1",
|
|
344
|
-
stylelint: "^17.
|
|
345
|
-
"stylelint-config-nick2bad4u": "^1.0.
|
|
323
|
+
stylelint: "^17.11.0",
|
|
324
|
+
"stylelint-config-nick2bad4u": "^1.0.10",
|
|
346
325
|
"ts-unused-exports": "^11.0.1",
|
|
347
326
|
typedoc: "^0.28.19",
|
|
348
327
|
typescript: "^6.0.3",
|
|
349
|
-
"typescript-eslint": "^8.59.
|
|
328
|
+
"typescript-eslint": "^8.59.3",
|
|
350
329
|
typesync: "^0.14.3",
|
|
351
330
|
vfile: "^6.0.3",
|
|
352
|
-
vite: "^8.0.
|
|
331
|
+
vite: "^8.0.12",
|
|
353
332
|
"vite-tsconfig-paths": "^6.1.1",
|
|
354
|
-
vitest: "^4.1.
|
|
333
|
+
vitest: "^4.1.6",
|
|
355
334
|
"yamllint-js": "^0.2.4"
|
|
356
335
|
},
|
|
357
336
|
peerDependencies: {
|
|
358
337
|
eslint: "^9.0.0 || ^10.3.0",
|
|
359
338
|
typescript: ">=5.0.0"
|
|
360
339
|
},
|
|
361
|
-
packageManager: "npm@11.
|
|
340
|
+
packageManager: "npm@11.14.1",
|
|
362
341
|
engines: {
|
|
363
342
|
node: ">=20.19.0"
|
|
364
343
|
},
|
|
@@ -384,7 +363,11 @@ var package_default = {
|
|
|
384
363
|
// dist/_internal/create-rule.js
|
|
385
364
|
var import_utils = require("@typescript-eslint/utils");
|
|
386
365
|
var docsBaseUrl = "https://nick2bad4u.github.io/eslint-plugin-SDL-2/docs/rules";
|
|
387
|
-
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;
|
|
388
371
|
|
|
389
372
|
// dist/rules/no-angular-bypass-sanitizer.js
|
|
390
373
|
var rule = createRule({
|
|
@@ -417,11 +400,12 @@ var rule = createRule({
|
|
|
417
400
|
var no_angular_bypass_sanitizer_default = rule;
|
|
418
401
|
|
|
419
402
|
// dist/rules/no-angular-bypass-security-trust-html.js
|
|
403
|
+
var import_utils2 = require("@typescript-eslint/utils");
|
|
420
404
|
var getMemberPropertyName = (memberExpression) => {
|
|
421
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
405
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils2.AST_NODE_TYPES.Identifier) {
|
|
422
406
|
return memberExpression.property.name;
|
|
423
407
|
}
|
|
424
|
-
if (memberExpression.property.type ===
|
|
408
|
+
if (memberExpression.property.type === import_utils2.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
425
409
|
return memberExpression.property.value;
|
|
426
410
|
}
|
|
427
411
|
return void 0;
|
|
@@ -430,7 +414,7 @@ var rule2 = createRule({
|
|
|
430
414
|
create(context) {
|
|
431
415
|
return {
|
|
432
416
|
CallExpression(node) {
|
|
433
|
-
if (node.callee.type !==
|
|
417
|
+
if (node.callee.type !== import_utils2.AST_NODE_TYPES.MemberExpression) {
|
|
434
418
|
return;
|
|
435
419
|
}
|
|
436
420
|
if (getMemberPropertyName(node.callee) !== "bypassSecurityTrustHtml") {
|
|
@@ -463,7 +447,7 @@ var no_angular_bypass_security_trust_html_default = rule2;
|
|
|
463
447
|
|
|
464
448
|
// dist/rules/no-angular-innerhtml-binding.js
|
|
465
449
|
var import_ts_extras = require("ts-extras");
|
|
466
|
-
var hasInnerHtmlBindingPattern = (text) => /\[\s*innerhtml\s*\]\s*=/
|
|
450
|
+
var hasInnerHtmlBindingPattern = (text) => /\[\s*innerhtml\s*\]\s*=/iv.test(text);
|
|
467
451
|
var rule3 = createRule({
|
|
468
452
|
create(context) {
|
|
469
453
|
return {
|
|
@@ -546,9 +530,10 @@ var rule4 = createRule({
|
|
|
546
530
|
var no_angular_sanitization_trusted_urls_default = rule4;
|
|
547
531
|
|
|
548
532
|
// dist/rules/no-angularjs-bypass-sce.js
|
|
533
|
+
var import_utils3 = require("@typescript-eslint/utils");
|
|
549
534
|
var import_ts_extras2 = require("ts-extras");
|
|
550
|
-
var isEmptyLiteral = (argument) => argument?.type ===
|
|
551
|
-
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)([
|
|
552
537
|
1,
|
|
553
538
|
"1",
|
|
554
539
|
true,
|
|
@@ -572,7 +557,7 @@ var noAngularjsBypassSceRule = createRule({
|
|
|
572
557
|
};
|
|
573
558
|
return {
|
|
574
559
|
"CallExpression[callee.type='MemberExpression'][callee.object.type='Identifier'][callee.object.name='$sce'][callee.property.type='Identifier']"(node) {
|
|
575
|
-
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) {
|
|
576
561
|
return;
|
|
577
562
|
}
|
|
578
563
|
if (!isBypassSceMethod(node.callee.property.name)) {
|
|
@@ -619,8 +604,9 @@ var noAngularjsBypassSceRule = createRule({
|
|
|
619
604
|
var no_angularjs_bypass_sce_default = noAngularjsBypassSceRule;
|
|
620
605
|
|
|
621
606
|
// dist/rules/no-angularjs-enable-svg.js
|
|
607
|
+
var import_utils4 = require("@typescript-eslint/utils");
|
|
622
608
|
var import_ts_extras3 = require("ts-extras");
|
|
623
|
-
var isExplicitlyDisabledSvgLiteral = (argument) => argument?.type ===
|
|
609
|
+
var isExplicitlyDisabledSvgLiteral = (argument) => argument?.type === import_utils4.AST_NODE_TYPES.Literal && (0, import_ts_extras3.arrayIncludes)([
|
|
624
610
|
0,
|
|
625
611
|
"0",
|
|
626
612
|
false,
|
|
@@ -664,8 +650,8 @@ var no_angularjs_enable_svg_default = rule5;
|
|
|
664
650
|
|
|
665
651
|
// dist/rules/no-angularjs-ng-bind-html-without-sanitize.js
|
|
666
652
|
var import_ts_extras4 = require("ts-extras");
|
|
667
|
-
var hasNgBindHtmlPattern = (text) => /\bng-bind-html\b/
|
|
668
|
-
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);
|
|
669
655
|
var rule6 = createRule({
|
|
670
656
|
create(context) {
|
|
671
657
|
return {
|
|
@@ -754,11 +740,12 @@ var rule7 = createRule({
|
|
|
754
740
|
var no_angularjs_sanitization_whitelist_default = rule7;
|
|
755
741
|
|
|
756
742
|
// dist/rules/no-angularjs-sce-resource-url-wildcard.js
|
|
743
|
+
var import_utils5 = require("@typescript-eslint/utils");
|
|
757
744
|
var getMemberPropertyName2 = (memberExpression) => {
|
|
758
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
745
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils5.AST_NODE_TYPES.Identifier) {
|
|
759
746
|
return memberExpression.property.name;
|
|
760
747
|
}
|
|
761
|
-
if (memberExpression.property.type ===
|
|
748
|
+
if (memberExpression.property.type === import_utils5.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
762
749
|
return memberExpression.property.value;
|
|
763
750
|
}
|
|
764
751
|
return void 0;
|
|
@@ -768,18 +755,18 @@ var rule8 = createRule({
|
|
|
768
755
|
create(context) {
|
|
769
756
|
return {
|
|
770
757
|
CallExpression(node) {
|
|
771
|
-
if (node.callee.type !==
|
|
758
|
+
if (node.callee.type !== import_utils5.AST_NODE_TYPES.MemberExpression) {
|
|
772
759
|
return;
|
|
773
760
|
}
|
|
774
761
|
if (getMemberPropertyName2(node.callee) !== "resourceUrlWhitelist") {
|
|
775
762
|
return;
|
|
776
763
|
}
|
|
777
764
|
const [firstArgument] = node.arguments;
|
|
778
|
-
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) {
|
|
779
766
|
return;
|
|
780
767
|
}
|
|
781
768
|
for (const elementNode of firstArgument.elements) {
|
|
782
|
-
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") {
|
|
783
770
|
continue;
|
|
784
771
|
}
|
|
785
772
|
if (!isWildcardValue(elementNode.value)) {
|
|
@@ -812,15 +799,17 @@ var rule8 = createRule({
|
|
|
812
799
|
var no_angularjs_sce_resource_url_wildcard_default = rule8;
|
|
813
800
|
|
|
814
801
|
// dist/rules/no-child-process-exec.js
|
|
802
|
+
var import_utils7 = require("@typescript-eslint/utils");
|
|
815
803
|
var import_ts_extras6 = require("ts-extras");
|
|
816
804
|
|
|
817
805
|
// dist/_internal/estree-utils.js
|
|
806
|
+
var import_utils6 = require("@typescript-eslint/utils");
|
|
818
807
|
var import_ts_extras5 = require("ts-extras");
|
|
819
808
|
var getMemberPropertyName3 = (memberExpression) => {
|
|
820
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
809
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils6.AST_NODE_TYPES.Identifier) {
|
|
821
810
|
return memberExpression.property.name;
|
|
822
811
|
}
|
|
823
|
-
if (memberExpression.property.type ===
|
|
812
|
+
if (memberExpression.property.type === import_utils6.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
824
813
|
return memberExpression.property.value;
|
|
825
814
|
}
|
|
826
815
|
return void 0;
|
|
@@ -829,19 +818,16 @@ var getPropertyName = (property) => {
|
|
|
829
818
|
if (property.computed) {
|
|
830
819
|
return void 0;
|
|
831
820
|
}
|
|
832
|
-
if (property.key.type ===
|
|
821
|
+
if (property.key.type === import_utils6.AST_NODE_TYPES.Identifier) {
|
|
833
822
|
return property.key.name;
|
|
834
823
|
}
|
|
835
|
-
|
|
836
|
-
return property.key.value;
|
|
837
|
-
}
|
|
838
|
-
return void 0;
|
|
824
|
+
return typeof property.key.value === "string" ? property.key.value : void 0;
|
|
839
825
|
};
|
|
840
826
|
var getStaticStringValue = (node) => {
|
|
841
|
-
if (node.type ===
|
|
827
|
+
if (node.type === import_utils6.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
842
828
|
return node.value;
|
|
843
829
|
}
|
|
844
|
-
if (node.type ===
|
|
830
|
+
if (node.type === import_utils6.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
845
831
|
return (0, import_ts_extras5.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
846
832
|
}
|
|
847
833
|
return void 0;
|
|
@@ -850,16 +836,16 @@ var getStaticJsxAttributeStringValue = (attributeValue) => {
|
|
|
850
836
|
if (attributeValue === null) {
|
|
851
837
|
return void 0;
|
|
852
838
|
}
|
|
853
|
-
if (attributeValue.type ===
|
|
839
|
+
if (attributeValue.type === import_utils6.AST_NODE_TYPES.Literal && typeof attributeValue.value === "string") {
|
|
854
840
|
return attributeValue.value;
|
|
855
841
|
}
|
|
856
|
-
if (attributeValue.type !==
|
|
842
|
+
if (attributeValue.type !== import_utils6.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
857
843
|
return void 0;
|
|
858
844
|
}
|
|
859
|
-
if (attributeValue.expression.type ===
|
|
845
|
+
if (attributeValue.expression.type === import_utils6.AST_NODE_TYPES.Literal && typeof attributeValue.expression.value === "string") {
|
|
860
846
|
return attributeValue.expression.value;
|
|
861
847
|
}
|
|
862
|
-
if (attributeValue.expression.type ===
|
|
848
|
+
if (attributeValue.expression.type === import_utils6.AST_NODE_TYPES.TemplateLiteral && attributeValue.expression.expressions.length === 0) {
|
|
863
849
|
return (0, import_ts_extras5.arrayFirst)(attributeValue.expression.quasis)?.value.cooked ?? void 0;
|
|
864
850
|
}
|
|
865
851
|
return void 0;
|
|
@@ -874,17 +860,17 @@ var DISALLOWED_CHILD_PROCESS_METHOD_NAMES = /* @__PURE__ */ new Set(["exec", "ex
|
|
|
874
860
|
var isDisallowedChildProcessMethodName = (value) => (0, import_ts_extras6.isDefined)(value) && (0, import_ts_extras6.setHas)(DISALLOWED_CHILD_PROCESS_METHOD_NAMES, value);
|
|
875
861
|
var isChildProcessModuleSource = (value) => (0, import_ts_extras6.setHas)(CHILD_PROCESS_MODULE_NAMES, value);
|
|
876
862
|
var isRequireCallFromChildProcess = (expression) => {
|
|
877
|
-
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") {
|
|
878
864
|
return false;
|
|
879
865
|
}
|
|
880
866
|
const [firstArgument] = expression.arguments;
|
|
881
|
-
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);
|
|
882
868
|
};
|
|
883
869
|
var getPatternIdentifier = (pattern) => {
|
|
884
|
-
if (pattern.type ===
|
|
870
|
+
if (pattern.type === import_utils7.AST_NODE_TYPES.Identifier) {
|
|
885
871
|
return pattern;
|
|
886
872
|
}
|
|
887
|
-
if (pattern.type ===
|
|
873
|
+
if (pattern.type === import_utils7.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils7.AST_NODE_TYPES.Identifier) {
|
|
888
874
|
return pattern.left;
|
|
889
875
|
}
|
|
890
876
|
return void 0;
|
|
@@ -895,7 +881,7 @@ var rule9 = createRule({
|
|
|
895
881
|
const childProcessNamespaceBindingNames = /* @__PURE__ */ new Set();
|
|
896
882
|
return {
|
|
897
883
|
CallExpression(node) {
|
|
898
|
-
if (node.callee.type ===
|
|
884
|
+
if (node.callee.type === import_utils7.AST_NODE_TYPES.Identifier) {
|
|
899
885
|
if (!(0, import_ts_extras6.setHas)(childProcessExecBindingNames, node.callee.name)) {
|
|
900
886
|
return;
|
|
901
887
|
}
|
|
@@ -905,21 +891,21 @@ var rule9 = createRule({
|
|
|
905
891
|
});
|
|
906
892
|
return;
|
|
907
893
|
}
|
|
908
|
-
if (node.callee.type !==
|
|
894
|
+
if (node.callee.type !== import_utils7.AST_NODE_TYPES.MemberExpression) {
|
|
909
895
|
return;
|
|
910
896
|
}
|
|
911
897
|
const methodName = getMemberPropertyName3(node.callee);
|
|
912
898
|
if (!isDisallowedChildProcessMethodName(methodName)) {
|
|
913
899
|
return;
|
|
914
900
|
}
|
|
915
|
-
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)) {
|
|
916
902
|
context.report({
|
|
917
903
|
messageId: "default",
|
|
918
904
|
node: node.callee
|
|
919
905
|
});
|
|
920
906
|
return;
|
|
921
907
|
}
|
|
922
|
-
if (node.callee.object.type ===
|
|
908
|
+
if (node.callee.object.type === import_utils7.AST_NODE_TYPES.CallExpression && isRequireCallFromChildProcess(node.callee.object)) {
|
|
923
909
|
context.report({
|
|
924
910
|
messageId: "default",
|
|
925
911
|
node: node.callee
|
|
@@ -931,11 +917,11 @@ var rule9 = createRule({
|
|
|
931
917
|
return;
|
|
932
918
|
}
|
|
933
919
|
for (const specifierNode of node.specifiers) {
|
|
934
|
-
if (specifierNode.type ===
|
|
920
|
+
if (specifierNode.type === import_utils7.AST_NODE_TYPES.ImportDefaultSpecifier || specifierNode.type === import_utils7.AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
935
921
|
childProcessNamespaceBindingNames.add(specifierNode.local.name);
|
|
936
922
|
continue;
|
|
937
923
|
}
|
|
938
|
-
const importedName = specifierNode.imported.type ===
|
|
924
|
+
const importedName = specifierNode.imported.type === import_utils7.AST_NODE_TYPES.Identifier ? specifierNode.imported.name : specifierNode.imported.value;
|
|
939
925
|
if (!isDisallowedChildProcessMethodName(importedName)) {
|
|
940
926
|
continue;
|
|
941
927
|
}
|
|
@@ -946,15 +932,15 @@ var rule9 = createRule({
|
|
|
946
932
|
if (!isRequireCallFromChildProcess(node.init)) {
|
|
947
933
|
return;
|
|
948
934
|
}
|
|
949
|
-
if (node.id.type ===
|
|
935
|
+
if (node.id.type === import_utils7.AST_NODE_TYPES.Identifier) {
|
|
950
936
|
childProcessNamespaceBindingNames.add(node.id.name);
|
|
951
937
|
return;
|
|
952
938
|
}
|
|
953
|
-
if (node.id.type !==
|
|
939
|
+
if (node.id.type !== import_utils7.AST_NODE_TYPES.ObjectPattern) {
|
|
954
940
|
return;
|
|
955
941
|
}
|
|
956
942
|
for (const propertyNode of node.id.properties) {
|
|
957
|
-
if (propertyNode.type !==
|
|
943
|
+
if (propertyNode.type !== import_utils7.AST_NODE_TYPES.Property || propertyNode.computed) {
|
|
958
944
|
continue;
|
|
959
945
|
}
|
|
960
946
|
const importedName = getPropertyName(propertyNode);
|
|
@@ -989,25 +975,26 @@ var rule9 = createRule({
|
|
|
989
975
|
var no_child_process_exec_default = rule9;
|
|
990
976
|
|
|
991
977
|
// dist/rules/no-child-process-shell-true.js
|
|
978
|
+
var import_utils8 = require("@typescript-eslint/utils");
|
|
992
979
|
var getMemberPropertyName4 = (memberExpression) => {
|
|
993
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
980
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils8.AST_NODE_TYPES.Identifier) {
|
|
994
981
|
return memberExpression.property.name;
|
|
995
982
|
}
|
|
996
|
-
if (memberExpression.property.type ===
|
|
983
|
+
if (memberExpression.property.type === import_utils8.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
997
984
|
return memberExpression.property.value;
|
|
998
985
|
}
|
|
999
986
|
return void 0;
|
|
1000
987
|
};
|
|
1001
|
-
var isTruthyLiteral = (node) => node.type ===
|
|
988
|
+
var isTruthyLiteral = (node) => node.type === import_utils8.AST_NODE_TYPES.Literal && node.value === true;
|
|
1002
989
|
var hasShellTrueOption = (optionsNode) => {
|
|
1003
|
-
if (optionsNode.type !==
|
|
990
|
+
if (optionsNode.type !== import_utils8.AST_NODE_TYPES.ObjectExpression) {
|
|
1004
991
|
return false;
|
|
1005
992
|
}
|
|
1006
993
|
for (const propertyNode of optionsNode.properties) {
|
|
1007
|
-
if (propertyNode.type !==
|
|
994
|
+
if (propertyNode.type !== import_utils8.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
1008
995
|
continue;
|
|
1009
996
|
}
|
|
1010
|
-
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;
|
|
1011
998
|
if (keyName !== "shell") {
|
|
1012
999
|
continue;
|
|
1013
1000
|
}
|
|
@@ -1018,10 +1005,10 @@ var hasShellTrueOption = (optionsNode) => {
|
|
|
1018
1005
|
return false;
|
|
1019
1006
|
};
|
|
1020
1007
|
var isTargetChildProcessMethod = (node) => {
|
|
1021
|
-
if (node.callee.type ===
|
|
1008
|
+
if (node.callee.type === import_utils8.AST_NODE_TYPES.Identifier) {
|
|
1022
1009
|
return node.callee.name === "spawn" || node.callee.name === "execFile";
|
|
1023
1010
|
}
|
|
1024
|
-
if (node.callee.type !==
|
|
1011
|
+
if (node.callee.type !== import_utils8.AST_NODE_TYPES.MemberExpression) {
|
|
1025
1012
|
return false;
|
|
1026
1013
|
}
|
|
1027
1014
|
const methodName = getMemberPropertyName4(node.callee);
|
|
@@ -1035,7 +1022,7 @@ var rule10 = createRule({
|
|
|
1035
1022
|
return;
|
|
1036
1023
|
}
|
|
1037
1024
|
for (const argumentNode of node.arguments) {
|
|
1038
|
-
if (argumentNode.type ===
|
|
1025
|
+
if (argumentNode.type === import_utils8.AST_NODE_TYPES.SpreadElement) {
|
|
1039
1026
|
continue;
|
|
1040
1027
|
}
|
|
1041
1028
|
if (!hasShellTrueOption(argumentNode)) {
|
|
@@ -1068,6 +1055,7 @@ var rule10 = createRule({
|
|
|
1068
1055
|
var no_child_process_shell_true_default = rule10;
|
|
1069
1056
|
|
|
1070
1057
|
// dist/_internal/ast-utils.js
|
|
1058
|
+
var import_utils9 = require("@typescript-eslint/utils");
|
|
1071
1059
|
var import_ts_extras7 = require("ts-extras");
|
|
1072
1060
|
var isUnknownRecord = (value) => typeof value === "object" && value !== null;
|
|
1073
1061
|
var isMapLike = (value) => isUnknownRecord(value) && typeof value["get"] === "function";
|
|
@@ -1109,10 +1097,10 @@ var getNodeTypeAsString = (fullTypeChecker, node, context) => {
|
|
|
1109
1097
|
};
|
|
1110
1098
|
var isWindowIdentifierName = (name) => name.toLowerCase().endsWith("window");
|
|
1111
1099
|
var getMemberPropertyName5 = (node) => {
|
|
1112
|
-
if (node.property.type ===
|
|
1100
|
+
if (node.property.type === import_utils9.AST_NODE_TYPES.Identifier) {
|
|
1113
1101
|
return node.property.name;
|
|
1114
1102
|
}
|
|
1115
|
-
if (node.property.type ===
|
|
1103
|
+
if (node.property.type === import_utils9.AST_NODE_TYPES.Literal && typeof node.property.value === "string") {
|
|
1116
1104
|
return node.property.value;
|
|
1117
1105
|
}
|
|
1118
1106
|
return void 0;
|
|
@@ -1122,29 +1110,29 @@ var isDocumentMemberReference = (node) => {
|
|
|
1122
1110
|
if (propertyName !== "document") {
|
|
1123
1111
|
return false;
|
|
1124
1112
|
}
|
|
1125
|
-
if (node.object.type ===
|
|
1113
|
+
if (node.object.type === import_utils9.AST_NODE_TYPES.Identifier) {
|
|
1126
1114
|
return isWindowIdentifierName(node.object.name);
|
|
1127
1115
|
}
|
|
1128
|
-
if (node.object.type !==
|
|
1116
|
+
if (node.object.type !== import_utils9.AST_NODE_TYPES.MemberExpression) {
|
|
1129
1117
|
return false;
|
|
1130
1118
|
}
|
|
1131
1119
|
const nestedPropertyName = getMemberPropertyName5(node.object);
|
|
1132
1120
|
if (nestedPropertyName !== "window") {
|
|
1133
1121
|
return false;
|
|
1134
1122
|
}
|
|
1135
|
-
if (node.object.object.type ===
|
|
1123
|
+
if (node.object.object.type === import_utils9.AST_NODE_TYPES.ThisExpression) {
|
|
1136
1124
|
return true;
|
|
1137
1125
|
}
|
|
1138
|
-
return node.object.object.type ===
|
|
1126
|
+
return node.object.object.type === import_utils9.AST_NODE_TYPES.Identifier && node.object.object.name === "globalThis";
|
|
1139
1127
|
};
|
|
1140
1128
|
var isDocumentObject = (node, context, fullTypeChecker) => {
|
|
1141
1129
|
if (fullTypeChecker !== void 0) {
|
|
1142
1130
|
return getNodeTypeAsString(fullTypeChecker, node, context) === "Document";
|
|
1143
1131
|
}
|
|
1144
|
-
if (node.type ===
|
|
1132
|
+
if (node.type === import_utils9.AST_NODE_TYPES.Identifier) {
|
|
1145
1133
|
return node.name === "document";
|
|
1146
1134
|
}
|
|
1147
|
-
if (node.type ===
|
|
1135
|
+
if (node.type === import_utils9.AST_NODE_TYPES.MemberExpression) {
|
|
1148
1136
|
return isDocumentMemberReference(node);
|
|
1149
1137
|
}
|
|
1150
1138
|
return false;
|
|
@@ -1185,12 +1173,13 @@ var rule11 = createRule({
|
|
|
1185
1173
|
var no_cookies_default = rule11;
|
|
1186
1174
|
|
|
1187
1175
|
// dist/rules/no-document-domain.js
|
|
1176
|
+
var import_utils10 = require("@typescript-eslint/utils");
|
|
1188
1177
|
var rule12 = createRule({
|
|
1189
1178
|
create(context) {
|
|
1190
1179
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
1191
1180
|
return {
|
|
1192
1181
|
"AssignmentExpression[operator='='][left.property.name='domain']"(node) {
|
|
1193
|
-
if (node.left.type !==
|
|
1182
|
+
if (node.left.type !== import_utils10.AST_NODE_TYPES.MemberExpression) {
|
|
1194
1183
|
return;
|
|
1195
1184
|
}
|
|
1196
1185
|
if (!isDocumentObject(node.left.object, context, fullTypeChecker)) {
|
|
@@ -1222,13 +1211,14 @@ var rule12 = createRule({
|
|
|
1222
1211
|
var no_document_domain_default = rule12;
|
|
1223
1212
|
|
|
1224
1213
|
// dist/rules/no-document-execcommand-insert-html.js
|
|
1214
|
+
var import_utils11 = require("@typescript-eslint/utils");
|
|
1225
1215
|
var isInsertHtmlCommand = (expression) => getStaticStringValue(expression)?.toLowerCase() === "inserthtml";
|
|
1226
1216
|
var rule13 = createRule({
|
|
1227
1217
|
create(context) {
|
|
1228
1218
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
1229
1219
|
return {
|
|
1230
1220
|
CallExpression(node) {
|
|
1231
|
-
if (node.callee.type !==
|
|
1221
|
+
if (node.callee.type !== import_utils11.AST_NODE_TYPES.MemberExpression) {
|
|
1232
1222
|
return;
|
|
1233
1223
|
}
|
|
1234
1224
|
if (getMemberPropertyName3(node.callee) !== "execCommand") {
|
|
@@ -1238,10 +1228,10 @@ var rule13 = createRule({
|
|
|
1238
1228
|
return;
|
|
1239
1229
|
}
|
|
1240
1230
|
const [firstArgument, , thirdArgument] = node.arguments;
|
|
1241
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
1231
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils11.AST_NODE_TYPES.SpreadElement || !isInsertHtmlCommand(firstArgument)) {
|
|
1242
1232
|
return;
|
|
1243
1233
|
}
|
|
1244
|
-
if (thirdArgument === void 0 || thirdArgument.type ===
|
|
1234
|
+
if (thirdArgument === void 0 || thirdArgument.type === import_utils11.AST_NODE_TYPES.SpreadElement || getStaticStringValue(thirdArgument) === "") {
|
|
1245
1235
|
return;
|
|
1246
1236
|
}
|
|
1247
1237
|
context.report({
|
|
@@ -1270,20 +1260,21 @@ var rule13 = createRule({
|
|
|
1270
1260
|
var no_document_execcommand_insert_html_default = rule13;
|
|
1271
1261
|
|
|
1272
1262
|
// dist/rules/no-document-parse-html-unsafe.js
|
|
1263
|
+
var import_utils12 = require("@typescript-eslint/utils");
|
|
1273
1264
|
var isDocumentConstructorReference = (expression) => {
|
|
1274
|
-
if (expression.type ===
|
|
1265
|
+
if (expression.type === import_utils12.AST_NODE_TYPES.Identifier) {
|
|
1275
1266
|
return expression.name === "Document";
|
|
1276
1267
|
}
|
|
1277
|
-
if (expression.type !==
|
|
1268
|
+
if (expression.type !== import_utils12.AST_NODE_TYPES.MemberExpression) {
|
|
1278
1269
|
return false;
|
|
1279
1270
|
}
|
|
1280
1271
|
if (getMemberPropertyName3(expression) !== "Document") {
|
|
1281
1272
|
return false;
|
|
1282
1273
|
}
|
|
1283
|
-
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");
|
|
1284
1275
|
};
|
|
1285
1276
|
var isDocumentParseHtmlUnsafeCall = (node) => {
|
|
1286
|
-
if (node.callee.type !==
|
|
1277
|
+
if (node.callee.type !== import_utils12.AST_NODE_TYPES.MemberExpression) {
|
|
1287
1278
|
return false;
|
|
1288
1279
|
}
|
|
1289
1280
|
if (getMemberPropertyName3(node.callee) !== "parseHTMLUnsafe") {
|
|
@@ -1299,7 +1290,7 @@ var rule14 = createRule({
|
|
|
1299
1290
|
return;
|
|
1300
1291
|
}
|
|
1301
1292
|
const [firstArgument] = node.arguments;
|
|
1302
|
-
if (firstArgument !== void 0 && firstArgument.type !==
|
|
1293
|
+
if (firstArgument !== void 0 && firstArgument.type !== import_utils12.AST_NODE_TYPES.SpreadElement && getStaticStringValue(firstArgument) === "") {
|
|
1303
1294
|
return;
|
|
1304
1295
|
}
|
|
1305
1296
|
context.report({
|
|
@@ -1328,12 +1319,13 @@ var rule14 = createRule({
|
|
|
1328
1319
|
var no_document_parse_html_unsafe_default = rule14;
|
|
1329
1320
|
|
|
1330
1321
|
// dist/rules/no-document-write.js
|
|
1322
|
+
var import_utils13 = require("@typescript-eslint/utils");
|
|
1331
1323
|
var rule15 = createRule({
|
|
1332
1324
|
create(context) {
|
|
1333
1325
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
1334
1326
|
return {
|
|
1335
1327
|
"CallExpression[arguments.length=1][callee.property.name=/^(?:write|writeln)$/]"(node) {
|
|
1336
|
-
if (node.callee.type !==
|
|
1328
|
+
if (node.callee.type !== import_utils13.AST_NODE_TYPES.MemberExpression) {
|
|
1337
1329
|
return;
|
|
1338
1330
|
}
|
|
1339
1331
|
if (!isDocumentObject(node.callee.object, context, fullTypeChecker)) {
|
|
@@ -1365,30 +1357,32 @@ var rule15 = createRule({
|
|
|
1365
1357
|
var no_document_write_default = rule15;
|
|
1366
1358
|
|
|
1367
1359
|
// dist/rules/no-domparser-html-without-sanitization.js
|
|
1360
|
+
var import_utils15 = require("@typescript-eslint/utils");
|
|
1368
1361
|
var import_ts_extras8 = require("ts-extras");
|
|
1369
1362
|
|
|
1370
1363
|
// dist/_internal/domparser.js
|
|
1371
|
-
var
|
|
1364
|
+
var import_utils14 = require("@typescript-eslint/utils");
|
|
1365
|
+
var SANITIZER_NAME_PATTERN = /createhtml|sanitize|trusted/v;
|
|
1372
1366
|
var isDomParserParseFromStringCall = (node) => {
|
|
1373
|
-
if (node.callee.type !==
|
|
1367
|
+
if (node.callee.type !== import_utils14.AST_NODE_TYPES.MemberExpression) {
|
|
1374
1368
|
return false;
|
|
1375
1369
|
}
|
|
1376
1370
|
if (getMemberPropertyName3(node.callee) !== "parseFromString") {
|
|
1377
1371
|
return false;
|
|
1378
1372
|
}
|
|
1379
|
-
if (node.callee.object.type !==
|
|
1373
|
+
if (node.callee.object.type !== import_utils14.AST_NODE_TYPES.NewExpression) {
|
|
1380
1374
|
return false;
|
|
1381
1375
|
}
|
|
1382
|
-
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";
|
|
1383
1377
|
};
|
|
1384
1378
|
var isSanitizedExpression = (node) => {
|
|
1385
|
-
if (node.type !==
|
|
1379
|
+
if (node.type !== import_utils14.AST_NODE_TYPES.CallExpression) {
|
|
1386
1380
|
return false;
|
|
1387
1381
|
}
|
|
1388
|
-
if (node.callee.type ===
|
|
1382
|
+
if (node.callee.type === import_utils14.AST_NODE_TYPES.Identifier) {
|
|
1389
1383
|
return SANITIZER_NAME_PATTERN.test(node.callee.name.toLowerCase());
|
|
1390
1384
|
}
|
|
1391
|
-
if (node.callee.type !==
|
|
1385
|
+
if (node.callee.type !== import_utils14.AST_NODE_TYPES.MemberExpression) {
|
|
1392
1386
|
return false;
|
|
1393
1387
|
}
|
|
1394
1388
|
const propertyName = getMemberPropertyName3(node.callee);
|
|
@@ -1410,7 +1404,7 @@ var rule16 = createRule({
|
|
|
1410
1404
|
if (!(0, import_ts_extras8.isDefined)(firstArgument) || !(0, import_ts_extras8.isDefined)(secondArgument)) {
|
|
1411
1405
|
return;
|
|
1412
1406
|
}
|
|
1413
|
-
if (firstArgument.type ===
|
|
1407
|
+
if (firstArgument.type === import_utils15.AST_NODE_TYPES.SpreadElement || secondArgument.type === import_utils15.AST_NODE_TYPES.SpreadElement) {
|
|
1414
1408
|
return;
|
|
1415
1409
|
}
|
|
1416
1410
|
const mimeTypeValue = getStaticStringValue(secondArgument);
|
|
@@ -1446,6 +1440,7 @@ var rule16 = createRule({
|
|
|
1446
1440
|
var no_domparser_html_without_sanitization_default = rule16;
|
|
1447
1441
|
|
|
1448
1442
|
// dist/rules/no-domparser-svg-without-sanitization.js
|
|
1443
|
+
var import_utils16 = require("@typescript-eslint/utils");
|
|
1449
1444
|
var import_ts_extras9 = require("ts-extras");
|
|
1450
1445
|
var rule17 = createRule({
|
|
1451
1446
|
create(context) {
|
|
@@ -1461,7 +1456,7 @@ var rule17 = createRule({
|
|
|
1461
1456
|
if (!(0, import_ts_extras9.isDefined)(firstArgument) || !(0, import_ts_extras9.isDefined)(secondArgument)) {
|
|
1462
1457
|
return;
|
|
1463
1458
|
}
|
|
1464
|
-
if (firstArgument.type ===
|
|
1459
|
+
if (firstArgument.type === import_utils16.AST_NODE_TYPES.SpreadElement || secondArgument.type === import_utils16.AST_NODE_TYPES.SpreadElement) {
|
|
1465
1460
|
return;
|
|
1466
1461
|
}
|
|
1467
1462
|
const mimeTypeValue = getStaticStringValue(secondArgument);
|
|
@@ -1497,6 +1492,7 @@ var rule17 = createRule({
|
|
|
1497
1492
|
var no_domparser_svg_without_sanitization_default = rule17;
|
|
1498
1493
|
|
|
1499
1494
|
// dist/_internal/worker-code-loading.js
|
|
1495
|
+
var import_utils17 = require("@typescript-eslint/utils");
|
|
1500
1496
|
var import_ts_extras10 = require("ts-extras");
|
|
1501
1497
|
var WORKER_CONSTRUCTOR_NAMES = /* @__PURE__ */ new Set(["SharedWorker", "Worker"]);
|
|
1502
1498
|
var GLOBAL_OBJECT_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -1505,62 +1501,62 @@ var GLOBAL_OBJECT_NAMES = /* @__PURE__ */ new Set([
|
|
|
1505
1501
|
"window"
|
|
1506
1502
|
]);
|
|
1507
1503
|
var isNavigatorObject = (value) => {
|
|
1508
|
-
if (value.type ===
|
|
1504
|
+
if (value.type === import_utils17.AST_NODE_TYPES.Identifier) {
|
|
1509
1505
|
return value.name === "navigator";
|
|
1510
1506
|
}
|
|
1511
|
-
if (value.type !==
|
|
1507
|
+
if (value.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1512
1508
|
return false;
|
|
1513
1509
|
}
|
|
1514
|
-
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);
|
|
1515
1511
|
};
|
|
1516
|
-
var isBlobUrl = (value) => /^\s*blob:/
|
|
1517
|
-
var isDataUrl = (value) => /^\s*data:/
|
|
1512
|
+
var isBlobUrl = (value) => /^\s*blob:/iv.test(value);
|
|
1513
|
+
var isDataUrl = (value) => /^\s*data:/iv.test(value);
|
|
1518
1514
|
var isWorkerConstructorName = (value) => (0, import_ts_extras10.isDefined)(value) && (0, import_ts_extras10.setHas)(WORKER_CONSTRUCTOR_NAMES, value);
|
|
1519
1515
|
var isGlobalObjectName = (value) => (0, import_ts_extras10.setHas)(GLOBAL_OBJECT_NAMES, value);
|
|
1520
|
-
var isWorkerGlobalObject = (value) => value.type ===
|
|
1516
|
+
var isWorkerGlobalObject = (value) => value.type === import_utils17.AST_NODE_TYPES.Identifier && isGlobalObjectName(value.name);
|
|
1521
1517
|
var isWorkerConstructor = (callee) => {
|
|
1522
|
-
if (callee.type ===
|
|
1518
|
+
if (callee.type === import_utils17.AST_NODE_TYPES.Identifier) {
|
|
1523
1519
|
return isWorkerConstructorName(callee.name);
|
|
1524
1520
|
}
|
|
1525
|
-
if (callee.type !==
|
|
1521
|
+
if (callee.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1526
1522
|
return false;
|
|
1527
1523
|
}
|
|
1528
1524
|
return isWorkerConstructorName(getMemberPropertyName3(callee)) && isWorkerGlobalObject(callee.object);
|
|
1529
1525
|
};
|
|
1530
1526
|
var isImportScriptsCall = (callee) => {
|
|
1531
|
-
if (callee.type ===
|
|
1527
|
+
if (callee.type === import_utils17.AST_NODE_TYPES.Identifier) {
|
|
1532
1528
|
return callee.name === "importScripts";
|
|
1533
1529
|
}
|
|
1534
|
-
if (callee.type !==
|
|
1530
|
+
if (callee.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1535
1531
|
return false;
|
|
1536
1532
|
}
|
|
1537
1533
|
return getMemberPropertyName3(callee) === "importScripts" && isWorkerGlobalObject(callee.object);
|
|
1538
1534
|
};
|
|
1539
1535
|
var isServiceWorkerContainerAccess = (value) => {
|
|
1540
|
-
if (value.type !==
|
|
1536
|
+
if (value.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1541
1537
|
return false;
|
|
1542
1538
|
}
|
|
1543
1539
|
return getMemberPropertyName3(value) === "serviceWorker" && isNavigatorObject(value.object);
|
|
1544
1540
|
};
|
|
1545
|
-
var isServiceWorkerRegisterCall = (callee) => callee.type ===
|
|
1541
|
+
var isServiceWorkerRegisterCall = (callee) => callee.type === import_utils17.AST_NODE_TYPES.MemberExpression && getMemberPropertyName3(callee) === "register" && isServiceWorkerContainerAccess(callee.object);
|
|
1546
1542
|
var isGlobalUrlObject = (node) => {
|
|
1547
1543
|
if (getMemberPropertyName3(node) !== "URL") {
|
|
1548
1544
|
return false;
|
|
1549
1545
|
}
|
|
1550
|
-
return node.object.type ===
|
|
1546
|
+
return node.object.type === import_utils17.AST_NODE_TYPES.Identifier && isGlobalObjectName(node.object.name);
|
|
1551
1547
|
};
|
|
1552
1548
|
var isUrlCreateObjectUrlCall = (node) => {
|
|
1553
|
-
if (node.type !==
|
|
1549
|
+
if (node.type !== import_utils17.AST_NODE_TYPES.CallExpression || node.callee.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1554
1550
|
return false;
|
|
1555
1551
|
}
|
|
1556
1552
|
if (getMemberPropertyName3(node.callee) !== "createObjectURL") {
|
|
1557
1553
|
return false;
|
|
1558
1554
|
}
|
|
1559
|
-
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);
|
|
1560
1556
|
};
|
|
1561
1557
|
|
|
1562
1558
|
// dist/rules/no-dynamic-import-unsafe-url.js
|
|
1563
|
-
var isJavaScriptUrl = (value) => /^\s*javascript\s*:/
|
|
1559
|
+
var isJavaScriptUrl = (value) => /^\s*javascript\s*:/iv.test(value);
|
|
1564
1560
|
var isUnsafeDynamicImportSource = (expression) => {
|
|
1565
1561
|
const configuredValue = getStaticStringValue(expression);
|
|
1566
1562
|
return typeof configuredValue === "string" && (isBlobUrl(configuredValue) || isDataUrl(configuredValue) || isJavaScriptUrl(configuredValue)) || isUrlCreateObjectUrlCall(expression);
|
|
@@ -1598,21 +1594,19 @@ var rule18 = createRule({
|
|
|
1598
1594
|
var no_dynamic_import_unsafe_url_default = rule18;
|
|
1599
1595
|
|
|
1600
1596
|
// dist/_internal/electron-web-preferences.js
|
|
1597
|
+
var import_utils18 = require("@typescript-eslint/utils");
|
|
1601
1598
|
var getPropertyName2 = (property) => {
|
|
1602
1599
|
if (property.computed) {
|
|
1603
1600
|
return void 0;
|
|
1604
1601
|
}
|
|
1605
|
-
if (property.key.type ===
|
|
1602
|
+
if (property.key.type === import_utils18.AST_NODE_TYPES.Identifier) {
|
|
1606
1603
|
return property.key.name;
|
|
1607
1604
|
}
|
|
1608
|
-
|
|
1609
|
-
return property.key.value;
|
|
1610
|
-
}
|
|
1611
|
-
return void 0;
|
|
1605
|
+
return typeof property.key.value === "string" ? property.key.value : void 0;
|
|
1612
1606
|
};
|
|
1613
1607
|
var getPropertyByName = (objectExpression, propertyName) => {
|
|
1614
1608
|
for (const propertyNode of objectExpression.properties) {
|
|
1615
|
-
if (propertyNode.type !==
|
|
1609
|
+
if (propertyNode.type !== import_utils18.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
1616
1610
|
continue;
|
|
1617
1611
|
}
|
|
1618
1612
|
if (getPropertyName2(propertyNode) === propertyName) {
|
|
@@ -1622,7 +1616,7 @@ var getPropertyByName = (objectExpression, propertyName) => {
|
|
|
1622
1616
|
return void 0;
|
|
1623
1617
|
};
|
|
1624
1618
|
var getBooleanLiteralValue = (valueNode) => {
|
|
1625
|
-
if (valueNode.type !==
|
|
1619
|
+
if (valueNode.type !== import_utils18.AST_NODE_TYPES.Literal || typeof valueNode.value !== "boolean") {
|
|
1626
1620
|
return void 0;
|
|
1627
1621
|
}
|
|
1628
1622
|
return valueNode.value;
|
|
@@ -1630,11 +1624,11 @@ var getBooleanLiteralValue = (valueNode) => {
|
|
|
1630
1624
|
var createElectronWebPreferencesBooleanListener = (context, check) => ({
|
|
1631
1625
|
"NewExpression[callee.name=/^(?:BrowserWindow|BrowserView)$/]"(node) {
|
|
1632
1626
|
const [firstArgument] = node.arguments;
|
|
1633
|
-
if (firstArgument?.type !==
|
|
1627
|
+
if (firstArgument?.type !== import_utils18.AST_NODE_TYPES.ObjectExpression) {
|
|
1634
1628
|
return;
|
|
1635
1629
|
}
|
|
1636
1630
|
const webPreferencesProperty = getPropertyByName(firstArgument, "webPreferences");
|
|
1637
|
-
if (webPreferencesProperty?.value.type !==
|
|
1631
|
+
if (webPreferencesProperty?.value.type !== import_utils18.AST_NODE_TYPES.ObjectExpression) {
|
|
1638
1632
|
return;
|
|
1639
1633
|
}
|
|
1640
1634
|
const preferenceProperty = getPropertyByName(webPreferencesProperty.value, check.preferenceName);
|
|
@@ -1684,22 +1678,20 @@ var rule19 = createRule({
|
|
|
1684
1678
|
var no_electron_allow_running_insecure_content_default = rule19;
|
|
1685
1679
|
|
|
1686
1680
|
// dist/rules/no-electron-dangerous-blink-features.js
|
|
1681
|
+
var import_utils19 = require("@typescript-eslint/utils");
|
|
1687
1682
|
var import_ts_extras11 = require("ts-extras");
|
|
1688
1683
|
var getPropertyName3 = (property) => {
|
|
1689
1684
|
if (property.computed) {
|
|
1690
1685
|
return void 0;
|
|
1691
1686
|
}
|
|
1692
|
-
if (property.key.type ===
|
|
1687
|
+
if (property.key.type === import_utils19.AST_NODE_TYPES.Identifier) {
|
|
1693
1688
|
return property.key.name;
|
|
1694
1689
|
}
|
|
1695
|
-
|
|
1696
|
-
return property.key.value;
|
|
1697
|
-
}
|
|
1698
|
-
return void 0;
|
|
1690
|
+
return typeof property.key.value === "string" ? property.key.value : void 0;
|
|
1699
1691
|
};
|
|
1700
1692
|
var getPropertyByName2 = (objectExpression, propertyName) => {
|
|
1701
1693
|
for (const propertyNode of objectExpression.properties) {
|
|
1702
|
-
if (propertyNode.type !==
|
|
1694
|
+
if (propertyNode.type !== import_utils19.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
1703
1695
|
continue;
|
|
1704
1696
|
}
|
|
1705
1697
|
if (getPropertyName3(propertyNode) === propertyName) {
|
|
@@ -1709,10 +1701,10 @@ var getPropertyByName2 = (objectExpression, propertyName) => {
|
|
|
1709
1701
|
return void 0;
|
|
1710
1702
|
};
|
|
1711
1703
|
var getStaticStringValue2 = (node) => {
|
|
1712
|
-
if (node.type ===
|
|
1704
|
+
if (node.type === import_utils19.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
1713
1705
|
return node.value;
|
|
1714
1706
|
}
|
|
1715
|
-
if (node.type ===
|
|
1707
|
+
if (node.type === import_utils19.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
1716
1708
|
return (0, import_ts_extras11.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
1717
1709
|
}
|
|
1718
1710
|
return void 0;
|
|
@@ -1729,11 +1721,11 @@ var rule20 = createRule({
|
|
|
1729
1721
|
return {
|
|
1730
1722
|
"NewExpression[callee.name=/^(?:BrowserWindow|BrowserView)$/]"(node) {
|
|
1731
1723
|
const [firstArgument] = node.arguments;
|
|
1732
|
-
if (firstArgument?.type !==
|
|
1724
|
+
if (firstArgument?.type !== import_utils19.AST_NODE_TYPES.ObjectExpression) {
|
|
1733
1725
|
return;
|
|
1734
1726
|
}
|
|
1735
1727
|
const webPreferencesProperty = getPropertyByName2(firstArgument, "webPreferences");
|
|
1736
|
-
if (webPreferencesProperty?.value.type !==
|
|
1728
|
+
if (webPreferencesProperty?.value.type !== import_utils19.AST_NODE_TYPES.ObjectExpression) {
|
|
1737
1729
|
return;
|
|
1738
1730
|
}
|
|
1739
1731
|
const enableBlinkFeaturesProperty = getPropertyByName2(webPreferencesProperty.value, "enableBlinkFeatures");
|
|
@@ -1931,18 +1923,19 @@ var rule26 = createRule({
|
|
|
1931
1923
|
var no_electron_experimental_features_default = rule26;
|
|
1932
1924
|
|
|
1933
1925
|
// dist/rules/no-electron-expose-raw-ipc-renderer.js
|
|
1934
|
-
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;
|
|
1935
1928
|
var isContextBridgeObjectExpression = (expression) => {
|
|
1936
|
-
if (expression.type ===
|
|
1929
|
+
if (expression.type === import_utils20.AST_NODE_TYPES.Identifier) {
|
|
1937
1930
|
return expression.name === "contextBridge";
|
|
1938
1931
|
}
|
|
1939
|
-
if (expression.type !==
|
|
1932
|
+
if (expression.type !== import_utils20.AST_NODE_TYPES.MemberExpression) {
|
|
1940
1933
|
return false;
|
|
1941
1934
|
}
|
|
1942
1935
|
return getMemberPropertyName3(expression) === "contextBridge";
|
|
1943
1936
|
};
|
|
1944
1937
|
var isContextBridgeExposeCall = (node) => {
|
|
1945
|
-
if (node.callee.type !==
|
|
1938
|
+
if (node.callee.type !== import_utils20.AST_NODE_TYPES.MemberExpression) {
|
|
1946
1939
|
return false;
|
|
1947
1940
|
}
|
|
1948
1941
|
const methodName = getMemberPropertyName3(node.callee);
|
|
@@ -1952,16 +1945,16 @@ var isContextBridgeExposeCall = (node) => {
|
|
|
1952
1945
|
return isContextBridgeObjectExpression(node.callee.object);
|
|
1953
1946
|
};
|
|
1954
1947
|
var isIpcRendererReference = (expression) => {
|
|
1955
|
-
if (expression.type ===
|
|
1948
|
+
if (expression.type === import_utils20.AST_NODE_TYPES.Identifier) {
|
|
1956
1949
|
return expression.name === "ipcRenderer";
|
|
1957
1950
|
}
|
|
1958
|
-
if (expression.type !==
|
|
1951
|
+
if (expression.type !== import_utils20.AST_NODE_TYPES.MemberExpression) {
|
|
1959
1952
|
return false;
|
|
1960
1953
|
}
|
|
1961
|
-
if (expression.object.type ===
|
|
1954
|
+
if (expression.object.type === import_utils20.AST_NODE_TYPES.Identifier) {
|
|
1962
1955
|
return expression.object.name === "ipcRenderer";
|
|
1963
1956
|
}
|
|
1964
|
-
if (expression.object.type !==
|
|
1957
|
+
if (expression.object.type !== import_utils20.AST_NODE_TYPES.MemberExpression) {
|
|
1965
1958
|
return false;
|
|
1966
1959
|
}
|
|
1967
1960
|
return getMemberPropertyName3(expression.object) === "ipcRenderer";
|
|
@@ -1970,17 +1963,17 @@ var isUnsafeExposedValue = (expression) => {
|
|
|
1970
1963
|
if (isIpcRendererReference(expression)) {
|
|
1971
1964
|
return true;
|
|
1972
1965
|
}
|
|
1973
|
-
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) {
|
|
1974
1967
|
return isIpcRendererReference(expression.callee.object);
|
|
1975
1968
|
}
|
|
1976
|
-
if (expression.type ===
|
|
1977
|
-
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));
|
|
1978
1971
|
}
|
|
1979
|
-
if (expression.type !==
|
|
1972
|
+
if (expression.type !== import_utils20.AST_NODE_TYPES.ObjectExpression) {
|
|
1980
1973
|
return false;
|
|
1981
1974
|
}
|
|
1982
1975
|
return expression.properties.some((propertyNode) => {
|
|
1983
|
-
if (propertyNode.type ===
|
|
1976
|
+
if (propertyNode.type === import_utils20.AST_NODE_TYPES.SpreadElement) {
|
|
1984
1977
|
return isUnsafeExposedValue(propertyNode.argument);
|
|
1985
1978
|
}
|
|
1986
1979
|
return propertyNode.kind === "init" && isExpressionNode(propertyNode.value) && isUnsafeExposedValue(propertyNode.value);
|
|
@@ -1994,7 +1987,7 @@ var rule27 = createRule({
|
|
|
1994
1987
|
return;
|
|
1995
1988
|
}
|
|
1996
1989
|
const [, exposedValue] = node.arguments;
|
|
1997
|
-
if (exposedValue === void 0 || exposedValue.type ===
|
|
1990
|
+
if (exposedValue === void 0 || exposedValue.type === import_utils20.AST_NODE_TYPES.SpreadElement || !isUnsafeExposedValue(exposedValue)) {
|
|
1998
1991
|
return;
|
|
1999
1992
|
}
|
|
2000
1993
|
context.report({
|
|
@@ -2023,25 +2016,26 @@ var rule27 = createRule({
|
|
|
2023
2016
|
var no_electron_expose_raw_ipc_renderer_default = rule27;
|
|
2024
2017
|
|
|
2025
2018
|
// dist/rules/no-electron-insecure-certificate-error-handler.js
|
|
2019
|
+
var import_utils21 = require("@typescript-eslint/utils");
|
|
2026
2020
|
var import_ts_extras12 = require("ts-extras");
|
|
2027
2021
|
var getStaticStringValue3 = (node) => {
|
|
2028
|
-
if (node.type ===
|
|
2022
|
+
if (node.type === import_utils21.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
2029
2023
|
return node.value;
|
|
2030
2024
|
}
|
|
2031
|
-
if (node.type ===
|
|
2025
|
+
if (node.type === import_utils21.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
2032
2026
|
return (0, import_ts_extras12.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
2033
2027
|
}
|
|
2034
2028
|
return void 0;
|
|
2035
2029
|
};
|
|
2036
2030
|
var isOnMemberExpression = (callee) => {
|
|
2037
|
-
if (callee.type !==
|
|
2031
|
+
if (callee.type !== import_utils21.AST_NODE_TYPES.MemberExpression || callee.computed) {
|
|
2038
2032
|
return false;
|
|
2039
2033
|
}
|
|
2040
|
-
return callee.property.type ===
|
|
2034
|
+
return callee.property.type === import_utils21.AST_NODE_TYPES.Identifier && callee.property.name === "on";
|
|
2041
2035
|
};
|
|
2042
2036
|
var getCallbackParameterName = (node) => {
|
|
2043
2037
|
const callbackParameter = (0, import_ts_extras12.arrayAt)(node.params, -1);
|
|
2044
|
-
return callbackParameter?.type ===
|
|
2038
|
+
return callbackParameter?.type === import_utils21.AST_NODE_TYPES.Identifier ? callbackParameter.name : void 0;
|
|
2045
2039
|
};
|
|
2046
2040
|
var toUnsafeCallbackTruePattern = (callbackName) => (
|
|
2047
2041
|
// eslint-disable-next-line security/detect-non-literal-regexp -- Callback identifier is static source text and safely interpolated for targeted pattern matching.
|
|
@@ -2056,7 +2050,7 @@ var isCertificateErrorEventRegistration = (node) => {
|
|
|
2056
2050
|
return false;
|
|
2057
2051
|
}
|
|
2058
2052
|
const [firstArgument] = node.arguments;
|
|
2059
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2053
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils21.AST_NODE_TYPES.SpreadElement) {
|
|
2060
2054
|
return false;
|
|
2061
2055
|
}
|
|
2062
2056
|
return getStaticStringValue3(firstArgument) === "certificate-error";
|
|
@@ -2069,10 +2063,10 @@ var rule28 = createRule({
|
|
|
2069
2063
|
return;
|
|
2070
2064
|
}
|
|
2071
2065
|
const [, secondArgument] = node.arguments;
|
|
2072
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
2066
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils21.AST_NODE_TYPES.SpreadElement) {
|
|
2073
2067
|
return;
|
|
2074
2068
|
}
|
|
2075
|
-
if (secondArgument.type !==
|
|
2069
|
+
if (secondArgument.type !== import_utils21.AST_NODE_TYPES.ArrowFunctionExpression && secondArgument.type !== import_utils21.AST_NODE_TYPES.FunctionExpression) {
|
|
2076
2070
|
return;
|
|
2077
2071
|
}
|
|
2078
2072
|
const callbackParameterName = getCallbackParameterName(secondArgument);
|
|
@@ -2108,39 +2102,45 @@ var rule28 = createRule({
|
|
|
2108
2102
|
var no_electron_insecure_certificate_error_handler_default = rule28;
|
|
2109
2103
|
|
|
2110
2104
|
// dist/rules/no-electron-insecure-certificate-verify-proc.js
|
|
2105
|
+
var import_utils22 = require("@typescript-eslint/utils");
|
|
2111
2106
|
var import_ts_extras13 = require("ts-extras");
|
|
2112
2107
|
var getMemberPropertyName6 = (memberExpression) => {
|
|
2113
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2108
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils22.AST_NODE_TYPES.Identifier) {
|
|
2114
2109
|
return memberExpression.property.name;
|
|
2115
2110
|
}
|
|
2116
|
-
if (memberExpression.property.type ===
|
|
2111
|
+
if (memberExpression.property.type === import_utils22.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2117
2112
|
return memberExpression.property.value;
|
|
2118
2113
|
}
|
|
2119
2114
|
return void 0;
|
|
2120
2115
|
};
|
|
2121
|
-
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;
|
|
2122
2117
|
var hasInsecureCertificateOverride = (callbackNode, context, callbackParameterName) => {
|
|
2123
2118
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
2124
|
-
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
|
+
);
|
|
2125
2124
|
const callbackPattern = new RegExp(String.raw`\b${escapedName}\s*\(\s*0\b`, "u");
|
|
2126
|
-
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);
|
|
2127
2127
|
};
|
|
2128
2128
|
var rule29 = createRule({
|
|
2129
2129
|
create(context) {
|
|
2130
2130
|
return {
|
|
2131
2131
|
CallExpression(node) {
|
|
2132
|
-
if (node.callee.type !==
|
|
2132
|
+
if (node.callee.type !== import_utils22.AST_NODE_TYPES.MemberExpression) {
|
|
2133
2133
|
return;
|
|
2134
2134
|
}
|
|
2135
2135
|
if (getMemberPropertyName6(node.callee) !== "setCertificateVerifyProc") {
|
|
2136
2136
|
return;
|
|
2137
2137
|
}
|
|
2138
2138
|
const [firstArgument] = node.arguments;
|
|
2139
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2139
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils22.AST_NODE_TYPES.SpreadElement || !isFunctionExpression(firstArgument)) {
|
|
2140
2140
|
return;
|
|
2141
2141
|
}
|
|
2142
2142
|
const callbackParameter = (0, import_ts_extras13.arrayAt)(firstArgument.params, -1);
|
|
2143
|
-
if (callbackParameter?.type !==
|
|
2143
|
+
if (callbackParameter?.type !== import_utils22.AST_NODE_TYPES.Identifier) {
|
|
2144
2144
|
return;
|
|
2145
2145
|
}
|
|
2146
2146
|
if (!hasInsecureCertificateOverride(firstArgument, context, callbackParameter.name)) {
|
|
@@ -2172,39 +2172,45 @@ var rule29 = createRule({
|
|
|
2172
2172
|
var no_electron_insecure_certificate_verify_proc_default = rule29;
|
|
2173
2173
|
|
|
2174
2174
|
// dist/rules/no-electron-insecure-permission-request-handler.js
|
|
2175
|
+
var import_utils23 = require("@typescript-eslint/utils");
|
|
2175
2176
|
var import_ts_extras14 = require("ts-extras");
|
|
2176
2177
|
var getMemberPropertyName7 = (memberExpression) => {
|
|
2177
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2178
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils23.AST_NODE_TYPES.Identifier) {
|
|
2178
2179
|
return memberExpression.property.name;
|
|
2179
2180
|
}
|
|
2180
|
-
if (memberExpression.property.type ===
|
|
2181
|
+
if (memberExpression.property.type === import_utils23.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2181
2182
|
return memberExpression.property.value;
|
|
2182
2183
|
}
|
|
2183
2184
|
return void 0;
|
|
2184
2185
|
};
|
|
2185
|
-
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;
|
|
2186
2187
|
var hasUnsafePermissionAllowPattern = (callbackNode, context, callbackParameterName) => {
|
|
2187
2188
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
2188
|
-
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
|
+
);
|
|
2189
2194
|
const callbackPattern = new RegExp(String.raw`\b${escapedName}\s*\(\s*true\b`, "u");
|
|
2190
|
-
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);
|
|
2191
2197
|
};
|
|
2192
2198
|
var rule30 = createRule({
|
|
2193
2199
|
create(context) {
|
|
2194
2200
|
return {
|
|
2195
2201
|
CallExpression(node) {
|
|
2196
|
-
if (node.callee.type !==
|
|
2202
|
+
if (node.callee.type !== import_utils23.AST_NODE_TYPES.MemberExpression) {
|
|
2197
2203
|
return;
|
|
2198
2204
|
}
|
|
2199
2205
|
if (getMemberPropertyName7(node.callee) !== "setPermissionRequestHandler") {
|
|
2200
2206
|
return;
|
|
2201
2207
|
}
|
|
2202
2208
|
const [firstArgument] = node.arguments;
|
|
2203
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2209
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils23.AST_NODE_TYPES.SpreadElement || !isFunctionExpression2(firstArgument)) {
|
|
2204
2210
|
return;
|
|
2205
2211
|
}
|
|
2206
2212
|
const callbackParameter = (0, import_ts_extras14.arrayAt)(firstArgument.params, -1);
|
|
2207
|
-
if (callbackParameter?.type !==
|
|
2213
|
+
if (callbackParameter?.type !== import_utils23.AST_NODE_TYPES.Identifier) {
|
|
2208
2214
|
return;
|
|
2209
2215
|
}
|
|
2210
2216
|
if (!hasUnsafePermissionAllowPattern(firstArgument, context, callbackParameter.name)) {
|
|
@@ -2286,31 +2292,32 @@ var rule31 = createRule({
|
|
|
2286
2292
|
var no_electron_node_integration_default = rule31;
|
|
2287
2293
|
|
|
2288
2294
|
// dist/rules/no-electron-permission-check-handler-allow-all.js
|
|
2295
|
+
var import_utils24 = require("@typescript-eslint/utils");
|
|
2289
2296
|
var import_ts_extras15 = require("ts-extras");
|
|
2290
|
-
var isFunctionExpression3 = (expression) => expression.type ===
|
|
2291
|
-
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;
|
|
2292
2299
|
var isAllowAllPermissionCheckHandler = (callbackNode) => {
|
|
2293
|
-
if (callbackNode.body.type !==
|
|
2300
|
+
if (callbackNode.body.type !== import_utils24.AST_NODE_TYPES.BlockStatement) {
|
|
2294
2301
|
return isBooleanTrueLiteral(callbackNode.body);
|
|
2295
2302
|
}
|
|
2296
2303
|
if (callbackNode.body.body.length !== 1) {
|
|
2297
2304
|
return false;
|
|
2298
2305
|
}
|
|
2299
2306
|
const onlyStatement = (0, import_ts_extras15.arrayFirst)(callbackNode.body.body);
|
|
2300
|
-
return onlyStatement?.type ===
|
|
2307
|
+
return onlyStatement?.type === import_utils24.AST_NODE_TYPES.ReturnStatement && isBooleanTrueLiteral(onlyStatement.argument);
|
|
2301
2308
|
};
|
|
2302
2309
|
var rule32 = createRule({
|
|
2303
2310
|
create(context) {
|
|
2304
2311
|
return {
|
|
2305
2312
|
CallExpression(node) {
|
|
2306
|
-
if (node.callee.type !==
|
|
2313
|
+
if (node.callee.type !== import_utils24.AST_NODE_TYPES.MemberExpression) {
|
|
2307
2314
|
return;
|
|
2308
2315
|
}
|
|
2309
2316
|
if (getMemberPropertyName3(node.callee) !== "setPermissionCheckHandler") {
|
|
2310
2317
|
return;
|
|
2311
2318
|
}
|
|
2312
2319
|
const [firstArgument] = node.arguments;
|
|
2313
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2320
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils24.AST_NODE_TYPES.SpreadElement || !isFunctionExpression3(firstArgument) || !isAllowAllPermissionCheckHandler(firstArgument)) {
|
|
2314
2321
|
return;
|
|
2315
2322
|
}
|
|
2316
2323
|
context.report({
|
|
@@ -2339,27 +2346,28 @@ var rule32 = createRule({
|
|
|
2339
2346
|
var no_electron_permission_check_handler_allow_all_default = rule32;
|
|
2340
2347
|
|
|
2341
2348
|
// dist/rules/no-electron-unchecked-ipc-sender.js
|
|
2349
|
+
var import_utils25 = require("@typescript-eslint/utils");
|
|
2342
2350
|
var import_ts_extras16 = require("ts-extras");
|
|
2343
2351
|
var getMemberPropertyName8 = (memberExpression) => {
|
|
2344
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2352
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils25.AST_NODE_TYPES.Identifier) {
|
|
2345
2353
|
return memberExpression.property.name;
|
|
2346
2354
|
}
|
|
2347
|
-
if (memberExpression.property.type ===
|
|
2355
|
+
if (memberExpression.property.type === import_utils25.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2348
2356
|
return memberExpression.property.value;
|
|
2349
2357
|
}
|
|
2350
2358
|
return void 0;
|
|
2351
2359
|
};
|
|
2352
2360
|
var isIpcMainObjectExpression = (expression) => {
|
|
2353
|
-
if (expression.type ===
|
|
2361
|
+
if (expression.type === import_utils25.AST_NODE_TYPES.Identifier) {
|
|
2354
2362
|
return expression.name === "ipcMain";
|
|
2355
2363
|
}
|
|
2356
|
-
if (expression.type !==
|
|
2364
|
+
if (expression.type !== import_utils25.AST_NODE_TYPES.MemberExpression) {
|
|
2357
2365
|
return false;
|
|
2358
2366
|
}
|
|
2359
2367
|
return getMemberPropertyName8(expression) === "ipcMain";
|
|
2360
2368
|
};
|
|
2361
2369
|
var isIpcMainHandlerRegistration = (node) => {
|
|
2362
|
-
if (node.callee.type !==
|
|
2370
|
+
if (node.callee.type !== import_utils25.AST_NODE_TYPES.MemberExpression) {
|
|
2363
2371
|
return false;
|
|
2364
2372
|
}
|
|
2365
2373
|
const methodName = getMemberPropertyName8(node.callee);
|
|
@@ -2368,12 +2376,17 @@ var isIpcMainHandlerRegistration = (node) => {
|
|
|
2368
2376
|
}
|
|
2369
2377
|
return isIpcMainObjectExpression(node.callee.object);
|
|
2370
2378
|
};
|
|
2371
|
-
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;
|
|
2372
2380
|
var hasSenderValidationPattern = (callbackNode, context, eventParameterName) => {
|
|
2373
2381
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
2374
|
-
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
|
+
);
|
|
2375
2387
|
const eventSenderPattern = new RegExp(String.raw`\b${escapedEventName}\s*\.\s*(?:sender|senderFrame)\b`, "u");
|
|
2376
|
-
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);
|
|
2377
2390
|
};
|
|
2378
2391
|
var rule33 = createRule({
|
|
2379
2392
|
create(context) {
|
|
@@ -2383,11 +2396,11 @@ var rule33 = createRule({
|
|
|
2383
2396
|
return;
|
|
2384
2397
|
}
|
|
2385
2398
|
const [, handlerNode] = node.arguments;
|
|
2386
|
-
if (handlerNode === void 0 || handlerNode.type ===
|
|
2399
|
+
if (handlerNode === void 0 || handlerNode.type === import_utils25.AST_NODE_TYPES.SpreadElement || !isFunctionExpression4(handlerNode)) {
|
|
2387
2400
|
return;
|
|
2388
2401
|
}
|
|
2389
2402
|
const eventParameter = (0, import_ts_extras16.arrayFirst)(handlerNode.params);
|
|
2390
|
-
if (eventParameter?.type !==
|
|
2403
|
+
if (eventParameter?.type !== import_utils25.AST_NODE_TYPES.Identifier) {
|
|
2391
2404
|
return;
|
|
2392
2405
|
}
|
|
2393
2406
|
if (hasSenderValidationPattern(handlerNode, context, eventParameter.name)) {
|
|
@@ -2419,24 +2432,29 @@ var rule33 = createRule({
|
|
|
2419
2432
|
var no_electron_unchecked_ipc_sender_default = rule33;
|
|
2420
2433
|
|
|
2421
2434
|
// dist/rules/no-electron-unrestricted-navigation.js
|
|
2435
|
+
var import_utils26 = require("@typescript-eslint/utils");
|
|
2422
2436
|
var import_ts_extras17 = require("ts-extras");
|
|
2423
2437
|
var getMemberPropertyName9 = (memberExpression) => {
|
|
2424
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2438
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils26.AST_NODE_TYPES.Identifier) {
|
|
2425
2439
|
return memberExpression.property.name;
|
|
2426
2440
|
}
|
|
2427
|
-
if (memberExpression.property.type ===
|
|
2441
|
+
if (memberExpression.property.type === import_utils26.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2428
2442
|
return memberExpression.property.value;
|
|
2429
2443
|
}
|
|
2430
2444
|
return void 0;
|
|
2431
2445
|
};
|
|
2432
|
-
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;
|
|
2433
2447
|
var hasUnsafeAllowAction = (callbackNode, context) => {
|
|
2434
2448
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
2435
2449
|
return /\baction\s*:\s*["'`]allow["'`]/u.test(callbackSourceText);
|
|
2436
2450
|
};
|
|
2437
2451
|
var hasPreventDefaultCall = (callbackNode, context, eventParameterName) => {
|
|
2438
2452
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
2439
|
-
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
|
+
);
|
|
2440
2458
|
const preventDefaultPattern = new RegExp(String.raw`\b${escapedName}\s*\.\s*preventDefault\s*\(`, "u");
|
|
2441
2459
|
return preventDefaultPattern.test(callbackSourceText);
|
|
2442
2460
|
};
|
|
@@ -2444,13 +2462,13 @@ var rule34 = createRule({
|
|
|
2444
2462
|
create(context) {
|
|
2445
2463
|
return {
|
|
2446
2464
|
CallExpression(node) {
|
|
2447
|
-
if (node.callee.type !==
|
|
2465
|
+
if (node.callee.type !== import_utils26.AST_NODE_TYPES.MemberExpression) {
|
|
2448
2466
|
return;
|
|
2449
2467
|
}
|
|
2450
2468
|
const methodName = getMemberPropertyName9(node.callee);
|
|
2451
2469
|
if (methodName === "setWindowOpenHandler") {
|
|
2452
2470
|
const [firstArgument2] = node.arguments;
|
|
2453
|
-
if (firstArgument2 === void 0 || firstArgument2.type ===
|
|
2471
|
+
if (firstArgument2 === void 0 || firstArgument2.type === import_utils26.AST_NODE_TYPES.SpreadElement || !isFunctionExpression5(firstArgument2)) {
|
|
2454
2472
|
return;
|
|
2455
2473
|
}
|
|
2456
2474
|
if (!hasUnsafeAllowAction(firstArgument2, context)) {
|
|
@@ -2466,14 +2484,14 @@ var rule34 = createRule({
|
|
|
2466
2484
|
return;
|
|
2467
2485
|
}
|
|
2468
2486
|
const [firstArgument, secondArgument] = node.arguments;
|
|
2469
|
-
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)) {
|
|
2470
2488
|
return;
|
|
2471
2489
|
}
|
|
2472
|
-
if (firstArgument.type !==
|
|
2490
|
+
if (firstArgument.type !== import_utils26.AST_NODE_TYPES.Literal || firstArgument.value !== "will-navigate") {
|
|
2473
2491
|
return;
|
|
2474
2492
|
}
|
|
2475
2493
|
const eventParameter = (0, import_ts_extras17.arrayFirst)(secondArgument.params);
|
|
2476
|
-
if (eventParameter?.type !==
|
|
2494
|
+
if (eventParameter?.type !== import_utils26.AST_NODE_TYPES.Identifier) {
|
|
2477
2495
|
return;
|
|
2478
2496
|
}
|
|
2479
2497
|
if (hasPreventDefaultCall(secondArgument, context, eventParameter.name)) {
|
|
@@ -2505,6 +2523,7 @@ var rule34 = createRule({
|
|
|
2505
2523
|
var no_electron_unrestricted_navigation_default = rule34;
|
|
2506
2524
|
|
|
2507
2525
|
// dist/rules/no-electron-untrusted-open-external.js
|
|
2526
|
+
var import_utils27 = require("@typescript-eslint/utils");
|
|
2508
2527
|
var import_ts_extras18 = require("ts-extras");
|
|
2509
2528
|
var getStaticTemplateLiteralValue = (templateLiteral) => {
|
|
2510
2529
|
if (templateLiteral.expressions.length > 0) {
|
|
@@ -2513,35 +2532,35 @@ var getStaticTemplateLiteralValue = (templateLiteral) => {
|
|
|
2513
2532
|
return (0, import_ts_extras18.arrayFirst)(templateLiteral.quasis)?.value.cooked ?? void 0;
|
|
2514
2533
|
};
|
|
2515
2534
|
var getStringValue = (node) => {
|
|
2516
|
-
if (node.type ===
|
|
2535
|
+
if (node.type === import_utils27.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
2517
2536
|
return node.value;
|
|
2518
2537
|
}
|
|
2519
|
-
if (node.type ===
|
|
2538
|
+
if (node.type === import_utils27.AST_NODE_TYPES.TemplateLiteral) {
|
|
2520
2539
|
return getStaticTemplateLiteralValue(node);
|
|
2521
2540
|
}
|
|
2522
2541
|
return void 0;
|
|
2523
2542
|
};
|
|
2524
|
-
var isAllowedExternalProtocol = (value) => /^(?:https|mailto):/
|
|
2543
|
+
var isAllowedExternalProtocol = (value) => /^(?:https|mailto):/iv.test(value.trim());
|
|
2525
2544
|
var getMemberPropertyName10 = (memberExpression) => {
|
|
2526
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2545
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils27.AST_NODE_TYPES.Identifier) {
|
|
2527
2546
|
return memberExpression.property.name;
|
|
2528
2547
|
}
|
|
2529
|
-
if (memberExpression.property.type ===
|
|
2548
|
+
if (memberExpression.property.type === import_utils27.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2530
2549
|
return memberExpression.property.value;
|
|
2531
2550
|
}
|
|
2532
2551
|
return void 0;
|
|
2533
2552
|
};
|
|
2534
2553
|
var isShellObjectExpression = (node) => {
|
|
2535
|
-
if (node.type ===
|
|
2554
|
+
if (node.type === import_utils27.AST_NODE_TYPES.Identifier) {
|
|
2536
2555
|
return node.name === "shell";
|
|
2537
2556
|
}
|
|
2538
|
-
if (node.type !==
|
|
2557
|
+
if (node.type !== import_utils27.AST_NODE_TYPES.MemberExpression) {
|
|
2539
2558
|
return false;
|
|
2540
2559
|
}
|
|
2541
2560
|
return getMemberPropertyName10(node) === "shell";
|
|
2542
2561
|
};
|
|
2543
2562
|
var isShellOpenExternalCallee = (callee) => {
|
|
2544
|
-
if (callee.type !==
|
|
2563
|
+
if (callee.type !== import_utils27.AST_NODE_TYPES.MemberExpression) {
|
|
2545
2564
|
return false;
|
|
2546
2565
|
}
|
|
2547
2566
|
if (getMemberPropertyName10(callee) !== "openExternal") {
|
|
@@ -2557,7 +2576,7 @@ var rule35 = createRule({
|
|
|
2557
2576
|
return;
|
|
2558
2577
|
}
|
|
2559
2578
|
const [firstArgument] = node.arguments;
|
|
2560
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2579
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils27.AST_NODE_TYPES.SpreadElement) {
|
|
2561
2580
|
return;
|
|
2562
2581
|
}
|
|
2563
2582
|
const firstArgumentValue = getStringValue(firstArgument);
|
|
@@ -2590,14 +2609,15 @@ var rule35 = createRule({
|
|
|
2590
2609
|
var no_electron_untrusted_open_external_default = rule35;
|
|
2591
2610
|
|
|
2592
2611
|
// dist/rules/no-electron-webview-allowpopups.js
|
|
2612
|
+
var import_utils28 = require("@typescript-eslint/utils");
|
|
2593
2613
|
var isJsxWebviewElement = (node) => {
|
|
2594
|
-
if (node.name.type ===
|
|
2614
|
+
if (node.name.type === import_utils28.AST_NODE_TYPES.JSXIdentifier) {
|
|
2595
2615
|
return node.name.name.toLowerCase() === "webview";
|
|
2596
2616
|
}
|
|
2597
2617
|
return false;
|
|
2598
2618
|
};
|
|
2599
2619
|
var getJsxAttributeName = (attributeNode) => {
|
|
2600
|
-
if (attributeNode.name.type !==
|
|
2620
|
+
if (attributeNode.name.type !== import_utils28.AST_NODE_TYPES.JSXIdentifier) {
|
|
2601
2621
|
return void 0;
|
|
2602
2622
|
}
|
|
2603
2623
|
return attributeNode.name.name.toLowerCase();
|
|
@@ -2606,7 +2626,7 @@ var isTruthyJsxAttributeValue = (attributeValue) => {
|
|
|
2606
2626
|
if (attributeValue === null) {
|
|
2607
2627
|
return true;
|
|
2608
2628
|
}
|
|
2609
|
-
if (attributeValue.type ===
|
|
2629
|
+
if (attributeValue.type === import_utils28.AST_NODE_TYPES.Literal) {
|
|
2610
2630
|
if (typeof attributeValue.value === "boolean") {
|
|
2611
2631
|
return attributeValue.value;
|
|
2612
2632
|
}
|
|
@@ -2615,10 +2635,10 @@ var isTruthyJsxAttributeValue = (attributeValue) => {
|
|
|
2615
2635
|
}
|
|
2616
2636
|
return false;
|
|
2617
2637
|
}
|
|
2618
|
-
if (attributeValue.type !==
|
|
2638
|
+
if (attributeValue.type !== import_utils28.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
2619
2639
|
return false;
|
|
2620
2640
|
}
|
|
2621
|
-
if (attributeValue.expression.type ===
|
|
2641
|
+
if (attributeValue.expression.type === import_utils28.AST_NODE_TYPES.Literal && typeof attributeValue.expression.value === "boolean") {
|
|
2622
2642
|
return attributeValue.expression.value;
|
|
2623
2643
|
}
|
|
2624
2644
|
return true;
|
|
@@ -2631,7 +2651,7 @@ var rule36 = createRule({
|
|
|
2631
2651
|
return;
|
|
2632
2652
|
}
|
|
2633
2653
|
for (const attributeNode of node.attributes) {
|
|
2634
|
-
if (attributeNode.type !==
|
|
2654
|
+
if (attributeNode.type !== import_utils28.AST_NODE_TYPES.JSXAttribute) {
|
|
2635
2655
|
continue;
|
|
2636
2656
|
}
|
|
2637
2657
|
if (getJsxAttributeName(attributeNode) !== "allowpopups") {
|
|
@@ -2671,32 +2691,33 @@ var rule36 = createRule({
|
|
|
2671
2691
|
var no_electron_webview_allowpopups_default = rule36;
|
|
2672
2692
|
|
|
2673
2693
|
// dist/rules/no-electron-webview-insecure-webpreferences.js
|
|
2694
|
+
var import_utils29 = require("@typescript-eslint/utils");
|
|
2674
2695
|
var import_ts_extras19 = require("ts-extras");
|
|
2675
2696
|
var UNSAFE_WEBPREFERENCES_PATTERNS = [
|
|
2676
2697
|
{
|
|
2677
2698
|
flagName: "allowRunningInsecureContent",
|
|
2678
|
-
pattern: /\ballowrunninginsecurecontent\s*=\s*(?:1|on|true|yes)\b/
|
|
2699
|
+
pattern: /\ballowrunninginsecurecontent\s*=\s*(?:1|on|true|yes)\b/iv
|
|
2679
2700
|
},
|
|
2680
2701
|
{
|
|
2681
2702
|
flagName: "contextIsolation",
|
|
2682
|
-
pattern: /\bcontextisolation\s*=\s*(?:0|false|no|off)\b/
|
|
2703
|
+
pattern: /\bcontextisolation\s*=\s*(?:0|false|no|off)\b/iv
|
|
2683
2704
|
},
|
|
2684
2705
|
{
|
|
2685
2706
|
flagName: "experimentalFeatures",
|
|
2686
|
-
pattern: /\bexperimentalfeatures\s*=\s*(?:1|on|true|yes)\b/
|
|
2707
|
+
pattern: /\bexperimentalfeatures\s*=\s*(?:1|on|true|yes)\b/iv
|
|
2687
2708
|
},
|
|
2688
2709
|
{
|
|
2689
2710
|
flagName: "sandbox",
|
|
2690
|
-
pattern: /\bsandbox\s*=\s*(?:0|false|no|off)\b/
|
|
2711
|
+
pattern: /\bsandbox\s*=\s*(?:0|false|no|off)\b/iv
|
|
2691
2712
|
},
|
|
2692
2713
|
{
|
|
2693
2714
|
flagName: "webSecurity",
|
|
2694
|
-
pattern: /\bwebsecurity\s*=\s*(?:0|false|no|off)\b/
|
|
2715
|
+
pattern: /\bwebsecurity\s*=\s*(?:0|false|no|off)\b/iv
|
|
2695
2716
|
}
|
|
2696
2717
|
];
|
|
2697
|
-
var isJsxWebviewElement2 = (node) => node.name.type ===
|
|
2718
|
+
var isJsxWebviewElement2 = (node) => node.name.type === import_utils29.AST_NODE_TYPES.JSXIdentifier && node.name.name.toLowerCase() === "webview";
|
|
2698
2719
|
var getJsxAttributeName2 = (attributeNode) => {
|
|
2699
|
-
if (attributeNode.name.type ===
|
|
2720
|
+
if (attributeNode.name.type === import_utils29.AST_NODE_TYPES.JSXIdentifier) {
|
|
2700
2721
|
return attributeNode.name.name.toLowerCase();
|
|
2701
2722
|
}
|
|
2702
2723
|
return `${attributeNode.name.namespace.name}:${attributeNode.name.name.name}`.toLowerCase();
|
|
@@ -2710,7 +2731,7 @@ var rule37 = createRule({
|
|
|
2710
2731
|
return;
|
|
2711
2732
|
}
|
|
2712
2733
|
for (const attributeNode of node.attributes) {
|
|
2713
|
-
if (attributeNode.type !==
|
|
2734
|
+
if (attributeNode.type !== import_utils29.AST_NODE_TYPES.JSXAttribute) {
|
|
2714
2735
|
continue;
|
|
2715
2736
|
}
|
|
2716
2737
|
if (getJsxAttributeName2(attributeNode) !== "webpreferences") {
|
|
@@ -2754,9 +2775,10 @@ var rule37 = createRule({
|
|
|
2754
2775
|
var no_electron_webview_insecure_webpreferences_default = rule37;
|
|
2755
2776
|
|
|
2756
2777
|
// dist/rules/no-electron-webview-node-integration.js
|
|
2757
|
-
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";
|
|
2758
2780
|
var getJsxAttributeName3 = (attributeNode) => {
|
|
2759
|
-
if (attributeNode.name.type ===
|
|
2781
|
+
if (attributeNode.name.type === import_utils30.AST_NODE_TYPES.JSXIdentifier) {
|
|
2760
2782
|
return attributeNode.name.name.toLowerCase();
|
|
2761
2783
|
}
|
|
2762
2784
|
return `${attributeNode.name.namespace.name}:${attributeNode.name.name.name}`.toLowerCase();
|
|
@@ -2769,7 +2791,7 @@ var isTruthyJsxAttributeValue2 = (attributeValue) => {
|
|
|
2769
2791
|
if (attributeValue === null) {
|
|
2770
2792
|
return true;
|
|
2771
2793
|
}
|
|
2772
|
-
if (attributeValue.type ===
|
|
2794
|
+
if (attributeValue.type === import_utils30.AST_NODE_TYPES.Literal) {
|
|
2773
2795
|
if (typeof attributeValue.value === "boolean") {
|
|
2774
2796
|
return attributeValue.value;
|
|
2775
2797
|
}
|
|
@@ -2778,10 +2800,10 @@ var isTruthyJsxAttributeValue2 = (attributeValue) => {
|
|
|
2778
2800
|
}
|
|
2779
2801
|
return false;
|
|
2780
2802
|
}
|
|
2781
|
-
if (attributeValue.type !==
|
|
2803
|
+
if (attributeValue.type !== import_utils30.AST_NODE_TYPES.JSXExpressionContainer) {
|
|
2782
2804
|
return false;
|
|
2783
2805
|
}
|
|
2784
|
-
if (attributeValue.expression.type ===
|
|
2806
|
+
if (attributeValue.expression.type === import_utils30.AST_NODE_TYPES.Literal && typeof attributeValue.expression.value === "boolean") {
|
|
2785
2807
|
return attributeValue.expression.value;
|
|
2786
2808
|
}
|
|
2787
2809
|
return true;
|
|
@@ -2790,8 +2812,8 @@ var webPreferencesHasNodeIntegration = (attributeValue) => {
|
|
|
2790
2812
|
if (attributeValue === null) {
|
|
2791
2813
|
return false;
|
|
2792
2814
|
}
|
|
2793
|
-
if (attributeValue.type ===
|
|
2794
|
-
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);
|
|
2795
2817
|
}
|
|
2796
2818
|
return false;
|
|
2797
2819
|
};
|
|
@@ -2803,7 +2825,7 @@ var rule38 = createRule({
|
|
|
2803
2825
|
return;
|
|
2804
2826
|
}
|
|
2805
2827
|
for (const attributeNode of node.attributes) {
|
|
2806
|
-
if (attributeNode.type !==
|
|
2828
|
+
if (attributeNode.type !== import_utils30.AST_NODE_TYPES.JSXAttribute) {
|
|
2807
2829
|
continue;
|
|
2808
2830
|
}
|
|
2809
2831
|
const attributeName = getJsxAttributeName3(attributeNode);
|
|
@@ -2854,16 +2876,17 @@ var rule38 = createRule({
|
|
|
2854
2876
|
var no_electron_webview_node_integration_default = rule38;
|
|
2855
2877
|
|
|
2856
2878
|
// dist/rules/no-html-method.js
|
|
2879
|
+
var import_utils31 = require("@typescript-eslint/utils");
|
|
2857
2880
|
var rule39 = createRule({
|
|
2858
2881
|
create(context) {
|
|
2859
2882
|
return {
|
|
2860
2883
|
"CallExpression[arguments.length=1] > MemberExpression.callee[property.name='html']"(node) {
|
|
2861
2884
|
const parentCall = node.parent;
|
|
2862
|
-
if (parentCall.type !==
|
|
2885
|
+
if (parentCall.type !== import_utils31.AST_NODE_TYPES.CallExpression) {
|
|
2863
2886
|
return;
|
|
2864
2887
|
}
|
|
2865
2888
|
const [firstArgument] = parentCall.arguments;
|
|
2866
|
-
if (firstArgument?.type ===
|
|
2889
|
+
if (firstArgument?.type === import_utils31.AST_NODE_TYPES.Literal && (firstArgument.value === "" || firstArgument.value === null)) {
|
|
2867
2890
|
return;
|
|
2868
2891
|
}
|
|
2869
2892
|
context.report({
|
|
@@ -2892,38 +2915,39 @@ var rule39 = createRule({
|
|
|
2892
2915
|
var no_html_method_default = rule39;
|
|
2893
2916
|
|
|
2894
2917
|
// dist/rules/no-http-request-to-insecure-protocol.js
|
|
2918
|
+
var import_utils32 = require("@typescript-eslint/utils");
|
|
2895
2919
|
var import_ts_extras20 = require("ts-extras");
|
|
2896
2920
|
var getMemberPropertyName11 = (memberExpression) => {
|
|
2897
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
2921
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils32.AST_NODE_TYPES.Identifier) {
|
|
2898
2922
|
return memberExpression.property.name;
|
|
2899
2923
|
}
|
|
2900
|
-
if (memberExpression.property.type ===
|
|
2924
|
+
if (memberExpression.property.type === import_utils32.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
2901
2925
|
return memberExpression.property.value;
|
|
2902
2926
|
}
|
|
2903
2927
|
return void 0;
|
|
2904
2928
|
};
|
|
2905
2929
|
var getStaticStringValue4 = (node) => {
|
|
2906
|
-
if (node.type ===
|
|
2930
|
+
if (node.type === import_utils32.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
2907
2931
|
return node.value;
|
|
2908
2932
|
}
|
|
2909
|
-
if (node.type ===
|
|
2933
|
+
if (node.type === import_utils32.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
2910
2934
|
return (0, import_ts_extras20.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
2911
2935
|
}
|
|
2912
2936
|
return void 0;
|
|
2913
2937
|
};
|
|
2914
|
-
var isInsecureHttpUrl = (value) => /^http:\/\//
|
|
2938
|
+
var isInsecureHttpUrl = (value) => /^http:\/\//iv.test(value.trim());
|
|
2915
2939
|
var isTargetRequestMethod = (node) => {
|
|
2916
|
-
if (node.callee.type ===
|
|
2940
|
+
if (node.callee.type === import_utils32.AST_NODE_TYPES.Identifier) {
|
|
2917
2941
|
return node.callee.name === "fetch";
|
|
2918
2942
|
}
|
|
2919
|
-
if (node.callee.type !==
|
|
2943
|
+
if (node.callee.type !== import_utils32.AST_NODE_TYPES.MemberExpression) {
|
|
2920
2944
|
return false;
|
|
2921
2945
|
}
|
|
2922
2946
|
const methodName = getMemberPropertyName11(node.callee);
|
|
2923
2947
|
if (methodName !== "request" && methodName !== "get") {
|
|
2924
2948
|
return false;
|
|
2925
2949
|
}
|
|
2926
|
-
if (node.callee.object.type !==
|
|
2950
|
+
if (node.callee.object.type !== import_utils32.AST_NODE_TYPES.Identifier) {
|
|
2927
2951
|
return false;
|
|
2928
2952
|
}
|
|
2929
2953
|
return node.callee.object.name === "http" || node.callee.object.name === "https";
|
|
@@ -2936,7 +2960,7 @@ var rule40 = createRule({
|
|
|
2936
2960
|
return;
|
|
2937
2961
|
}
|
|
2938
2962
|
const [firstArgument] = node.arguments;
|
|
2939
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
2963
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils32.AST_NODE_TYPES.SpreadElement) {
|
|
2940
2964
|
return;
|
|
2941
2965
|
}
|
|
2942
2966
|
const firstArgumentValue = getStaticStringValue4(firstArgument);
|
|
@@ -2946,7 +2970,7 @@ var rule40 = createRule({
|
|
|
2946
2970
|
context.report({
|
|
2947
2971
|
fix(fixer) {
|
|
2948
2972
|
const sourceText = context.sourceCode.getText(firstArgument);
|
|
2949
|
-
const fixedSourceText = sourceText.replace(/^(?<quote>["'`]?)http:\/\//
|
|
2973
|
+
const fixedSourceText = sourceText.replace(/^(?<quote>["'`]?)http:\/\//iv, "$<quote>https://");
|
|
2950
2974
|
if (fixedSourceText === sourceText) {
|
|
2951
2975
|
return null;
|
|
2952
2976
|
}
|
|
@@ -2978,27 +3002,28 @@ var rule40 = createRule({
|
|
|
2978
3002
|
var no_http_request_to_insecure_protocol_default = rule40;
|
|
2979
3003
|
|
|
2980
3004
|
// dist/rules/no-iframe-srcdoc.js
|
|
3005
|
+
var import_utils33 = require("@typescript-eslint/utils");
|
|
2981
3006
|
var isJsxIframeElement = (node) => {
|
|
2982
|
-
if (node.name.type !==
|
|
3007
|
+
if (node.name.type !== import_utils33.AST_NODE_TYPES.JSXIdentifier) {
|
|
2983
3008
|
return false;
|
|
2984
3009
|
}
|
|
2985
3010
|
return node.name.name.toLowerCase() === "iframe";
|
|
2986
3011
|
};
|
|
2987
3012
|
var getJsxAttributeName4 = (attributeNode) => {
|
|
2988
|
-
if (attributeNode.name.type !==
|
|
3013
|
+
if (attributeNode.name.type !== import_utils33.AST_NODE_TYPES.JSXIdentifier) {
|
|
2989
3014
|
return void 0;
|
|
2990
3015
|
}
|
|
2991
3016
|
return attributeNode.name.name.toLowerCase();
|
|
2992
3017
|
};
|
|
2993
3018
|
var isCreateElementIFrameCall = (node) => {
|
|
2994
|
-
if (node.type !==
|
|
3019
|
+
if (node.type !== import_utils33.AST_NODE_TYPES.CallExpression || node.callee.type !== import_utils33.AST_NODE_TYPES.MemberExpression) {
|
|
2995
3020
|
return false;
|
|
2996
3021
|
}
|
|
2997
3022
|
if (getMemberPropertyName3(node.callee) !== "createElement") {
|
|
2998
3023
|
return false;
|
|
2999
3024
|
}
|
|
3000
3025
|
const [firstArgument] = node.arguments;
|
|
3001
|
-
return firstArgument !== void 0 && firstArgument.type !==
|
|
3026
|
+
return firstArgument !== void 0 && firstArgument.type !== import_utils33.AST_NODE_TYPES.SpreadElement && getStaticStringValue(firstArgument) === "iframe";
|
|
3002
3027
|
};
|
|
3003
3028
|
var isLikelyIFrameElement = (node, context, fullTypeChecker) => {
|
|
3004
3029
|
if (fullTypeChecker !== void 0) {
|
|
@@ -3010,11 +3035,11 @@ var isLikelyIFrameElement = (node, context, fullTypeChecker) => {
|
|
|
3010
3035
|
if (isCreateElementIFrameCall(node)) {
|
|
3011
3036
|
return true;
|
|
3012
3037
|
}
|
|
3013
|
-
if (node.type ===
|
|
3038
|
+
if (node.type === import_utils33.AST_NODE_TYPES.Identifier) {
|
|
3014
3039
|
const normalizedName = node.name.toLowerCase();
|
|
3015
3040
|
return normalizedName === "frame" || normalizedName.endsWith("iframe");
|
|
3016
3041
|
}
|
|
3017
|
-
if (node.type !==
|
|
3042
|
+
if (node.type !== import_utils33.AST_NODE_TYPES.MemberExpression) {
|
|
3018
3043
|
return false;
|
|
3019
3044
|
}
|
|
3020
3045
|
const propertyName = getMemberPropertyName3(node);
|
|
@@ -3028,7 +3053,7 @@ var rule41 = createRule({
|
|
|
3028
3053
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
3029
3054
|
return {
|
|
3030
3055
|
AssignmentExpression(node) {
|
|
3031
|
-
if (node.left.type !==
|
|
3056
|
+
if (node.left.type !== import_utils33.AST_NODE_TYPES.MemberExpression) {
|
|
3032
3057
|
return;
|
|
3033
3058
|
}
|
|
3034
3059
|
if (getMemberPropertyName3(node.left) !== "srcdoc") {
|
|
@@ -3046,7 +3071,7 @@ var rule41 = createRule({
|
|
|
3046
3071
|
});
|
|
3047
3072
|
},
|
|
3048
3073
|
CallExpression(node) {
|
|
3049
|
-
if (node.callee.type !==
|
|
3074
|
+
if (node.callee.type !== import_utils33.AST_NODE_TYPES.MemberExpression) {
|
|
3050
3075
|
return;
|
|
3051
3076
|
}
|
|
3052
3077
|
const methodName = getMemberPropertyName3(node.callee);
|
|
@@ -3054,10 +3079,10 @@ var rule41 = createRule({
|
|
|
3054
3079
|
return;
|
|
3055
3080
|
}
|
|
3056
3081
|
const [firstArgument, secondArgument] = node.arguments;
|
|
3057
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
3082
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils33.AST_NODE_TYPES.SpreadElement || getStaticStringValue(firstArgument) !== "srcdoc") {
|
|
3058
3083
|
return;
|
|
3059
3084
|
}
|
|
3060
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
3085
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils33.AST_NODE_TYPES.SpreadElement || getStaticStringValue(secondArgument) === "") {
|
|
3061
3086
|
return;
|
|
3062
3087
|
}
|
|
3063
3088
|
if (!isLikelyIFrameElement(node.callee.object, context, fullTypeChecker)) {
|
|
@@ -3073,7 +3098,7 @@ var rule41 = createRule({
|
|
|
3073
3098
|
return;
|
|
3074
3099
|
}
|
|
3075
3100
|
for (const attributeNode of node.attributes) {
|
|
3076
|
-
if (attributeNode.type !==
|
|
3101
|
+
if (attributeNode.type !== import_utils33.AST_NODE_TYPES.JSXAttribute) {
|
|
3077
3102
|
continue;
|
|
3078
3103
|
}
|
|
3079
3104
|
if (getJsxAttributeName4(attributeNode) !== "srcdoc") {
|
|
@@ -3109,20 +3134,21 @@ var rule41 = createRule({
|
|
|
3109
3134
|
var no_iframe_srcdoc_default = rule41;
|
|
3110
3135
|
|
|
3111
3136
|
// dist/rules/no-inner-html.js
|
|
3112
|
-
var
|
|
3137
|
+
var import_utils34 = require("@typescript-eslint/utils");
|
|
3138
|
+
var isEmptyStringLiteral = (node) => node.type === import_utils34.AST_NODE_TYPES.Literal && node.value === "";
|
|
3113
3139
|
var rule42 = createRule({
|
|
3114
3140
|
create(context) {
|
|
3115
3141
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
3116
3142
|
const mightBeHTMLElement = (node) => {
|
|
3117
3143
|
const nodeType = getNodeTypeAsString(fullTypeChecker, node, context);
|
|
3118
|
-
return /HTML.*Element/
|
|
3144
|
+
return /HTML.*Element/v.test(nodeType) || nodeType === "any";
|
|
3119
3145
|
};
|
|
3120
3146
|
return {
|
|
3121
3147
|
"AssignmentExpression[left.type='MemberExpression'][left.property.name=/^(?:innerHTML|outerHTML)$/]"(node) {
|
|
3122
3148
|
if (isEmptyStringLiteral(node.right)) {
|
|
3123
3149
|
return;
|
|
3124
3150
|
}
|
|
3125
|
-
if (node.left.type !==
|
|
3151
|
+
if (node.left.type !== import_utils34.AST_NODE_TYPES.MemberExpression) {
|
|
3126
3152
|
return;
|
|
3127
3153
|
}
|
|
3128
3154
|
if (!mightBeHTMLElement(node.left.object)) {
|
|
@@ -3134,7 +3160,7 @@ var rule42 = createRule({
|
|
|
3134
3160
|
});
|
|
3135
3161
|
},
|
|
3136
3162
|
"CallExpression[arguments.length=2] > MemberExpression.callee[property.name='insertAdjacentHTML']"(node) {
|
|
3137
|
-
if (node.parent.type !==
|
|
3163
|
+
if (node.parent.type !== import_utils34.AST_NODE_TYPES.CallExpression) {
|
|
3138
3164
|
return;
|
|
3139
3165
|
}
|
|
3140
3166
|
const secondArgument = node.parent.arguments[1];
|
|
@@ -3171,23 +3197,25 @@ var rule42 = createRule({
|
|
|
3171
3197
|
var no_inner_html_default = rule42;
|
|
3172
3198
|
|
|
3173
3199
|
// dist/rules/no-insecure-random.js
|
|
3174
|
-
var
|
|
3200
|
+
var import_utils35 = require("@typescript-eslint/utils");
|
|
3201
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
3175
3202
|
var import_ts_extras21 = require("ts-extras");
|
|
3176
3203
|
var bannedRandomLibraries = [
|
|
3177
3204
|
"chance",
|
|
3178
|
-
"random-number",
|
|
3179
|
-
"random-int",
|
|
3180
3205
|
"random-float",
|
|
3206
|
+
"random-int",
|
|
3207
|
+
"random-number",
|
|
3181
3208
|
"random-seed",
|
|
3182
3209
|
"unique-random"
|
|
3183
3210
|
];
|
|
3184
|
-
var
|
|
3211
|
+
var bannedRandomLibrarySet = new Set(bannedRandomLibraries);
|
|
3212
|
+
var isBannedRandomLibrary = (value) => (0, import_ts_extras21.setHas)(bannedRandomLibrarySet, value);
|
|
3185
3213
|
var rule43 = createRule({
|
|
3186
3214
|
create(context) {
|
|
3187
3215
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
3188
3216
|
return {
|
|
3189
3217
|
"CallExpression > MemberExpression[property.name='pseudoRandomBytes']"(node) {
|
|
3190
|
-
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";
|
|
3191
3219
|
if (!isUnsafe) {
|
|
3192
3220
|
return;
|
|
3193
3221
|
}
|
|
@@ -3197,7 +3225,7 @@ var rule43 = createRule({
|
|
|
3197
3225
|
});
|
|
3198
3226
|
},
|
|
3199
3227
|
"CallExpression > MemberExpression[property.name='random']"(node) {
|
|
3200
|
-
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";
|
|
3201
3229
|
if (!isUnsafe) {
|
|
3202
3230
|
return;
|
|
3203
3231
|
}
|
|
@@ -3208,10 +3236,10 @@ var rule43 = createRule({
|
|
|
3208
3236
|
},
|
|
3209
3237
|
"CallExpression[callee.name='require'][arguments.length=1]"(node) {
|
|
3210
3238
|
const [sourceArgument] = node.arguments;
|
|
3211
|
-
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") {
|
|
3212
3240
|
return;
|
|
3213
3241
|
}
|
|
3214
|
-
const requireName =
|
|
3242
|
+
const requireName = import_node_path.default.parse(import_node_path.default.basename(sourceArgument.value)).name;
|
|
3215
3243
|
if (!isBannedRandomLibrary(requireName)) {
|
|
3216
3244
|
return;
|
|
3217
3245
|
}
|
|
@@ -3225,7 +3253,7 @@ var rule43 = createRule({
|
|
|
3225
3253
|
if (typeof sourceText !== "string") {
|
|
3226
3254
|
return;
|
|
3227
3255
|
}
|
|
3228
|
-
if (!isBannedRandomLibrary(
|
|
3256
|
+
if (!isBannedRandomLibrary(import_node_path.default.basename(sourceText))) {
|
|
3229
3257
|
return;
|
|
3230
3258
|
}
|
|
3231
3259
|
context.report({
|
|
@@ -3254,22 +3282,20 @@ var rule43 = createRule({
|
|
|
3254
3282
|
var no_insecure_random_default = rule43;
|
|
3255
3283
|
|
|
3256
3284
|
// dist/rules/no-insecure-tls-agent-options.js
|
|
3257
|
-
var
|
|
3285
|
+
var import_utils36 = require("@typescript-eslint/utils");
|
|
3286
|
+
var isFalseLiteral = (node) => node.type === import_utils36.AST_NODE_TYPES.Literal && node.value === false;
|
|
3258
3287
|
var getObjectPropertyName = (propertyNode) => {
|
|
3259
3288
|
if (propertyNode.computed) {
|
|
3260
3289
|
return void 0;
|
|
3261
3290
|
}
|
|
3262
|
-
if (propertyNode.key.type ===
|
|
3291
|
+
if (propertyNode.key.type === import_utils36.AST_NODE_TYPES.Identifier) {
|
|
3263
3292
|
return propertyNode.key.name;
|
|
3264
3293
|
}
|
|
3265
|
-
|
|
3266
|
-
return propertyNode.key.value;
|
|
3267
|
-
}
|
|
3268
|
-
return void 0;
|
|
3294
|
+
return typeof propertyNode.key.value === "string" ? propertyNode.key.value : void 0;
|
|
3269
3295
|
};
|
|
3270
3296
|
var findRejectUnauthorizedFalseProperty = (objectExpression) => {
|
|
3271
3297
|
for (const propertyNode of objectExpression.properties) {
|
|
3272
|
-
if (propertyNode.type !==
|
|
3298
|
+
if (propertyNode.type !== import_utils36.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
3273
3299
|
continue;
|
|
3274
3300
|
}
|
|
3275
3301
|
if (getObjectPropertyName(propertyNode) !== "rejectUnauthorized") {
|
|
@@ -3291,7 +3317,7 @@ var rule44 = createRule({
|
|
|
3291
3317
|
}
|
|
3292
3318
|
context.report({
|
|
3293
3319
|
fix(fixer) {
|
|
3294
|
-
if (insecureOptionProperty.value.type !==
|
|
3320
|
+
if (insecureOptionProperty.value.type !== import_utils36.AST_NODE_TYPES.Literal || insecureOptionProperty.value.value !== false) {
|
|
3295
3321
|
return null;
|
|
3296
3322
|
}
|
|
3297
3323
|
return fixer.replaceText(insecureOptionProperty.value, "true");
|
|
@@ -3322,13 +3348,14 @@ var rule44 = createRule({
|
|
|
3322
3348
|
var no_insecure_tls_agent_options_default = rule44;
|
|
3323
3349
|
|
|
3324
3350
|
// dist/rules/no-insecure-url.js
|
|
3325
|
-
var
|
|
3351
|
+
var import_utils37 = require("@typescript-eslint/utils");
|
|
3352
|
+
var defaultBlocklist = [/^(?:ftp|http|telnet|ws):\/\//iv];
|
|
3326
3353
|
var defaultExceptions = [
|
|
3327
|
-
/^http:(?:\/\/|\\u002f\\u002f)schemas\.microsoft\.com.*/
|
|
3328
|
-
/^http:(?:\/\/|\\u002f\\u002f)schemas\.openxmlformats\.org.*/
|
|
3329
|
-
/^http:(?:\/|\\u002f){2}localhost(?::|\/|\\u002f)*/
|
|
3330
|
-
/^http:\/\/w{3}\.w3\.org\/1999\/xhtml/
|
|
3331
|
-
/^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
|
|
3332
3359
|
];
|
|
3333
3360
|
var defaultVariableExceptions = [];
|
|
3334
3361
|
var asCaseInsensitiveRegex = (pattern) => {
|
|
@@ -3347,10 +3374,10 @@ var shouldAttemptFix = (variableExceptions, context, node) => {
|
|
|
3347
3374
|
var reportInsecureUrl = (context, node, replacementSourceText) => {
|
|
3348
3375
|
context.report({
|
|
3349
3376
|
fix(fixer) {
|
|
3350
|
-
if (!/http:/
|
|
3377
|
+
if (!/http:/iv.test(replacementSourceText)) {
|
|
3351
3378
|
return null;
|
|
3352
3379
|
}
|
|
3353
|
-
return fixer.replaceText(node, replacementSourceText.replace(/http:/
|
|
3380
|
+
return fixer.replaceText(node, replacementSourceText.replace(/http:/iv, "https:"));
|
|
3354
3381
|
},
|
|
3355
3382
|
messageId: "doNotUseInsecureUrl",
|
|
3356
3383
|
node
|
|
@@ -3367,7 +3394,7 @@ var rule45 = createRule({
|
|
|
3367
3394
|
if (typeof node.value !== "string") {
|
|
3368
3395
|
return;
|
|
3369
3396
|
}
|
|
3370
|
-
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") {
|
|
3371
3398
|
return;
|
|
3372
3399
|
}
|
|
3373
3400
|
if (!matches(blocklist, node.value) || matches(exceptions, node.value)) {
|
|
@@ -3441,28 +3468,29 @@ var rule45 = createRule({
|
|
|
3441
3468
|
var no_insecure_url_default = rule45;
|
|
3442
3469
|
|
|
3443
3470
|
// dist/rules/no-location-javascript-url.js
|
|
3471
|
+
var import_utils38 = require("@typescript-eslint/utils");
|
|
3444
3472
|
var import_ts_extras22 = require("ts-extras");
|
|
3445
3473
|
var getMemberPropertyName12 = (memberExpression) => {
|
|
3446
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
3474
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils38.AST_NODE_TYPES.Identifier) {
|
|
3447
3475
|
return memberExpression.property.name;
|
|
3448
3476
|
}
|
|
3449
|
-
if (memberExpression.property.type ===
|
|
3477
|
+
if (memberExpression.property.type === import_utils38.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
3450
3478
|
return memberExpression.property.value;
|
|
3451
3479
|
}
|
|
3452
3480
|
return void 0;
|
|
3453
3481
|
};
|
|
3454
3482
|
var getStaticStringValue5 = (node) => {
|
|
3455
|
-
if (node.type ===
|
|
3483
|
+
if (node.type === import_utils38.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
3456
3484
|
return node.value;
|
|
3457
3485
|
}
|
|
3458
|
-
if (node.type ===
|
|
3486
|
+
if (node.type === import_utils38.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
3459
3487
|
return (0, import_ts_extras22.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
3460
3488
|
}
|
|
3461
3489
|
return void 0;
|
|
3462
3490
|
};
|
|
3463
|
-
var isJavaScriptUrl2 = (value) => /^\s*javascript\s*:/
|
|
3491
|
+
var isJavaScriptUrl2 = (value) => /^\s*javascript\s*:/iv.test(value);
|
|
3464
3492
|
var isLocationLikeLeftHand = (expression) => {
|
|
3465
|
-
if (expression.type !==
|
|
3493
|
+
if (expression.type !== import_utils38.AST_NODE_TYPES.MemberExpression) {
|
|
3466
3494
|
return false;
|
|
3467
3495
|
}
|
|
3468
3496
|
const propertyName = getMemberPropertyName12(expression);
|
|
@@ -3488,7 +3516,7 @@ var rule46 = createRule({
|
|
|
3488
3516
|
});
|
|
3489
3517
|
},
|
|
3490
3518
|
CallExpression(node) {
|
|
3491
|
-
if (node.callee.type !==
|
|
3519
|
+
if (node.callee.type !== import_utils38.AST_NODE_TYPES.MemberExpression) {
|
|
3492
3520
|
return;
|
|
3493
3521
|
}
|
|
3494
3522
|
const methodName = getMemberPropertyName12(node.callee);
|
|
@@ -3496,7 +3524,7 @@ var rule46 = createRule({
|
|
|
3496
3524
|
return;
|
|
3497
3525
|
}
|
|
3498
3526
|
const [firstArgument] = node.arguments;
|
|
3499
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
3527
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils38.AST_NODE_TYPES.SpreadElement) {
|
|
3500
3528
|
return;
|
|
3501
3529
|
}
|
|
3502
3530
|
const argumentValue = getStaticStringValue5(firstArgument);
|
|
@@ -3529,19 +3557,13 @@ var rule46 = createRule({
|
|
|
3529
3557
|
var no_location_javascript_url_default = rule46;
|
|
3530
3558
|
|
|
3531
3559
|
// dist/rules/no-message-event-without-origin-check.js
|
|
3560
|
+
var import_utils39 = require("@typescript-eslint/utils");
|
|
3532
3561
|
var import_ts_extras23 = require("ts-extras");
|
|
3533
|
-
var isFunctionExpression6 = (expression) => expression.type ===
|
|
3534
|
-
var hasMessageEventGuardKeywords = (callbackText) => /\b(?:allowlist|origin|trusted|validate|verify|whitelist)\b/
|
|
3535
|
-
var
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
}
|
|
3539
|
-
const recordValue = value;
|
|
3540
|
-
if (!(0, import_ts_extras23.keyIn)(recordValue, "type") || typeof recordValue["type"] !== "string") {
|
|
3541
|
-
return void 0;
|
|
3542
|
-
}
|
|
3543
|
-
return recordValue;
|
|
3544
|
-
};
|
|
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;
|
|
3545
3567
|
var someDescendantNode = (node, predicate) => {
|
|
3546
3568
|
if (predicate(node)) {
|
|
3547
3569
|
return true;
|
|
@@ -3566,26 +3588,26 @@ var someDescendantNode = (node, predicate) => {
|
|
|
3566
3588
|
}
|
|
3567
3589
|
return false;
|
|
3568
3590
|
};
|
|
3569
|
-
var isIdentifierNamed = (node, identifierName) => node.type ===
|
|
3591
|
+
var isIdentifierNamed = (node, identifierName) => node.type === import_utils39.AST_NODE_TYPES.Identifier && node.name === identifierName;
|
|
3570
3592
|
var isStaticPropertyMatch = (memberExpression, objectName, propertyName) => isIdentifierNamed(memberExpression.object, objectName) && getMemberPropertyName3(memberExpression) === propertyName;
|
|
3571
3593
|
var patternContainsProperty = (pattern, propertyName) => pattern.properties.some((propertyNode) => {
|
|
3572
|
-
if (propertyNode.type !==
|
|
3594
|
+
if (propertyNode.type !== import_utils39.AST_NODE_TYPES.Property) {
|
|
3573
3595
|
return false;
|
|
3574
3596
|
}
|
|
3575
3597
|
return getPropertyName(propertyNode) === propertyName;
|
|
3576
3598
|
});
|
|
3577
3599
|
var containsObjectDestructureFromIdentifier = (rootNode, sourceName, propertyName) => someDescendantNode(rootNode, (node) => {
|
|
3578
|
-
if (node.type ===
|
|
3579
|
-
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);
|
|
3580
3602
|
}
|
|
3581
|
-
if (node.type !==
|
|
3603
|
+
if (node.type !== import_utils39.AST_NODE_TYPES.AssignmentExpression) {
|
|
3582
3604
|
return false;
|
|
3583
3605
|
}
|
|
3584
|
-
return node.left.type ===
|
|
3606
|
+
return node.left.type === import_utils39.AST_NODE_TYPES.ObjectPattern && isIdentifierNamed(node.right, sourceName) && patternContainsProperty(node.left, propertyName);
|
|
3585
3607
|
});
|
|
3586
|
-
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);
|
|
3587
3609
|
var hasObjectPatternProperty = (objectPattern, propertyName) => objectPattern.properties.some((propertyNode) => {
|
|
3588
|
-
if (propertyNode.type !==
|
|
3610
|
+
if (propertyNode.type !== import_utils39.AST_NODE_TYPES.Property) {
|
|
3589
3611
|
return false;
|
|
3590
3612
|
}
|
|
3591
3613
|
return getPropertyName(propertyNode) === propertyName;
|
|
@@ -3607,28 +3629,28 @@ var reportsObjectPatternCallback = (callbackNode, context, eventParameter) => {
|
|
|
3607
3629
|
};
|
|
3608
3630
|
var shouldReportMessageEventCallback = (callbackNode, context) => {
|
|
3609
3631
|
const [firstParameter] = callbackNode.params;
|
|
3610
|
-
if (firstParameter === void 0 || firstParameter.type ===
|
|
3632
|
+
if (firstParameter === void 0 || firstParameter.type === import_utils39.AST_NODE_TYPES.RestElement) {
|
|
3611
3633
|
return false;
|
|
3612
3634
|
}
|
|
3613
|
-
if (firstParameter.type ===
|
|
3635
|
+
if (firstParameter.type === import_utils39.AST_NODE_TYPES.Identifier) {
|
|
3614
3636
|
return reportsIdentifierCallback(callbackNode, context, firstParameter);
|
|
3615
3637
|
}
|
|
3616
|
-
if (firstParameter.type ===
|
|
3638
|
+
if (firstParameter.type === import_utils39.AST_NODE_TYPES.ObjectPattern) {
|
|
3617
3639
|
return reportsObjectPatternCallback(callbackNode, context, firstParameter);
|
|
3618
3640
|
}
|
|
3619
3641
|
return false;
|
|
3620
3642
|
};
|
|
3621
3643
|
var isMessageEventListenerCall = (node) => {
|
|
3622
|
-
if (node.callee.type !==
|
|
3644
|
+
if (node.callee.type !== import_utils39.AST_NODE_TYPES.MemberExpression) {
|
|
3623
3645
|
return false;
|
|
3624
3646
|
}
|
|
3625
3647
|
if (getMemberPropertyName3(node.callee) !== "addEventListener") {
|
|
3626
3648
|
return false;
|
|
3627
3649
|
}
|
|
3628
3650
|
const [firstArgument] = node.arguments;
|
|
3629
|
-
return firstArgument !== void 0 && firstArgument.type !==
|
|
3651
|
+
return firstArgument !== void 0 && firstArgument.type !== import_utils39.AST_NODE_TYPES.SpreadElement && getStaticStringValue(firstArgument) === "message";
|
|
3630
3652
|
};
|
|
3631
|
-
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";
|
|
3632
3654
|
var rule47 = createRule({
|
|
3633
3655
|
create(context) {
|
|
3634
3656
|
return {
|
|
@@ -3652,7 +3674,7 @@ var rule47 = createRule({
|
|
|
3652
3674
|
return;
|
|
3653
3675
|
}
|
|
3654
3676
|
const [, secondArgument] = node.arguments;
|
|
3655
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
3677
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils39.AST_NODE_TYPES.SpreadElement) {
|
|
3656
3678
|
return;
|
|
3657
3679
|
}
|
|
3658
3680
|
if (!isFunctionExpression6(secondArgument)) {
|
|
@@ -3717,9 +3739,11 @@ var rule48 = createRule({
|
|
|
3717
3739
|
var no_msapp_exec_unsafe_default = rule48;
|
|
3718
3740
|
|
|
3719
3741
|
// dist/rules/no-node-tls-check-server-identity-bypass.js
|
|
3742
|
+
var import_utils41 = require("@typescript-eslint/utils");
|
|
3720
3743
|
var import_ts_extras25 = require("ts-extras");
|
|
3721
3744
|
|
|
3722
3745
|
// dist/_internal/node-tls-config.js
|
|
3746
|
+
var import_utils40 = require("@typescript-eslint/utils");
|
|
3723
3747
|
var import_ts_extras24 = require("ts-extras");
|
|
3724
3748
|
var NODE_TLS_OBJECT_NAMES = /* @__PURE__ */ new Set([
|
|
3725
3749
|
"http2",
|
|
@@ -3735,43 +3759,43 @@ var NODE_TLS_CALL_METHOD_NAMES = /* @__PURE__ */ new Set([
|
|
|
3735
3759
|
"request"
|
|
3736
3760
|
]);
|
|
3737
3761
|
var isNodeTlsObjectExpression = (expression) => {
|
|
3738
|
-
if (expression.type ===
|
|
3762
|
+
if (expression.type === import_utils40.AST_NODE_TYPES.Identifier) {
|
|
3739
3763
|
return (0, import_ts_extras24.setHas)(NODE_TLS_OBJECT_NAMES, expression.name);
|
|
3740
3764
|
}
|
|
3741
|
-
if (expression.type !==
|
|
3765
|
+
if (expression.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
3742
3766
|
return false;
|
|
3743
3767
|
}
|
|
3744
3768
|
const propertyName = getMemberPropertyName3(expression);
|
|
3745
3769
|
return (0, import_ts_extras24.isDefined)(propertyName) && (0, import_ts_extras24.setHas)(NODE_TLS_OBJECT_NAMES, propertyName);
|
|
3746
3770
|
};
|
|
3747
3771
|
var isRelevantNodeTlsCall = (callee) => {
|
|
3748
|
-
if (callee.type ===
|
|
3772
|
+
if (callee.type === import_utils40.AST_NODE_TYPES.Identifier) {
|
|
3749
3773
|
return callee.name === "createSecureContext";
|
|
3750
3774
|
}
|
|
3751
|
-
if (callee.type !==
|
|
3775
|
+
if (callee.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
3752
3776
|
return false;
|
|
3753
3777
|
}
|
|
3754
3778
|
const methodName = getMemberPropertyName3(callee);
|
|
3755
3779
|
return (0, import_ts_extras24.isDefined)(methodName) && (0, import_ts_extras24.setHas)(NODE_TLS_CALL_METHOD_NAMES, methodName) && isNodeTlsObjectExpression(callee.object);
|
|
3756
3780
|
};
|
|
3757
3781
|
var isRelevantNodeTlsConstructor = (callee) => {
|
|
3758
|
-
if (callee.type !==
|
|
3782
|
+
if (callee.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
3759
3783
|
return false;
|
|
3760
3784
|
}
|
|
3761
3785
|
return getMemberPropertyName3(callee) === "Agent" && isNodeTlsObjectExpression(callee.object);
|
|
3762
3786
|
};
|
|
3763
3787
|
var isRelevantNodeTlsOptionsObject = (node) => {
|
|
3764
3788
|
const parentNode = node.parent;
|
|
3765
|
-
if (parentNode
|
|
3789
|
+
if (parentNode.type === import_utils40.AST_NODE_TYPES.CallExpression) {
|
|
3766
3790
|
return isRelevantNodeTlsCall(parentNode.callee);
|
|
3767
3791
|
}
|
|
3768
|
-
if (parentNode
|
|
3792
|
+
if (parentNode.type === import_utils40.AST_NODE_TYPES.NewExpression) {
|
|
3769
3793
|
return isRelevantNodeTlsConstructor(parentNode.callee);
|
|
3770
3794
|
}
|
|
3771
3795
|
return false;
|
|
3772
3796
|
};
|
|
3773
3797
|
var isNodeTlsStaticMember = (node, propertyNames) => {
|
|
3774
|
-
if (node.type !==
|
|
3798
|
+
if (node.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
3775
3799
|
return false;
|
|
3776
3800
|
}
|
|
3777
3801
|
const propertyName = getMemberPropertyName3(node);
|
|
@@ -3780,19 +3804,19 @@ var isNodeTlsStaticMember = (node, propertyNames) => {
|
|
|
3780
3804
|
|
|
3781
3805
|
// dist/rules/no-node-tls-check-server-identity-bypass.js
|
|
3782
3806
|
var CHECK_SERVER_IDENTITY_PROPERTY_NAMES = /* @__PURE__ */ new Set(["checkServerIdentity"]);
|
|
3783
|
-
var isFunctionExpression7 = (expression) => expression.type ===
|
|
3784
|
-
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;
|
|
3785
3809
|
var isAlwaysSuccessfulReturnExpression = (expression) => {
|
|
3786
|
-
if (expression.type ===
|
|
3810
|
+
if (expression.type === import_utils41.AST_NODE_TYPES.Identifier) {
|
|
3787
3811
|
return expression.name === "undefined";
|
|
3788
3812
|
}
|
|
3789
|
-
if (expression.type ===
|
|
3813
|
+
if (expression.type === import_utils41.AST_NODE_TYPES.Literal) {
|
|
3790
3814
|
return expression.value === null;
|
|
3791
3815
|
}
|
|
3792
|
-
return expression.type ===
|
|
3816
|
+
return expression.type === import_utils41.AST_NODE_TYPES.UnaryExpression && expression.operator === "void";
|
|
3793
3817
|
};
|
|
3794
3818
|
var isAlwaysSuccessfulCheckServerIdentity = (callbackNode) => {
|
|
3795
|
-
if (callbackNode.body.type !==
|
|
3819
|
+
if (callbackNode.body.type !== import_utils41.AST_NODE_TYPES.BlockStatement) {
|
|
3796
3820
|
return isAlwaysSuccessfulReturnExpression(callbackNode.body);
|
|
3797
3821
|
}
|
|
3798
3822
|
if (callbackNode.body.body.length === 0) {
|
|
@@ -3802,10 +3826,10 @@ var isAlwaysSuccessfulCheckServerIdentity = (callbackNode) => {
|
|
|
3802
3826
|
return false;
|
|
3803
3827
|
}
|
|
3804
3828
|
const onlyStatement = (0, import_ts_extras25.arrayFirst)(callbackNode.body.body);
|
|
3805
|
-
if (onlyStatement?.type !==
|
|
3829
|
+
if (onlyStatement?.type !== import_utils41.AST_NODE_TYPES.ReturnStatement) {
|
|
3806
3830
|
return false;
|
|
3807
3831
|
}
|
|
3808
|
-
return onlyStatement.argument === null ||
|
|
3832
|
+
return onlyStatement.argument === null || isAlwaysSuccessfulReturnExpression(onlyStatement.argument);
|
|
3809
3833
|
};
|
|
3810
3834
|
var rule49 = createRule({
|
|
3811
3835
|
create(context) {
|
|
@@ -3824,7 +3848,7 @@ var rule49 = createRule({
|
|
|
3824
3848
|
return;
|
|
3825
3849
|
}
|
|
3826
3850
|
for (const propertyNode of node.properties) {
|
|
3827
|
-
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)) {
|
|
3828
3852
|
continue;
|
|
3829
3853
|
}
|
|
3830
3854
|
context.report({
|
|
@@ -3854,14 +3878,15 @@ var rule49 = createRule({
|
|
|
3854
3878
|
var no_node_tls_check_server_identity_bypass_default = rule49;
|
|
3855
3879
|
|
|
3856
3880
|
// dist/rules/no-node-tls-legacy-protocol.js
|
|
3881
|
+
var import_utils42 = require("@typescript-eslint/utils");
|
|
3857
3882
|
var import_ts_extras26 = require("ts-extras");
|
|
3858
3883
|
var LEGACY_TLS_VERSION_VALUES = /* @__PURE__ */ new Set([
|
|
3859
3884
|
"TLSv1",
|
|
3860
3885
|
"TLSv1.0",
|
|
3861
3886
|
"TLSv1.1"
|
|
3862
3887
|
]);
|
|
3863
|
-
var isLegacySecureProtocolValue = (value) => /^(?:SSLv2|SSLv3|TLSv1(?:_1)?)(?:_(?:client|server))?_method$/
|
|
3864
|
-
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;
|
|
3865
3890
|
var isLegacyTlsPropertyValue = (propertyName, configuredValue) => {
|
|
3866
3891
|
if (propertyName === "secureProtocol") {
|
|
3867
3892
|
return isLegacySecureProtocolValue(configuredValue);
|
|
@@ -3901,7 +3926,7 @@ var rule50 = createRule({
|
|
|
3901
3926
|
return;
|
|
3902
3927
|
}
|
|
3903
3928
|
for (const propertyNode of node.properties) {
|
|
3904
|
-
if (propertyNode.type !==
|
|
3929
|
+
if (propertyNode.type !== import_utils42.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
3905
3930
|
continue;
|
|
3906
3931
|
}
|
|
3907
3932
|
if (!isExpressionNode3(propertyNode.value)) {
|
|
@@ -3946,27 +3971,28 @@ var rule50 = createRule({
|
|
|
3946
3971
|
var no_node_tls_legacy_protocol_default = rule50;
|
|
3947
3972
|
|
|
3948
3973
|
// dist/rules/no-node-tls-reject-unauthorized-zero.js
|
|
3974
|
+
var import_utils43 = require("@typescript-eslint/utils");
|
|
3949
3975
|
var import_ts_extras27 = require("ts-extras");
|
|
3950
3976
|
var getMemberPropertyName13 = (memberExpression) => {
|
|
3951
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
3977
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils43.AST_NODE_TYPES.Identifier) {
|
|
3952
3978
|
return memberExpression.property.name;
|
|
3953
3979
|
}
|
|
3954
|
-
if (memberExpression.property.type ===
|
|
3980
|
+
if (memberExpression.property.type === import_utils43.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
3955
3981
|
return memberExpression.property.value;
|
|
3956
3982
|
}
|
|
3957
3983
|
return void 0;
|
|
3958
3984
|
};
|
|
3959
3985
|
var isProcessEnvAccess = (node) => {
|
|
3960
|
-
if (node.type !==
|
|
3986
|
+
if (node.type !== import_utils43.AST_NODE_TYPES.MemberExpression) {
|
|
3961
3987
|
return false;
|
|
3962
3988
|
}
|
|
3963
3989
|
if (getMemberPropertyName13(node) !== "env") {
|
|
3964
3990
|
return false;
|
|
3965
3991
|
}
|
|
3966
|
-
return node.object.type ===
|
|
3992
|
+
return node.object.type === import_utils43.AST_NODE_TYPES.Identifier && node.object.name === "process";
|
|
3967
3993
|
};
|
|
3968
3994
|
var isTlsRejectUnauthorizedMember = (node) => {
|
|
3969
|
-
if (node.type !==
|
|
3995
|
+
if (node.type !== import_utils43.AST_NODE_TYPES.MemberExpression) {
|
|
3970
3996
|
return false;
|
|
3971
3997
|
}
|
|
3972
3998
|
if (getMemberPropertyName13(node) !== "NODE_TLS_REJECT_UNAUTHORIZED") {
|
|
@@ -3975,10 +4001,10 @@ var isTlsRejectUnauthorizedMember = (node) => {
|
|
|
3975
4001
|
return isProcessEnvAccess(node.object);
|
|
3976
4002
|
};
|
|
3977
4003
|
var isUnsafeOverrideValue = (node) => {
|
|
3978
|
-
if (node.type ===
|
|
4004
|
+
if (node.type === import_utils43.AST_NODE_TYPES.Literal) {
|
|
3979
4005
|
return node.value === 0 || node.value === "0";
|
|
3980
4006
|
}
|
|
3981
|
-
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";
|
|
3982
4008
|
};
|
|
3983
4009
|
var rule51 = createRule({
|
|
3984
4010
|
create(context) {
|
|
@@ -3999,7 +4025,7 @@ var rule51 = createRule({
|
|
|
3999
4025
|
suggest: [
|
|
4000
4026
|
{
|
|
4001
4027
|
fix(fixer) {
|
|
4002
|
-
const replacementValue = node.right.type ===
|
|
4028
|
+
const replacementValue = node.right.type === import_utils43.AST_NODE_TYPES.TemplateLiteral ? "`1`" : "'1'";
|
|
4003
4029
|
return fixer.replaceText(node.right, replacementValue);
|
|
4004
4030
|
},
|
|
4005
4031
|
messageId: "replaceWithTlsRejectUnauthorizedOne"
|
|
@@ -4030,9 +4056,10 @@ var rule51 = createRule({
|
|
|
4030
4056
|
var no_node_tls_reject_unauthorized_zero_default = rule51;
|
|
4031
4057
|
|
|
4032
4058
|
// dist/rules/no-node-tls-security-level-zero.js
|
|
4059
|
+
var import_utils44 = require("@typescript-eslint/utils");
|
|
4033
4060
|
var TLS_DEFAULT_CIPHERS_PROPERTY_NAMES = /* @__PURE__ */ new Set(["DEFAULT_CIPHERS"]);
|
|
4034
|
-
var TLS_SECURITY_LEVEL_ZERO_PATTERN = /@seclevel\s*=\s*0\b/
|
|
4035
|
-
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;
|
|
4036
4063
|
var isSecurityLevelZeroCipherString = (value) => TLS_SECURITY_LEVEL_ZERO_PATTERN.test(value);
|
|
4037
4064
|
var rule52 = createRule({
|
|
4038
4065
|
create(context) {
|
|
@@ -4059,7 +4086,7 @@ var rule52 = createRule({
|
|
|
4059
4086
|
return;
|
|
4060
4087
|
}
|
|
4061
4088
|
for (const propertyNode of node.properties) {
|
|
4062
|
-
if (propertyNode.type !==
|
|
4089
|
+
if (propertyNode.type !== import_utils44.AST_NODE_TYPES.Property || propertyNode.kind !== "init" || getPropertyName(propertyNode) !== "ciphers" || !isExpressionNode4(propertyNode.value)) {
|
|
4063
4090
|
continue;
|
|
4064
4091
|
}
|
|
4065
4092
|
const configuredValue = getStaticStringValue(propertyNode.value);
|
|
@@ -4097,6 +4124,7 @@ var rule52 = createRule({
|
|
|
4097
4124
|
var no_node_tls_security_level_zero_default = rule52;
|
|
4098
4125
|
|
|
4099
4126
|
// dist/rules/no-node-vm-run-in-context.js
|
|
4127
|
+
var import_utils45 = require("@typescript-eslint/utils");
|
|
4100
4128
|
var import_ts_extras28 = require("ts-extras");
|
|
4101
4129
|
var VM_MODULE_NAMES = /* @__PURE__ */ new Set(["node:vm", "vm"]);
|
|
4102
4130
|
var DISALLOWED_VM_CALL_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -4110,17 +4138,17 @@ var isVmModuleSource = (value) => (0, import_ts_extras28.setHas)(VM_MODULE_NAMES
|
|
|
4110
4138
|
var isDisallowedVmCallName = (value) => (0, import_ts_extras28.isDefined)(value) && (0, import_ts_extras28.setHas)(DISALLOWED_VM_CALL_NAMES, value);
|
|
4111
4139
|
var isDisallowedVmConstructorName = (value) => (0, import_ts_extras28.isDefined)(value) && (0, import_ts_extras28.setHas)(DISALLOWED_VM_CONSTRUCTOR_NAMES, value);
|
|
4112
4140
|
var isRequireCallFromVmModule = (expression) => {
|
|
4113
|
-
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") {
|
|
4114
4142
|
return false;
|
|
4115
4143
|
}
|
|
4116
4144
|
const [firstArgument] = expression.arguments;
|
|
4117
|
-
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);
|
|
4118
4146
|
};
|
|
4119
4147
|
var getPatternIdentifier2 = (pattern) => {
|
|
4120
|
-
if (pattern.type ===
|
|
4148
|
+
if (pattern.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4121
4149
|
return pattern;
|
|
4122
4150
|
}
|
|
4123
|
-
if (pattern.type ===
|
|
4151
|
+
if (pattern.type === import_utils45.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4124
4152
|
return pattern.left;
|
|
4125
4153
|
}
|
|
4126
4154
|
return void 0;
|
|
@@ -4132,7 +4160,7 @@ var rule53 = createRule({
|
|
|
4132
4160
|
const vmNamespaceBindingNames = /* @__PURE__ */ new Set();
|
|
4133
4161
|
return {
|
|
4134
4162
|
CallExpression(node) {
|
|
4135
|
-
if (node.callee.type ===
|
|
4163
|
+
if (node.callee.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4136
4164
|
if (!(0, import_ts_extras28.setHas)(vmCallBindingNames, node.callee.name)) {
|
|
4137
4165
|
return;
|
|
4138
4166
|
}
|
|
@@ -4142,21 +4170,21 @@ var rule53 = createRule({
|
|
|
4142
4170
|
});
|
|
4143
4171
|
return;
|
|
4144
4172
|
}
|
|
4145
|
-
if (node.callee.type !==
|
|
4173
|
+
if (node.callee.type !== import_utils45.AST_NODE_TYPES.MemberExpression) {
|
|
4146
4174
|
return;
|
|
4147
4175
|
}
|
|
4148
4176
|
const methodName = getMemberPropertyName3(node.callee);
|
|
4149
4177
|
if (!isDisallowedVmCallName(methodName)) {
|
|
4150
4178
|
return;
|
|
4151
4179
|
}
|
|
4152
|
-
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)) {
|
|
4153
4181
|
context.report({
|
|
4154
4182
|
messageId: "default",
|
|
4155
4183
|
node: node.callee
|
|
4156
4184
|
});
|
|
4157
4185
|
return;
|
|
4158
4186
|
}
|
|
4159
|
-
if (node.callee.object.type ===
|
|
4187
|
+
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.CallExpression && isRequireCallFromVmModule(node.callee.object)) {
|
|
4160
4188
|
context.report({
|
|
4161
4189
|
messageId: "default",
|
|
4162
4190
|
node: node.callee
|
|
@@ -4168,11 +4196,11 @@ var rule53 = createRule({
|
|
|
4168
4196
|
return;
|
|
4169
4197
|
}
|
|
4170
4198
|
for (const specifierNode of node.specifiers) {
|
|
4171
|
-
if (specifierNode.type ===
|
|
4199
|
+
if (specifierNode.type === import_utils45.AST_NODE_TYPES.ImportDefaultSpecifier || specifierNode.type === import_utils45.AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
4172
4200
|
vmNamespaceBindingNames.add(specifierNode.local.name);
|
|
4173
4201
|
continue;
|
|
4174
4202
|
}
|
|
4175
|
-
const importedName = specifierNode.imported.type ===
|
|
4203
|
+
const importedName = specifierNode.imported.type === import_utils45.AST_NODE_TYPES.Identifier ? specifierNode.imported.name : specifierNode.imported.value;
|
|
4176
4204
|
if (isDisallowedVmCallName(importedName)) {
|
|
4177
4205
|
vmCallBindingNames.add(specifierNode.local.name);
|
|
4178
4206
|
continue;
|
|
@@ -4183,7 +4211,7 @@ var rule53 = createRule({
|
|
|
4183
4211
|
}
|
|
4184
4212
|
},
|
|
4185
4213
|
NewExpression(node) {
|
|
4186
|
-
if (node.callee.type ===
|
|
4214
|
+
if (node.callee.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4187
4215
|
if (!(0, import_ts_extras28.setHas)(vmConstructorBindingNames, node.callee.name)) {
|
|
4188
4216
|
return;
|
|
4189
4217
|
}
|
|
@@ -4193,21 +4221,21 @@ var rule53 = createRule({
|
|
|
4193
4221
|
});
|
|
4194
4222
|
return;
|
|
4195
4223
|
}
|
|
4196
|
-
if (node.callee.type !==
|
|
4224
|
+
if (node.callee.type !== import_utils45.AST_NODE_TYPES.MemberExpression) {
|
|
4197
4225
|
return;
|
|
4198
4226
|
}
|
|
4199
4227
|
const constructorName = getMemberPropertyName3(node.callee);
|
|
4200
4228
|
if (!isDisallowedVmConstructorName(constructorName)) {
|
|
4201
4229
|
return;
|
|
4202
4230
|
}
|
|
4203
|
-
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)) {
|
|
4204
4232
|
context.report({
|
|
4205
4233
|
messageId: "default",
|
|
4206
4234
|
node: node.callee
|
|
4207
4235
|
});
|
|
4208
4236
|
return;
|
|
4209
4237
|
}
|
|
4210
|
-
if (node.callee.object.type ===
|
|
4238
|
+
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.CallExpression && isRequireCallFromVmModule(node.callee.object)) {
|
|
4211
4239
|
context.report({
|
|
4212
4240
|
messageId: "default",
|
|
4213
4241
|
node: node.callee
|
|
@@ -4218,15 +4246,15 @@ var rule53 = createRule({
|
|
|
4218
4246
|
if (!isRequireCallFromVmModule(node.init)) {
|
|
4219
4247
|
return;
|
|
4220
4248
|
}
|
|
4221
|
-
if (node.id.type ===
|
|
4249
|
+
if (node.id.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4222
4250
|
vmNamespaceBindingNames.add(node.id.name);
|
|
4223
4251
|
return;
|
|
4224
4252
|
}
|
|
4225
|
-
if (node.id.type !==
|
|
4253
|
+
if (node.id.type !== import_utils45.AST_NODE_TYPES.ObjectPattern) {
|
|
4226
4254
|
return;
|
|
4227
4255
|
}
|
|
4228
4256
|
for (const propertyNode of node.id.properties) {
|
|
4229
|
-
if (propertyNode.type !==
|
|
4257
|
+
if (propertyNode.type !== import_utils45.AST_NODE_TYPES.Property || propertyNode.computed) {
|
|
4230
4258
|
continue;
|
|
4231
4259
|
}
|
|
4232
4260
|
const importedName = getPropertyName(propertyNode);
|
|
@@ -4264,37 +4292,38 @@ var rule53 = createRule({
|
|
|
4264
4292
|
var no_node_vm_run_in_context_default = rule53;
|
|
4265
4293
|
|
|
4266
4294
|
// dist/rules/no-node-vm-source-text-module.js
|
|
4295
|
+
var import_utils46 = require("@typescript-eslint/utils");
|
|
4267
4296
|
var import_ts_extras29 = require("ts-extras");
|
|
4268
4297
|
var VM_MODULE_NAMES2 = /* @__PURE__ */ new Set(["node:vm", "vm"]);
|
|
4269
4298
|
var SOURCE_TEXT_MODULE_NAME = "SourceTextModule";
|
|
4270
4299
|
var isVmModuleSource2 = (value) => (0, import_ts_extras29.setHas)(VM_MODULE_NAMES2, value);
|
|
4271
4300
|
var isRequireCallFromVmModule2 = (expression) => {
|
|
4272
|
-
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") {
|
|
4273
4302
|
return false;
|
|
4274
4303
|
}
|
|
4275
4304
|
const [firstArgument] = expression.arguments;
|
|
4276
|
-
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);
|
|
4277
4306
|
};
|
|
4278
4307
|
var getPatternIdentifier3 = (pattern) => {
|
|
4279
|
-
if (pattern.type ===
|
|
4308
|
+
if (pattern.type === import_utils46.AST_NODE_TYPES.Identifier) {
|
|
4280
4309
|
return pattern;
|
|
4281
4310
|
}
|
|
4282
|
-
if (pattern.type ===
|
|
4311
|
+
if (pattern.type === import_utils46.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils46.AST_NODE_TYPES.Identifier) {
|
|
4283
4312
|
return pattern.left;
|
|
4284
4313
|
}
|
|
4285
4314
|
return void 0;
|
|
4286
4315
|
};
|
|
4287
4316
|
var isSourceTextModuleConstructor = (callee, sourceTextModuleBindingNames, vmNamespaceBindingNames) => {
|
|
4288
|
-
if (callee.type ===
|
|
4317
|
+
if (callee.type === import_utils46.AST_NODE_TYPES.Identifier) {
|
|
4289
4318
|
return (0, import_ts_extras29.setHas)(sourceTextModuleBindingNames, callee.name);
|
|
4290
4319
|
}
|
|
4291
|
-
if (callee.type !==
|
|
4320
|
+
if (callee.type !== import_utils46.AST_NODE_TYPES.MemberExpression) {
|
|
4292
4321
|
return false;
|
|
4293
4322
|
}
|
|
4294
4323
|
if (getMemberPropertyName3(callee) !== SOURCE_TEXT_MODULE_NAME) {
|
|
4295
4324
|
return false;
|
|
4296
4325
|
}
|
|
4297
|
-
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);
|
|
4298
4327
|
};
|
|
4299
4328
|
var rule54 = createRule({
|
|
4300
4329
|
create(context) {
|
|
@@ -4306,11 +4335,11 @@ var rule54 = createRule({
|
|
|
4306
4335
|
return;
|
|
4307
4336
|
}
|
|
4308
4337
|
for (const specifierNode of node.specifiers) {
|
|
4309
|
-
if (specifierNode.type ===
|
|
4338
|
+
if (specifierNode.type === import_utils46.AST_NODE_TYPES.ImportDefaultSpecifier || specifierNode.type === import_utils46.AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
4310
4339
|
vmNamespaceBindingNames.add(specifierNode.local.name);
|
|
4311
4340
|
continue;
|
|
4312
4341
|
}
|
|
4313
|
-
const importedName = specifierNode.imported.type ===
|
|
4342
|
+
const importedName = specifierNode.imported.type === import_utils46.AST_NODE_TYPES.Identifier ? specifierNode.imported.name : specifierNode.imported.value;
|
|
4314
4343
|
if (importedName === SOURCE_TEXT_MODULE_NAME) {
|
|
4315
4344
|
sourceTextModuleBindingNames.add(specifierNode.local.name);
|
|
4316
4345
|
}
|
|
@@ -4329,15 +4358,15 @@ var rule54 = createRule({
|
|
|
4329
4358
|
if (!isRequireCallFromVmModule2(node.init)) {
|
|
4330
4359
|
return;
|
|
4331
4360
|
}
|
|
4332
|
-
if (node.id.type ===
|
|
4361
|
+
if (node.id.type === import_utils46.AST_NODE_TYPES.Identifier) {
|
|
4333
4362
|
vmNamespaceBindingNames.add(node.id.name);
|
|
4334
4363
|
return;
|
|
4335
4364
|
}
|
|
4336
|
-
if (node.id.type !==
|
|
4365
|
+
if (node.id.type !== import_utils46.AST_NODE_TYPES.ObjectPattern) {
|
|
4337
4366
|
return;
|
|
4338
4367
|
}
|
|
4339
4368
|
for (const propertyNode of node.id.properties) {
|
|
4340
|
-
if (propertyNode.type !==
|
|
4369
|
+
if (propertyNode.type !== import_utils46.AST_NODE_TYPES.Property || propertyNode.computed) {
|
|
4341
4370
|
continue;
|
|
4342
4371
|
}
|
|
4343
4372
|
if (getPropertyName(propertyNode) !== SOURCE_TEXT_MODULE_NAME) {
|
|
@@ -4371,6 +4400,7 @@ var rule54 = createRule({
|
|
|
4371
4400
|
var no_node_vm_source_text_module_default = rule54;
|
|
4372
4401
|
|
|
4373
4402
|
// dist/rules/no-node-worker-threads-eval.js
|
|
4403
|
+
var import_utils47 = require("@typescript-eslint/utils");
|
|
4374
4404
|
var import_ts_extras30 = require("ts-extras");
|
|
4375
4405
|
var WORKER_THREADS_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
4376
4406
|
"node:worker_threads",
|
|
@@ -4378,49 +4408,49 @@ var WORKER_THREADS_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
|
4378
4408
|
]);
|
|
4379
4409
|
var isWorkerThreadsModuleSource = (value) => (0, import_ts_extras30.setHas)(WORKER_THREADS_MODULE_NAMES, value);
|
|
4380
4410
|
var isRequireCallFromWorkerThreads = (expression) => {
|
|
4381
|
-
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") {
|
|
4382
4412
|
return false;
|
|
4383
4413
|
}
|
|
4384
4414
|
const [firstArgument] = expression.arguments;
|
|
4385
|
-
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);
|
|
4386
4416
|
};
|
|
4387
4417
|
var getPatternIdentifier4 = (pattern) => {
|
|
4388
|
-
if (pattern.type ===
|
|
4418
|
+
if (pattern.type === import_utils47.AST_NODE_TYPES.Identifier) {
|
|
4389
4419
|
return pattern;
|
|
4390
4420
|
}
|
|
4391
|
-
if (pattern.type ===
|
|
4421
|
+
if (pattern.type === import_utils47.AST_NODE_TYPES.AssignmentPattern && pattern.left.type === import_utils47.AST_NODE_TYPES.Identifier) {
|
|
4392
4422
|
return pattern.left;
|
|
4393
4423
|
}
|
|
4394
4424
|
return void 0;
|
|
4395
4425
|
};
|
|
4396
4426
|
var hasEvalTrueOption = (optionsNode) => {
|
|
4397
|
-
if (optionsNode.type !==
|
|
4427
|
+
if (optionsNode.type !== import_utils47.AST_NODE_TYPES.ObjectExpression) {
|
|
4398
4428
|
return false;
|
|
4399
4429
|
}
|
|
4400
4430
|
for (const propertyNode of optionsNode.properties) {
|
|
4401
|
-
if (propertyNode.type !==
|
|
4431
|
+
if (propertyNode.type !== import_utils47.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
4402
4432
|
continue;
|
|
4403
4433
|
}
|
|
4404
4434
|
if (getPropertyName(propertyNode) !== "eval") {
|
|
4405
4435
|
continue;
|
|
4406
4436
|
}
|
|
4407
|
-
if (propertyNode.value.type ===
|
|
4437
|
+
if (propertyNode.value.type === import_utils47.AST_NODE_TYPES.Literal && propertyNode.value.value === true) {
|
|
4408
4438
|
return true;
|
|
4409
4439
|
}
|
|
4410
4440
|
}
|
|
4411
4441
|
return false;
|
|
4412
4442
|
};
|
|
4413
4443
|
var isWorkerThreadsWorkerConstructor = (callee, workerBindingNames, workerThreadsNamespaceBindingNames) => {
|
|
4414
|
-
if (callee.type ===
|
|
4444
|
+
if (callee.type === import_utils47.AST_NODE_TYPES.Identifier) {
|
|
4415
4445
|
return (0, import_ts_extras30.setHas)(workerBindingNames, callee.name);
|
|
4416
4446
|
}
|
|
4417
|
-
if (callee.type !==
|
|
4447
|
+
if (callee.type !== import_utils47.AST_NODE_TYPES.MemberExpression) {
|
|
4418
4448
|
return false;
|
|
4419
4449
|
}
|
|
4420
4450
|
if (getMemberPropertyName3(callee) !== "Worker") {
|
|
4421
4451
|
return false;
|
|
4422
4452
|
}
|
|
4423
|
-
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);
|
|
4424
4454
|
};
|
|
4425
4455
|
var rule55 = createRule({
|
|
4426
4456
|
create(context) {
|
|
@@ -4432,11 +4462,11 @@ var rule55 = createRule({
|
|
|
4432
4462
|
return;
|
|
4433
4463
|
}
|
|
4434
4464
|
for (const specifierNode of node.specifiers) {
|
|
4435
|
-
if (specifierNode.type ===
|
|
4465
|
+
if (specifierNode.type === import_utils47.AST_NODE_TYPES.ImportDefaultSpecifier || specifierNode.type === import_utils47.AST_NODE_TYPES.ImportNamespaceSpecifier) {
|
|
4436
4466
|
workerThreadsNamespaceBindingNames.add(specifierNode.local.name);
|
|
4437
4467
|
continue;
|
|
4438
4468
|
}
|
|
4439
|
-
const importedName = specifierNode.imported.type ===
|
|
4469
|
+
const importedName = specifierNode.imported.type === import_utils47.AST_NODE_TYPES.Identifier ? specifierNode.imported.name : specifierNode.imported.value;
|
|
4440
4470
|
if (importedName === "Worker") {
|
|
4441
4471
|
workerBindingNames.add(specifierNode.local.name);
|
|
4442
4472
|
}
|
|
@@ -4447,7 +4477,7 @@ var rule55 = createRule({
|
|
|
4447
4477
|
return;
|
|
4448
4478
|
}
|
|
4449
4479
|
const [, secondArgument] = node.arguments;
|
|
4450
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
4480
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils47.AST_NODE_TYPES.SpreadElement || !hasEvalTrueOption(secondArgument)) {
|
|
4451
4481
|
return;
|
|
4452
4482
|
}
|
|
4453
4483
|
context.report({
|
|
@@ -4459,15 +4489,15 @@ var rule55 = createRule({
|
|
|
4459
4489
|
if (!isRequireCallFromWorkerThreads(node.init)) {
|
|
4460
4490
|
return;
|
|
4461
4491
|
}
|
|
4462
|
-
if (node.id.type ===
|
|
4492
|
+
if (node.id.type === import_utils47.AST_NODE_TYPES.Identifier) {
|
|
4463
4493
|
workerThreadsNamespaceBindingNames.add(node.id.name);
|
|
4464
4494
|
return;
|
|
4465
4495
|
}
|
|
4466
|
-
if (node.id.type !==
|
|
4496
|
+
if (node.id.type !== import_utils47.AST_NODE_TYPES.ObjectPattern) {
|
|
4467
4497
|
return;
|
|
4468
4498
|
}
|
|
4469
4499
|
for (const propertyNode of node.id.properties) {
|
|
4470
|
-
if (propertyNode.type !==
|
|
4500
|
+
if (propertyNode.type !== import_utils47.AST_NODE_TYPES.Property || propertyNode.computed) {
|
|
4471
4501
|
continue;
|
|
4472
4502
|
}
|
|
4473
4503
|
if (getPropertyName(propertyNode) !== "Worker") {
|
|
@@ -4501,12 +4531,13 @@ var rule55 = createRule({
|
|
|
4501
4531
|
var no_node_worker_threads_eval_default = rule55;
|
|
4502
4532
|
|
|
4503
4533
|
// dist/rules/no-nonnull-assertion-on-security-input.js
|
|
4504
|
-
var
|
|
4534
|
+
var import_utils48 = require("@typescript-eslint/utils");
|
|
4535
|
+
var SECURITY_INPUT_PATTERN = /html|input|message|origin|payload|token|url/iv;
|
|
4505
4536
|
var isSecuritySensitiveExpression = (expression) => {
|
|
4506
|
-
if (expression.type ===
|
|
4537
|
+
if (expression.type === import_utils48.AST_NODE_TYPES.Identifier) {
|
|
4507
4538
|
return SECURITY_INPUT_PATTERN.test(expression.name);
|
|
4508
4539
|
}
|
|
4509
|
-
if (expression.type ===
|
|
4540
|
+
if (expression.type === import_utils48.AST_NODE_TYPES.MemberExpression && !expression.computed && expression.property.type === import_utils48.AST_NODE_TYPES.Identifier) {
|
|
4510
4541
|
return SECURITY_INPUT_PATTERN.test(expression.property.name);
|
|
4511
4542
|
}
|
|
4512
4543
|
return false;
|
|
@@ -4544,6 +4575,7 @@ var rule56 = createRule({
|
|
|
4544
4575
|
var no_nonnull_assertion_on_security_input_default = rule56;
|
|
4545
4576
|
|
|
4546
4577
|
// dist/rules/no-postmessage-star-origin.js
|
|
4578
|
+
var import_utils49 = require("@typescript-eslint/utils");
|
|
4547
4579
|
var import_ts_extras31 = require("ts-extras");
|
|
4548
4580
|
var rule57 = createRule({
|
|
4549
4581
|
create(context) {
|
|
@@ -4551,10 +4583,10 @@ var rule57 = createRule({
|
|
|
4551
4583
|
return {
|
|
4552
4584
|
"CallExpression[arguments.length>=2][arguments.length<=3][callee.property.name='postMessage']"(node) {
|
|
4553
4585
|
const [, targetOrigin] = node.arguments;
|
|
4554
|
-
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 !== "*") {
|
|
4555
4587
|
return;
|
|
4556
4588
|
}
|
|
4557
|
-
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) {
|
|
4558
4590
|
const calleeObjectType = getNodeTypeAsString(fullTypeChecker, node.callee.object, context);
|
|
4559
4591
|
if (!(0, import_ts_extras31.arrayIncludes)(["any", "Window"], calleeObjectType)) {
|
|
4560
4592
|
return;
|
|
@@ -4596,21 +4628,22 @@ var rule57 = createRule({
|
|
|
4596
4628
|
var no_postmessage_star_origin_default = rule57;
|
|
4597
4629
|
|
|
4598
4630
|
// dist/rules/no-postmessage-without-origin-allowlist.js
|
|
4631
|
+
var import_utils50 = require("@typescript-eslint/utils");
|
|
4599
4632
|
var import_ts_extras32 = require("ts-extras");
|
|
4600
4633
|
var getMemberPropertyName14 = (memberExpression) => {
|
|
4601
|
-
if (!memberExpression.computed && memberExpression.property.type ===
|
|
4634
|
+
if (!memberExpression.computed && memberExpression.property.type === import_utils50.AST_NODE_TYPES.Identifier) {
|
|
4602
4635
|
return memberExpression.property.name;
|
|
4603
4636
|
}
|
|
4604
|
-
if (memberExpression.property.type ===
|
|
4637
|
+
if (memberExpression.property.type === import_utils50.AST_NODE_TYPES.Literal && typeof memberExpression.property.value === "string") {
|
|
4605
4638
|
return memberExpression.property.value;
|
|
4606
4639
|
}
|
|
4607
4640
|
return void 0;
|
|
4608
4641
|
};
|
|
4609
4642
|
var getStaticStringValue6 = (node) => {
|
|
4610
|
-
if (node.type ===
|
|
4643
|
+
if (node.type === import_utils50.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
4611
4644
|
return node.value;
|
|
4612
4645
|
}
|
|
4613
|
-
if (node.type ===
|
|
4646
|
+
if (node.type === import_utils50.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
4614
4647
|
return (0, import_ts_extras32.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
4615
4648
|
}
|
|
4616
4649
|
return void 0;
|
|
@@ -4623,20 +4656,20 @@ var isAllowedOriginLiteral = (origin) => {
|
|
|
4623
4656
|
if (normalizedOrigin.includes("*")) {
|
|
4624
4657
|
return false;
|
|
4625
4658
|
}
|
|
4626
|
-
return /^https?:\/\//
|
|
4659
|
+
return /^https?:\/\//iv.test(normalizedOrigin);
|
|
4627
4660
|
};
|
|
4628
4661
|
var rule58 = createRule({
|
|
4629
4662
|
create(context) {
|
|
4630
4663
|
return {
|
|
4631
4664
|
CallExpression(node) {
|
|
4632
|
-
if (node.callee.type !==
|
|
4665
|
+
if (node.callee.type !== import_utils50.AST_NODE_TYPES.MemberExpression) {
|
|
4633
4666
|
return;
|
|
4634
4667
|
}
|
|
4635
4668
|
if (getMemberPropertyName14(node.callee) !== "postMessage") {
|
|
4636
4669
|
return;
|
|
4637
4670
|
}
|
|
4638
4671
|
const [, secondArgument] = node.arguments;
|
|
4639
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
4672
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils50.AST_NODE_TYPES.SpreadElement) {
|
|
4640
4673
|
return;
|
|
4641
4674
|
}
|
|
4642
4675
|
const secondArgumentValue = getStaticStringValue6(secondArgument);
|
|
@@ -4669,21 +4702,22 @@ var rule58 = createRule({
|
|
|
4669
4702
|
var no_postmessage_without_origin_allowlist_default = rule58;
|
|
4670
4703
|
|
|
4671
4704
|
// dist/rules/no-range-create-contextual-fragment.js
|
|
4705
|
+
var import_utils51 = require("@typescript-eslint/utils");
|
|
4672
4706
|
var isSanitizedExpression2 = (node) => {
|
|
4673
|
-
if (node.type !==
|
|
4707
|
+
if (node.type !== import_utils51.AST_NODE_TYPES.CallExpression) {
|
|
4674
4708
|
return false;
|
|
4675
4709
|
}
|
|
4676
|
-
if (node.callee.type ===
|
|
4677
|
-
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());
|
|
4678
4712
|
}
|
|
4679
|
-
if (node.callee.type !==
|
|
4713
|
+
if (node.callee.type !== import_utils51.AST_NODE_TYPES.MemberExpression) {
|
|
4680
4714
|
return false;
|
|
4681
4715
|
}
|
|
4682
4716
|
const propertyName = getMemberPropertyName3(node.callee);
|
|
4683
|
-
return typeof propertyName === "string" && /createhtml|sanitize|trusted/
|
|
4717
|
+
return typeof propertyName === "string" && /createhtml|sanitize|trusted/v.test(propertyName.toLowerCase());
|
|
4684
4718
|
};
|
|
4685
4719
|
var isCreateContextualFragmentCall = (node) => {
|
|
4686
|
-
if (node.callee.type !==
|
|
4720
|
+
if (node.callee.type !== import_utils51.AST_NODE_TYPES.MemberExpression) {
|
|
4687
4721
|
return false;
|
|
4688
4722
|
}
|
|
4689
4723
|
return getMemberPropertyName3(node.callee) === "createContextualFragment";
|
|
@@ -4696,7 +4730,7 @@ var rule59 = createRule({
|
|
|
4696
4730
|
return;
|
|
4697
4731
|
}
|
|
4698
4732
|
const [firstArgument] = node.arguments;
|
|
4699
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
4733
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils51.AST_NODE_TYPES.SpreadElement || getStaticStringValue(firstArgument) === "" || isSanitizedExpression2(firstArgument)) {
|
|
4700
4734
|
return;
|
|
4701
4735
|
}
|
|
4702
4736
|
context.report({
|
|
@@ -4724,17 +4758,21 @@ var rule59 = createRule({
|
|
|
4724
4758
|
});
|
|
4725
4759
|
var no_range_create_contextual_fragment_default = rule59;
|
|
4726
4760
|
|
|
4761
|
+
// dist/rules/no-script-src-data-url.js
|
|
4762
|
+
var import_utils53 = require("@typescript-eslint/utils");
|
|
4763
|
+
|
|
4727
4764
|
// dist/_internal/script-element.js
|
|
4765
|
+
var import_utils52 = require("@typescript-eslint/utils");
|
|
4728
4766
|
var isLikelyScriptIdentifierName = (identifierName) => identifierName === "currentScript" || identifierName === "script" || identifierName === "scriptElement" || identifierName.endsWith("Script") || identifierName.endsWith("ScriptElement") || identifierName.endsWith("_script") || identifierName.endsWith("_script_element");
|
|
4729
4767
|
var isCreateElementScriptCall = (node) => {
|
|
4730
|
-
if (node.type !==
|
|
4768
|
+
if (node.type !== import_utils52.AST_NODE_TYPES.CallExpression || node.callee.type !== import_utils52.AST_NODE_TYPES.MemberExpression) {
|
|
4731
4769
|
return false;
|
|
4732
4770
|
}
|
|
4733
4771
|
if (getMemberPropertyName3(node.callee) !== "createElement") {
|
|
4734
4772
|
return false;
|
|
4735
4773
|
}
|
|
4736
4774
|
const [firstArgument] = node.arguments;
|
|
4737
|
-
return firstArgument !== void 0 && firstArgument.type !==
|
|
4775
|
+
return firstArgument !== void 0 && firstArgument.type !== import_utils52.AST_NODE_TYPES.SpreadElement && getStaticStringValue(firstArgument) === "script";
|
|
4738
4776
|
};
|
|
4739
4777
|
var isLikelyScriptElement = (node, context, fullTypeChecker) => {
|
|
4740
4778
|
if (fullTypeChecker !== void 0) {
|
|
@@ -4746,10 +4784,10 @@ var isLikelyScriptElement = (node, context, fullTypeChecker) => {
|
|
|
4746
4784
|
if (isCreateElementScriptCall(node)) {
|
|
4747
4785
|
return true;
|
|
4748
4786
|
}
|
|
4749
|
-
if (node.type ===
|
|
4787
|
+
if (node.type === import_utils52.AST_NODE_TYPES.Identifier) {
|
|
4750
4788
|
return isLikelyScriptIdentifierName(node.name);
|
|
4751
4789
|
}
|
|
4752
|
-
if (node.type !==
|
|
4790
|
+
if (node.type !== import_utils52.AST_NODE_TYPES.MemberExpression) {
|
|
4753
4791
|
return false;
|
|
4754
4792
|
}
|
|
4755
4793
|
const propertyName = getMemberPropertyName3(node);
|
|
@@ -4757,10 +4795,10 @@ var isLikelyScriptElement = (node, context, fullTypeChecker) => {
|
|
|
4757
4795
|
};
|
|
4758
4796
|
|
|
4759
4797
|
// dist/rules/no-script-src-data-url.js
|
|
4760
|
-
var isDataUrl2 = (value) => /^\s*data:/
|
|
4761
|
-
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";
|
|
4762
4800
|
var getJsxAttributeName5 = (attributeNode) => {
|
|
4763
|
-
if (attributeNode.name.type !==
|
|
4801
|
+
if (attributeNode.name.type !== import_utils53.AST_NODE_TYPES.JSXIdentifier) {
|
|
4764
4802
|
return void 0;
|
|
4765
4803
|
}
|
|
4766
4804
|
return attributeNode.name.name.toLowerCase();
|
|
@@ -4770,7 +4808,7 @@ var rule60 = createRule({
|
|
|
4770
4808
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
4771
4809
|
return {
|
|
4772
4810
|
AssignmentExpression(node) {
|
|
4773
|
-
if (node.left.type !==
|
|
4811
|
+
if (node.left.type !== import_utils53.AST_NODE_TYPES.MemberExpression) {
|
|
4774
4812
|
return;
|
|
4775
4813
|
}
|
|
4776
4814
|
if (getMemberPropertyName3(node.left) !== "src") {
|
|
@@ -4786,7 +4824,7 @@ var rule60 = createRule({
|
|
|
4786
4824
|
});
|
|
4787
4825
|
},
|
|
4788
4826
|
CallExpression(node) {
|
|
4789
|
-
if (node.callee.type !==
|
|
4827
|
+
if (node.callee.type !== import_utils53.AST_NODE_TYPES.MemberExpression) {
|
|
4790
4828
|
return;
|
|
4791
4829
|
}
|
|
4792
4830
|
const methodName = getMemberPropertyName3(node.callee);
|
|
@@ -4794,7 +4832,7 @@ var rule60 = createRule({
|
|
|
4794
4832
|
return;
|
|
4795
4833
|
}
|
|
4796
4834
|
const [firstArgument, secondArgument] = node.arguments;
|
|
4797
|
-
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) {
|
|
4798
4836
|
return;
|
|
4799
4837
|
}
|
|
4800
4838
|
const configuredValue = getStaticStringValue(secondArgument);
|
|
@@ -4811,7 +4849,7 @@ var rule60 = createRule({
|
|
|
4811
4849
|
return;
|
|
4812
4850
|
}
|
|
4813
4851
|
for (const attributeNode of node.attributes) {
|
|
4814
|
-
if (attributeNode.type !==
|
|
4852
|
+
if (attributeNode.type !== import_utils53.AST_NODE_TYPES.JSXAttribute) {
|
|
4815
4853
|
continue;
|
|
4816
4854
|
}
|
|
4817
4855
|
if (getJsxAttributeName5(attributeNode) !== "src") {
|
|
@@ -4848,13 +4886,14 @@ var rule60 = createRule({
|
|
|
4848
4886
|
var no_script_src_data_url_default = rule60;
|
|
4849
4887
|
|
|
4850
4888
|
// dist/rules/no-script-text.js
|
|
4889
|
+
var import_utils54 = require("@typescript-eslint/utils");
|
|
4851
4890
|
var isScriptTextPropertyName = (propertyName) => propertyName === "innerText" || propertyName === "text" || propertyName === "textContent";
|
|
4852
4891
|
var rule61 = createRule({
|
|
4853
4892
|
create(context) {
|
|
4854
4893
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
4855
4894
|
return {
|
|
4856
4895
|
AssignmentExpression(node) {
|
|
4857
|
-
if (node.left.type !==
|
|
4896
|
+
if (node.left.type !== import_utils54.AST_NODE_TYPES.MemberExpression) {
|
|
4858
4897
|
return;
|
|
4859
4898
|
}
|
|
4860
4899
|
if (!isScriptTextPropertyName(getMemberPropertyName3(node.left))) {
|
|
@@ -4892,7 +4931,8 @@ var rule61 = createRule({
|
|
|
4892
4931
|
var no_script_text_default = rule61;
|
|
4893
4932
|
|
|
4894
4933
|
// dist/rules/no-service-worker-unsafe-script-url.js
|
|
4895
|
-
var
|
|
4934
|
+
var import_utils55 = require("@typescript-eslint/utils");
|
|
4935
|
+
var isJavaScriptUrl3 = (value) => /^\s*javascript\s*:/iv.test(value);
|
|
4896
4936
|
var isUnsafeServiceWorkerScriptUrl = (expression) => {
|
|
4897
4937
|
const configuredValue = getStaticStringValue(expression);
|
|
4898
4938
|
return typeof configuredValue === "string" && (isBlobUrl(configuredValue) || isDataUrl(configuredValue) || isJavaScriptUrl3(configuredValue)) || isUrlCreateObjectUrlCall(expression);
|
|
@@ -4905,7 +4945,7 @@ var rule62 = createRule({
|
|
|
4905
4945
|
return;
|
|
4906
4946
|
}
|
|
4907
4947
|
const [firstArgument] = node.arguments;
|
|
4908
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
4948
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils55.AST_NODE_TYPES.SpreadElement || !isUnsafeServiceWorkerScriptUrl(firstArgument)) {
|
|
4909
4949
|
return;
|
|
4910
4950
|
}
|
|
4911
4951
|
context.report({
|
|
@@ -4934,8 +4974,9 @@ var rule62 = createRule({
|
|
|
4934
4974
|
var no_service_worker_unsafe_script_url_default = rule62;
|
|
4935
4975
|
|
|
4936
4976
|
// dist/rules/no-set-html-unsafe.js
|
|
4977
|
+
var import_utils56 = require("@typescript-eslint/utils");
|
|
4937
4978
|
var isSetHtmlUnsafeCall = (node) => {
|
|
4938
|
-
if (node.callee.type !==
|
|
4979
|
+
if (node.callee.type !== import_utils56.AST_NODE_TYPES.MemberExpression) {
|
|
4939
4980
|
return false;
|
|
4940
4981
|
}
|
|
4941
4982
|
return getMemberPropertyName3(node.callee) === "setHTMLUnsafe";
|
|
@@ -4948,7 +4989,7 @@ var rule63 = createRule({
|
|
|
4948
4989
|
return;
|
|
4949
4990
|
}
|
|
4950
4991
|
const [firstArgument] = node.arguments;
|
|
4951
|
-
if (firstArgument !== void 0 && firstArgument.type !==
|
|
4992
|
+
if (firstArgument !== void 0 && firstArgument.type !== import_utils56.AST_NODE_TYPES.SpreadElement && getStaticStringValue(firstArgument) === "") {
|
|
4952
4993
|
return;
|
|
4953
4994
|
}
|
|
4954
4995
|
context.report({
|
|
@@ -4977,50 +5018,51 @@ var rule63 = createRule({
|
|
|
4977
5018
|
var no_set_html_unsafe_default = rule63;
|
|
4978
5019
|
|
|
4979
5020
|
// dist/rules/no-trusted-types-policy-pass-through.js
|
|
5021
|
+
var import_utils57 = require("@typescript-eslint/utils");
|
|
4980
5022
|
var import_ts_extras33 = require("ts-extras");
|
|
4981
|
-
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;
|
|
4982
5024
|
var POLICY_FACTORY_NAMES = /* @__PURE__ */ new Set([
|
|
4983
5025
|
"createHTML",
|
|
4984
5026
|
"createScript",
|
|
4985
5027
|
"createScriptURL"
|
|
4986
5028
|
]);
|
|
4987
|
-
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;
|
|
4988
5030
|
var unwrapTransparentExpression = (expression) => {
|
|
4989
|
-
if (expression.type ===
|
|
5031
|
+
if (expression.type === import_utils57.AST_NODE_TYPES.TSAsExpression || expression.type === import_utils57.AST_NODE_TYPES.TSTypeAssertion) {
|
|
4990
5032
|
return unwrapTransparentExpression(expression.expression);
|
|
4991
5033
|
}
|
|
4992
5034
|
return expression;
|
|
4993
5035
|
};
|
|
4994
5036
|
var isPassThroughFactory = (factoryNode) => {
|
|
4995
5037
|
const [firstParameter] = factoryNode.params;
|
|
4996
|
-
if (firstParameter?.type !==
|
|
5038
|
+
if (firstParameter?.type !== import_utils57.AST_NODE_TYPES.Identifier) {
|
|
4997
5039
|
return false;
|
|
4998
5040
|
}
|
|
4999
|
-
if (factoryNode.body.type !==
|
|
5041
|
+
if (factoryNode.body.type !== import_utils57.AST_NODE_TYPES.BlockStatement) {
|
|
5000
5042
|
const expressionBody = unwrapTransparentExpression(factoryNode.body);
|
|
5001
|
-
return expressionBody.type ===
|
|
5043
|
+
return expressionBody.type === import_utils57.AST_NODE_TYPES.Identifier && expressionBody.name === firstParameter.name;
|
|
5002
5044
|
}
|
|
5003
5045
|
if (factoryNode.body.body.length !== 1) {
|
|
5004
5046
|
return false;
|
|
5005
5047
|
}
|
|
5006
5048
|
const onlyStatement = (0, import_ts_extras33.arrayFirst)(factoryNode.body.body);
|
|
5007
|
-
if (onlyStatement?.type !==
|
|
5049
|
+
if (onlyStatement?.type !== import_utils57.AST_NODE_TYPES.ReturnStatement || onlyStatement.argument === null) {
|
|
5008
5050
|
return false;
|
|
5009
5051
|
}
|
|
5010
5052
|
const returnedExpression = unwrapTransparentExpression(onlyStatement.argument);
|
|
5011
|
-
return returnedExpression.type ===
|
|
5053
|
+
return returnedExpression.type === import_utils57.AST_NODE_TYPES.Identifier && returnedExpression.name === firstParameter.name;
|
|
5012
5054
|
};
|
|
5013
5055
|
var isTrustedTypesCreatePolicyCall = (node) => {
|
|
5014
|
-
if (node.callee.type !==
|
|
5056
|
+
if (node.callee.type !== import_utils57.AST_NODE_TYPES.MemberExpression) {
|
|
5015
5057
|
return false;
|
|
5016
5058
|
}
|
|
5017
5059
|
if (getMemberPropertyName3(node.callee) !== "createPolicy") {
|
|
5018
5060
|
return false;
|
|
5019
5061
|
}
|
|
5020
|
-
if (node.callee.object.type ===
|
|
5062
|
+
if (node.callee.object.type === import_utils57.AST_NODE_TYPES.Identifier) {
|
|
5021
5063
|
return node.callee.object.name === "trustedTypes";
|
|
5022
5064
|
}
|
|
5023
|
-
if (node.callee.object.type !==
|
|
5065
|
+
if (node.callee.object.type !== import_utils57.AST_NODE_TYPES.MemberExpression) {
|
|
5024
5066
|
return false;
|
|
5025
5067
|
}
|
|
5026
5068
|
return getMemberPropertyName3(node.callee.object) === "trustedTypes";
|
|
@@ -5033,11 +5075,11 @@ var rule64 = createRule({
|
|
|
5033
5075
|
return;
|
|
5034
5076
|
}
|
|
5035
5077
|
const [, secondArgument] = node.arguments;
|
|
5036
|
-
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) {
|
|
5037
5079
|
return;
|
|
5038
5080
|
}
|
|
5039
5081
|
for (const propertyNode of secondArgument.properties) {
|
|
5040
|
-
if (propertyNode.type !==
|
|
5082
|
+
if (propertyNode.type !== import_utils57.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
5041
5083
|
continue;
|
|
5042
5084
|
}
|
|
5043
5085
|
const propertyName = getPropertyName(propertyNode);
|
|
@@ -5074,20 +5116,21 @@ var rule64 = createRule({
|
|
|
5074
5116
|
var no_trusted_types_policy_pass_through_default = rule64;
|
|
5075
5117
|
|
|
5076
5118
|
// dist/rules/no-unsafe-alloc.js
|
|
5119
|
+
var import_utils58 = require("@typescript-eslint/utils");
|
|
5077
5120
|
var rule65 = createRule({
|
|
5078
5121
|
create(context) {
|
|
5079
5122
|
return {
|
|
5080
5123
|
"MemberExpression[object.name='Buffer'][property.name=/^(?:allocUnsafe|allocUnsafeSlow)$/]"(node) {
|
|
5081
5124
|
const parentNode = node.parent;
|
|
5082
|
-
if (parentNode
|
|
5125
|
+
if (parentNode.type === import_utils58.AST_NODE_TYPES.CallExpression && parentNode.arguments.length === 1) {
|
|
5083
5126
|
const [firstArgument] = parentNode.arguments;
|
|
5084
|
-
if (firstArgument?.type ===
|
|
5127
|
+
if (firstArgument?.type === import_utils58.AST_NODE_TYPES.Literal && (firstArgument.value === 0 || firstArgument.value === "0")) {
|
|
5085
5128
|
return;
|
|
5086
5129
|
}
|
|
5087
5130
|
}
|
|
5088
5131
|
context.report({
|
|
5089
5132
|
fix(fixer) {
|
|
5090
|
-
if (node.computed || node.property.type !==
|
|
5133
|
+
if (node.computed || node.property.type !== import_utils58.AST_NODE_TYPES.Identifier) {
|
|
5091
5134
|
return null;
|
|
5092
5135
|
}
|
|
5093
5136
|
return fixer.replaceText(node.property, "alloc");
|
|
@@ -5118,6 +5161,7 @@ var rule65 = createRule({
|
|
|
5118
5161
|
var no_unsafe_alloc_default = rule65;
|
|
5119
5162
|
|
|
5120
5163
|
// dist/rules/no-unsafe-cast-to-trusted-types.js
|
|
5164
|
+
var import_utils59 = require("@typescript-eslint/utils");
|
|
5121
5165
|
var import_ts_extras34 = require("ts-extras");
|
|
5122
5166
|
var TRUSTED_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
5123
5167
|
"TrustedHTML",
|
|
@@ -5125,7 +5169,7 @@ var TRUSTED_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
|
5125
5169
|
"TrustedScriptURL"
|
|
5126
5170
|
]);
|
|
5127
5171
|
var getTypeName = (node) => {
|
|
5128
|
-
if (node.type ===
|
|
5172
|
+
if (node.type === import_utils59.AST_NODE_TYPES.TSTypeReference && node.typeName.type === import_utils59.AST_NODE_TYPES.Identifier) {
|
|
5129
5173
|
return node.typeName.name;
|
|
5130
5174
|
}
|
|
5131
5175
|
return void 0;
|
|
@@ -5135,13 +5179,13 @@ var isTrustedTypeNode = (node) => {
|
|
|
5135
5179
|
return (0, import_ts_extras34.isDefined)(typeName) && (0, import_ts_extras34.setHas)(TRUSTED_TYPE_NAMES, typeName);
|
|
5136
5180
|
};
|
|
5137
5181
|
var getExpressionCalleeName = (expression) => {
|
|
5138
|
-
if (expression.type !==
|
|
5182
|
+
if (expression.type !== import_utils59.AST_NODE_TYPES.CallExpression) {
|
|
5139
5183
|
return void 0;
|
|
5140
5184
|
}
|
|
5141
|
-
if (expression.callee.type ===
|
|
5185
|
+
if (expression.callee.type === import_utils59.AST_NODE_TYPES.Identifier) {
|
|
5142
5186
|
return expression.callee.name;
|
|
5143
5187
|
}
|
|
5144
|
-
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) {
|
|
5145
5189
|
return expression.callee.property.name;
|
|
5146
5190
|
}
|
|
5147
5191
|
return void 0;
|
|
@@ -5151,7 +5195,7 @@ var isKnownTrustedFactoryCall = (expression) => {
|
|
|
5151
5195
|
if (!(0, import_ts_extras34.isDefined)(calleeName)) {
|
|
5152
5196
|
return false;
|
|
5153
5197
|
}
|
|
5154
|
-
return /sanitize|createhtml|createscripturl|createscript|trusted/
|
|
5198
|
+
return /sanitize|createhtml|createscripturl|createscript|trusted/v.test(calleeName.toLowerCase());
|
|
5155
5199
|
};
|
|
5156
5200
|
var rule66 = createRule({
|
|
5157
5201
|
create(context) {
|
|
@@ -5201,12 +5245,13 @@ var rule66 = createRule({
|
|
|
5201
5245
|
var no_unsafe_cast_to_trusted_types_default = rule66;
|
|
5202
5246
|
|
|
5203
5247
|
// dist/rules/no-window-open-without-noopener.js
|
|
5248
|
+
var import_utils60 = require("@typescript-eslint/utils");
|
|
5204
5249
|
var import_ts_extras35 = require("ts-extras");
|
|
5205
5250
|
var getStaticStringValue7 = (node) => {
|
|
5206
|
-
if (node.type ===
|
|
5251
|
+
if (node.type === import_utils60.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
5207
5252
|
return node.value;
|
|
5208
5253
|
}
|
|
5209
|
-
if (node.type ===
|
|
5254
|
+
if (node.type === import_utils60.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
5210
5255
|
const firstQuasi = (0, import_ts_extras35.arrayFirst)(node.quasis);
|
|
5211
5256
|
if (!(0, import_ts_extras35.isDefined)(firstQuasi) || typeof firstQuasi.value.cooked !== "string") {
|
|
5212
5257
|
return void 0;
|
|
@@ -5216,10 +5261,10 @@ var getStaticStringValue7 = (node) => {
|
|
|
5216
5261
|
return void 0;
|
|
5217
5262
|
};
|
|
5218
5263
|
var isWindowOpenCallee = (callee) => {
|
|
5219
|
-
if (callee.type !==
|
|
5264
|
+
if (callee.type !== import_utils60.AST_NODE_TYPES.MemberExpression || callee.computed) {
|
|
5220
5265
|
return false;
|
|
5221
5266
|
}
|
|
5222
|
-
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";
|
|
5223
5268
|
};
|
|
5224
5269
|
var hasNoopenerToken = (features) => (0, import_ts_extras35.stringSplit)(features.toLowerCase(), ",").map((token) => token.trim()).some((token) => token === "noopener" || token.startsWith("noopener="));
|
|
5225
5270
|
var rule67 = createRule({
|
|
@@ -5230,14 +5275,14 @@ var rule67 = createRule({
|
|
|
5230
5275
|
return;
|
|
5231
5276
|
}
|
|
5232
5277
|
const [, secondArgument, thirdArgument] = node.arguments;
|
|
5233
|
-
if (secondArgument === void 0 || secondArgument.type ===
|
|
5278
|
+
if (secondArgument === void 0 || secondArgument.type === import_utils60.AST_NODE_TYPES.SpreadElement) {
|
|
5234
5279
|
return;
|
|
5235
5280
|
}
|
|
5236
5281
|
const targetValue = getStaticStringValue7(secondArgument);
|
|
5237
5282
|
if (targetValue !== "_blank") {
|
|
5238
5283
|
return;
|
|
5239
5284
|
}
|
|
5240
|
-
if (thirdArgument === void 0 || thirdArgument.type ===
|
|
5285
|
+
if (thirdArgument === void 0 || thirdArgument.type === import_utils60.AST_NODE_TYPES.SpreadElement) {
|
|
5241
5286
|
context.report({
|
|
5242
5287
|
messageId: "default",
|
|
5243
5288
|
node
|
|
@@ -5303,6 +5348,7 @@ var rule68 = createRule({
|
|
|
5303
5348
|
var no_winjs_html_unsafe_default = rule68;
|
|
5304
5349
|
|
|
5305
5350
|
// dist/rules/no-worker-blob-url.js
|
|
5351
|
+
var import_utils61 = require("@typescript-eslint/utils");
|
|
5306
5352
|
var isBlobBackedWorkerCodeExpression = (expression) => {
|
|
5307
5353
|
const configuredValue = getStaticStringValue(expression);
|
|
5308
5354
|
return typeof configuredValue === "string" && isBlobUrl(configuredValue) || isUrlCreateObjectUrlCall(expression);
|
|
@@ -5315,7 +5361,7 @@ var rule69 = createRule({
|
|
|
5315
5361
|
return;
|
|
5316
5362
|
}
|
|
5317
5363
|
for (const argumentNode of node.arguments) {
|
|
5318
|
-
if (argumentNode.type ===
|
|
5364
|
+
if (argumentNode.type === import_utils61.AST_NODE_TYPES.SpreadElement || !isBlobBackedWorkerCodeExpression(argumentNode)) {
|
|
5319
5365
|
continue;
|
|
5320
5366
|
}
|
|
5321
5367
|
context.report({
|
|
@@ -5329,7 +5375,7 @@ var rule69 = createRule({
|
|
|
5329
5375
|
return;
|
|
5330
5376
|
}
|
|
5331
5377
|
const [firstArgument] = node.arguments;
|
|
5332
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
5378
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils61.AST_NODE_TYPES.SpreadElement || !isBlobBackedWorkerCodeExpression(firstArgument)) {
|
|
5333
5379
|
return;
|
|
5334
5380
|
}
|
|
5335
5381
|
context.report({
|
|
@@ -5358,6 +5404,7 @@ var rule69 = createRule({
|
|
|
5358
5404
|
var no_worker_blob_url_default = rule69;
|
|
5359
5405
|
|
|
5360
5406
|
// dist/rules/no-worker-data-url.js
|
|
5407
|
+
var import_utils62 = require("@typescript-eslint/utils");
|
|
5361
5408
|
var rule70 = createRule({
|
|
5362
5409
|
create(context) {
|
|
5363
5410
|
return {
|
|
@@ -5366,7 +5413,7 @@ var rule70 = createRule({
|
|
|
5366
5413
|
return;
|
|
5367
5414
|
}
|
|
5368
5415
|
for (const argumentNode of node.arguments) {
|
|
5369
|
-
if (argumentNode.type ===
|
|
5416
|
+
if (argumentNode.type === import_utils62.AST_NODE_TYPES.SpreadElement) {
|
|
5370
5417
|
continue;
|
|
5371
5418
|
}
|
|
5372
5419
|
const configuredValue = getStaticStringValue(argumentNode);
|
|
@@ -5384,7 +5431,7 @@ var rule70 = createRule({
|
|
|
5384
5431
|
return;
|
|
5385
5432
|
}
|
|
5386
5433
|
const [firstArgument] = node.arguments;
|
|
5387
|
-
if (firstArgument === void 0 || firstArgument.type ===
|
|
5434
|
+
if (firstArgument === void 0 || firstArgument.type === import_utils62.AST_NODE_TYPES.SpreadElement) {
|
|
5388
5435
|
return;
|
|
5389
5436
|
}
|
|
5390
5437
|
const configuredValue = getStaticStringValue(firstArgument);
|
|
@@ -5493,12 +5540,30 @@ var sdlRules = {
|
|
|
5493
5540
|
var rules_registry_default = sdlRules;
|
|
5494
5541
|
|
|
5495
5542
|
// dist/plugin.js
|
|
5496
|
-
var
|
|
5497
|
-
var
|
|
5498
|
-
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);
|
|
5499
5560
|
var typeScriptFiles = ["**/*.{ts,tsx,mts,cts}"];
|
|
5561
|
+
var createNamedConfig = (name, config = {}) => ({
|
|
5562
|
+
...config,
|
|
5563
|
+
name
|
|
5564
|
+
});
|
|
5500
5565
|
var createAngularConfig = (plugin) => [
|
|
5501
|
-
{
|
|
5566
|
+
createNamedConfig("SDL Angular Security", {
|
|
5502
5567
|
plugins: {
|
|
5503
5568
|
sdl: plugin
|
|
5504
5569
|
},
|
|
@@ -5508,10 +5573,10 @@ var createAngularConfig = (plugin) => [
|
|
|
5508
5573
|
"sdl/no-angular-innerhtml-binding": "error",
|
|
5509
5574
|
"sdl/no-angular-sanitization-trusted-urls": "error"
|
|
5510
5575
|
}
|
|
5511
|
-
}
|
|
5576
|
+
})
|
|
5512
5577
|
];
|
|
5513
5578
|
var createAngularJsConfig = (plugin) => [
|
|
5514
|
-
{
|
|
5579
|
+
createNamedConfig("SDL AngularJS Security", {
|
|
5515
5580
|
plugins: {
|
|
5516
5581
|
sdl: plugin
|
|
5517
5582
|
},
|
|
@@ -5522,10 +5587,10 @@ var createAngularJsConfig = (plugin) => [
|
|
|
5522
5587
|
"sdl/no-angularjs-sanitization-whitelist": "error",
|
|
5523
5588
|
"sdl/no-angularjs-sce-resource-url-wildcard": "error"
|
|
5524
5589
|
}
|
|
5525
|
-
}
|
|
5590
|
+
})
|
|
5526
5591
|
];
|
|
5527
5592
|
var createCommonConfig = (plugin) => [
|
|
5528
|
-
{
|
|
5593
|
+
createNamedConfig("SDL Common Web Security", {
|
|
5529
5594
|
plugins: {
|
|
5530
5595
|
sdl: plugin
|
|
5531
5596
|
},
|
|
@@ -5563,10 +5628,10 @@ var createCommonConfig = (plugin) => [
|
|
|
5563
5628
|
"sdl/no-worker-blob-url": "error",
|
|
5564
5629
|
"sdl/no-worker-data-url": "error"
|
|
5565
5630
|
}
|
|
5566
|
-
}
|
|
5631
|
+
})
|
|
5567
5632
|
];
|
|
5568
5633
|
var createElectronConfig = (plugin) => [
|
|
5569
|
-
{
|
|
5634
|
+
createNamedConfig("SDL Electron Security", {
|
|
5570
5635
|
plugins: {
|
|
5571
5636
|
sdl: plugin
|
|
5572
5637
|
},
|
|
@@ -5592,18 +5657,18 @@ var createElectronConfig = (plugin) => [
|
|
|
5592
5657
|
"sdl/no-electron-webview-insecure-webpreferences": "error",
|
|
5593
5658
|
"sdl/no-electron-webview-node-integration": "error"
|
|
5594
5659
|
}
|
|
5595
|
-
}
|
|
5660
|
+
})
|
|
5596
5661
|
];
|
|
5597
5662
|
var createNodeConfig = (plugin) => [
|
|
5598
|
-
{
|
|
5663
|
+
createNamedConfig("SDL Node.js Runtime Safety", {
|
|
5599
5664
|
plugins: {
|
|
5600
5665
|
n: nodeEslintPlugin
|
|
5601
5666
|
},
|
|
5602
5667
|
rules: {
|
|
5603
5668
|
"n/no-deprecated-api": "error"
|
|
5604
5669
|
}
|
|
5605
|
-
},
|
|
5606
|
-
{
|
|
5670
|
+
}),
|
|
5671
|
+
createNamedConfig("SDL Node.js Security", {
|
|
5607
5672
|
plugins: {
|
|
5608
5673
|
sdl: plugin
|
|
5609
5674
|
},
|
|
@@ -5621,10 +5686,10 @@ var createNodeConfig = (plugin) => [
|
|
|
5621
5686
|
"sdl/no-node-worker-threads-eval": "error",
|
|
5622
5687
|
"sdl/no-unsafe-alloc": "error"
|
|
5623
5688
|
}
|
|
5624
|
-
}
|
|
5689
|
+
})
|
|
5625
5690
|
];
|
|
5626
5691
|
var createReactConfig = (plugin) => [
|
|
5627
|
-
{
|
|
5692
|
+
createNamedConfig("SDL React JSX Support", {
|
|
5628
5693
|
languageOptions: {
|
|
5629
5694
|
parserOptions: {
|
|
5630
5695
|
ecmaFeatures: {
|
|
@@ -5632,23 +5697,23 @@ var createReactConfig = (plugin) => [
|
|
|
5632
5697
|
}
|
|
5633
5698
|
}
|
|
5634
5699
|
}
|
|
5635
|
-
},
|
|
5636
|
-
{
|
|
5700
|
+
}),
|
|
5701
|
+
createNamedConfig("SDL React Security", {
|
|
5637
5702
|
plugins: {
|
|
5638
5703
|
sdl: plugin
|
|
5639
5704
|
}
|
|
5640
|
-
}
|
|
5705
|
+
})
|
|
5641
5706
|
];
|
|
5642
5707
|
var createTypeScriptConfig = (plugin) => [
|
|
5643
|
-
{
|
|
5708
|
+
createNamedConfig("SDL TypeScript Parser Support", {
|
|
5644
5709
|
languageOptions: {
|
|
5645
5710
|
parserOptions: {
|
|
5646
5711
|
ecmaVersion: "latest",
|
|
5647
5712
|
sourceType: "module"
|
|
5648
5713
|
}
|
|
5649
5714
|
}
|
|
5650
|
-
},
|
|
5651
|
-
{
|
|
5715
|
+
}),
|
|
5716
|
+
createNamedConfig("SDL TypeScript Security", {
|
|
5652
5717
|
files: [...typeScriptFiles],
|
|
5653
5718
|
languageOptions: {
|
|
5654
5719
|
parser: import_parser.default,
|
|
@@ -5671,9 +5736,10 @@ var createTypeScriptConfig = (plugin) => [
|
|
|
5671
5736
|
"sdl/no-trusted-types-policy-pass-through": "error",
|
|
5672
5737
|
"sdl/no-unsafe-cast-to-trusted-types": "error"
|
|
5673
5738
|
}
|
|
5674
|
-
}
|
|
5739
|
+
})
|
|
5675
5740
|
];
|
|
5676
5741
|
var createRequiredConfig = (configs2) => [
|
|
5742
|
+
createNamedConfig("SDL Required Security Baseline"),
|
|
5677
5743
|
...configs2.angular,
|
|
5678
5744
|
...configs2.angularjs,
|
|
5679
5745
|
...configs2.common,
|
|
@@ -5682,22 +5748,24 @@ var createRequiredConfig = (configs2) => [
|
|
|
5682
5748
|
...configs2.react
|
|
5683
5749
|
];
|
|
5684
5750
|
var createRecommendedConfig = (configs2) => [
|
|
5751
|
+
createNamedConfig("SDL Recommended Security Baseline"),
|
|
5685
5752
|
...configs2.required,
|
|
5686
5753
|
...configs2.typescript,
|
|
5687
|
-
{
|
|
5754
|
+
createNamedConfig("SDL Recommended Security Plugins", {
|
|
5688
5755
|
plugins: {
|
|
5689
5756
|
security: securityEslintPlugin
|
|
5690
5757
|
}
|
|
5691
|
-
}
|
|
5758
|
+
})
|
|
5692
5759
|
];
|
|
5693
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;
|
|
5694
5762
|
var pluginCore = {
|
|
5695
5763
|
meta: {
|
|
5696
5764
|
name: "eslint-plugin-sdl-2",
|
|
5697
5765
|
namespace: "sdl",
|
|
5698
5766
|
version: packageJsonVersion
|
|
5699
5767
|
},
|
|
5700
|
-
rules:
|
|
5768
|
+
rules: pluginRules
|
|
5701
5769
|
};
|
|
5702
5770
|
var configs = {
|
|
5703
5771
|
angular: createAngularConfig(pluginCore),
|
|
@@ -5715,7 +5783,7 @@ configs.recommended = createRecommendedConfig(configs);
|
|
|
5715
5783
|
var sdlPlugin = {
|
|
5716
5784
|
...pluginCore,
|
|
5717
5785
|
configs,
|
|
5718
|
-
rules:
|
|
5786
|
+
rules: pluginRules
|
|
5719
5787
|
};
|
|
5720
5788
|
var plugin_default = sdlPlugin;
|
|
5721
5789
|
module.exports = module.exports.default;
|