eslint-plugin-sdl-2 1.2.5 → 1.2.7
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/CHANGELOG.md +81 -873
- package/README.md +2 -0
- package/dist/_internal/config-references.d.ts +2 -1
- package/dist/_internal/config-references.d.ts.map +1 -1
- package/dist/_internal/config-references.js.map +1 -1
- package/dist/_internal/electron-web-preferences.d.ts.map +1 -1
- package/dist/_internal/electron-web-preferences.js +1 -3
- package/dist/_internal/electron-web-preferences.js.map +1 -1
- package/dist/plugin.cjs +601 -639
- package/dist/plugin.cjs.map +3 -3
- package/dist/rules/no-angular-bypass-sanitizer.d.ts.map +1 -1
- package/dist/rules/no-angular-bypass-sanitizer.js +8 -10
- package/dist/rules/no-angular-bypass-sanitizer.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 +14 -17
- package/dist/rules/no-angular-bypass-security-trust-html.js.map +1 -1
- package/dist/rules/no-angular-innerhtml-binding.d.ts.map +1 -1
- package/dist/rules/no-angular-innerhtml-binding.js +30 -32
- package/dist/rules/no-angular-innerhtml-binding.js.map +1 -1
- package/dist/rules/no-angular-sanitization-trusted-urls.d.ts.map +1 -1
- package/dist/rules/no-angular-sanitization-trusted-urls.js +8 -10
- package/dist/rules/no-angular-sanitization-trusted-urls.js.map +1 -1
- package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.d.ts.map +1 -1
- package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.js +36 -38
- package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.js.map +1 -1
- package/dist/rules/no-angularjs-sanitization-whitelist.d.ts.map +1 -1
- package/dist/rules/no-angularjs-sanitization-whitelist.js +8 -10
- package/dist/rules/no-angularjs-sanitization-whitelist.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 -3
- package/dist/rules/no-document-parse-html-unsafe.js.map +1 -1
- package/dist/rules/no-dynamic-import-unsafe-url.d.ts.map +1 -1
- package/dist/rules/no-dynamic-import-unsafe-url.js +11 -13
- package/dist/rules/no-dynamic-import-unsafe-url.js.map +1 -1
- package/dist/rules/no-electron-allow-running-insecure-content.d.ts.map +1 -1
- package/dist/rules/no-electron-allow-running-insecure-content.js +4 -6
- package/dist/rules/no-electron-allow-running-insecure-content.js.map +1 -1
- package/dist/rules/no-electron-disable-context-isolation.d.ts.map +1 -1
- package/dist/rules/no-electron-disable-context-isolation.js +4 -6
- package/dist/rules/no-electron-disable-context-isolation.js.map +1 -1
- package/dist/rules/no-electron-disable-sandbox.d.ts.map +1 -1
- package/dist/rules/no-electron-disable-sandbox.js +4 -6
- package/dist/rules/no-electron-disable-sandbox.js.map +1 -1
- package/dist/rules/no-electron-disable-web-security.d.ts.map +1 -1
- package/dist/rules/no-electron-disable-web-security.js +4 -6
- package/dist/rules/no-electron-disable-web-security.js.map +1 -1
- package/dist/rules/no-electron-enable-remote-module.d.ts.map +1 -1
- package/dist/rules/no-electron-enable-remote-module.js +4 -6
- package/dist/rules/no-electron-enable-remote-module.js.map +1 -1
- package/dist/rules/no-electron-enable-webview-tag.d.ts.map +1 -1
- package/dist/rules/no-electron-enable-webview-tag.js +4 -6
- package/dist/rules/no-electron-enable-webview-tag.js.map +1 -1
- package/dist/rules/no-electron-experimental-features.d.ts.map +1 -1
- package/dist/rules/no-electron-experimental-features.js +4 -6
- package/dist/rules/no-electron-experimental-features.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.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.map +1 -1
- package/dist/rules/no-electron-node-integration.d.ts.map +1 -1
- package/dist/rules/no-electron-node-integration.js +27 -29
- package/dist/rules/no-electron-node-integration.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.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.map +1 -1
- package/dist/rules/no-electron-unrestricted-navigation.d.ts.map +1 -1
- package/dist/rules/no-electron-unrestricted-navigation.js.map +1 -1
- package/dist/rules/no-electron-webview-allowpopups.d.ts.map +1 -1
- package/dist/rules/no-electron-webview-allowpopups.js +21 -25
- 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 +28 -30
- 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 +27 -31
- package/dist/rules/no-electron-webview-node-integration.js.map +1 -1
- package/dist/rules/no-inner-html.js +3 -3
- package/dist/rules/no-inner-html.js.map +1 -1
- package/dist/rules/no-insecure-random.js +1 -1
- 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 +20 -22
- package/dist/rules/no-insecure-tls-agent-options.js.map +1 -1
- package/dist/rules/no-insecure-url.js +8 -8
- package/dist/rules/no-insecure-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 +19 -19
- package/dist/rules/no-message-event-without-origin-check.js.map +1 -1
- package/dist/rules/no-msapp-exec-unsafe.d.ts.map +1 -1
- package/dist/rules/no-msapp-exec-unsafe.js +8 -10
- package/dist/rules/no-msapp-exec-unsafe.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 +29 -32
- 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 +51 -50
- 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 +28 -30
- 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 +37 -39
- 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.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 +11 -13
- 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 +1 -3
- package/dist/rules/no-postmessage-star-origin.js.map +1 -1
- package/dist/rules/no-script-text.d.ts.map +1 -1
- package/dist/rules/no-script-text.js +6 -3
- package/dist/rules/no-script-text.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.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 +26 -28
- package/dist/rules/no-unsafe-cast-to-trusted-types.js.map +1 -1
- package/dist/rules/no-winjs-html-unsafe.d.ts.map +1 -1
- package/dist/rules/no-winjs-html-unsafe.js +8 -10
- package/dist/rules/no-winjs-html-unsafe.js.map +1 -1
- package/docs/rules/no-child-process-exec.md +1 -1
- package/docs/rules/no-child-process-shell-true.md +1 -1
- package/docs/rules/no-msapp-exec-unsafe.md +1 -1
- package/docs/rules/no-winjs-html-unsafe.md +1 -1
- package/docs/rules/presets/angular.md +2 -0
- package/docs/rules/presets/angularjs.md +2 -0
- package/docs/rules/presets/common.md +2 -0
- package/docs/rules/presets/electron.md +2 -0
- package/docs/rules/presets/node.md +2 -0
- package/docs/rules/presets/react.md +2 -0
- package/docs/rules/presets/recommended.md +2 -0
- package/docs/rules/presets/required.md +2 -0
- package/docs/rules/presets/typescript.md +2 -0
- package/package.json +50 -41
package/dist/plugin.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var securityPluginModule = __toESM(require("eslint-plugin-security"), 1);
|
|
|
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.7",
|
|
46
46
|
private: false,
|
|
47
47
|
description: "ESLint plugin providing SDL-focused security and platform hardening rules.",
|
|
48
48
|
keywords: [
|
|
@@ -67,7 +67,7 @@ var package_default = {
|
|
|
67
67
|
url: "git+https://github.com/Nick2bad4u/eslint-plugin-SDL-2.git"
|
|
68
68
|
},
|
|
69
69
|
license: "MIT",
|
|
70
|
-
author: "Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com> (https://
|
|
70
|
+
author: "Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com> (https://github.com/Nick2bad4u)",
|
|
71
71
|
contributors: [
|
|
72
72
|
{
|
|
73
73
|
name: "Nick2bad4u",
|
|
@@ -126,7 +126,7 @@ var package_default = {
|
|
|
126
126
|
"build:types:cjs": `node -e "require('node:fs').copyFileSync('dist/plugin.d.ts','dist/plugin.d.cts')"`,
|
|
127
127
|
"changelog:generate": "git-cliff --config cliff.toml --output CHANGELOG.md",
|
|
128
128
|
"changelog:preview": "git-cliff --config cliff.toml --unreleased",
|
|
129
|
-
"changelog:release-notes": "git-cliff --config cliff.toml --
|
|
129
|
+
"changelog:release-notes": "git-cliff --config cliff.toml --current --strip all",
|
|
130
130
|
"clean:cache": "node scripts/remove-paths.mjs dist coverage cache .cache .vite .turbo",
|
|
131
131
|
"clean:cache:coverage": "node scripts/remove-paths.mjs coverage .coverage",
|
|
132
132
|
"clean:cache:dist": "node scripts/remove-paths.mjs dist release",
|
|
@@ -163,9 +163,9 @@ var package_default = {
|
|
|
163
163
|
lint: "cross-env NODE_OPTIONS=--max_old_space_size=16384 eslint --cache --cache-strategy content --cache-location .cache/.eslintcache",
|
|
164
164
|
"lint:action": "npm run lint:actions",
|
|
165
165
|
"lint:actions": "node scripts/lint-actionlint.mjs",
|
|
166
|
-
"lint:all": "npm run lint && npm run lint:css && npm run lint:prettier && npm run lint:remark && npm run lint:package && npm run lint:secretlint && npm run lint:yaml && npm run lint:actions && npm run lint:circular",
|
|
167
|
-
"lint:all:fix": "npm run lint:fix && npm run lint:css:fix && npm run lint:prettier:fix && npm run lint:remark && npm run lint:package && npm run lint:secretlint && npm run lint:yaml:fix && npm run lint:actions && npm run lint:circular",
|
|
168
|
-
"lint:all:fix:quiet": "npm run lint:fix:quiet && npm run lint:css:fix && npm run lint:prettier:fix && npm run lint:remark && npm run lint:package && npm run lint:secretlint && npm run lint:yaml:fix && npm run lint:actions && npm run lint:circular",
|
|
166
|
+
"lint:all": "npm run lint && npm run lint:css && npm run lint:prettier && npm run lint:remark && npm run lint:package && npm run lint:gitleaks && npm run lint:secretlint && npm run lint:yaml && npm run lint:yamllint && npm run lint:actions && npm run lint:circular",
|
|
167
|
+
"lint:all:fix": "npm run lint:fix && npm run lint:css:fix && npm run lint:prettier:fix && npm run lint:remark && npm run lint:package && npm run lint:gitleaks && npm run lint:secretlint && npm run lint:yaml:fix && npm run lint:yamllint && npm run lint:actions && npm run lint:circular",
|
|
168
|
+
"lint:all:fix:quiet": "npm run lint:fix:quiet && npm run lint:css:fix && npm run lint:prettier:fix && npm run lint:remark && npm run lint:package && npm run lint:gitleaks && npm run lint:secretlint && npm run lint:yaml:fix && npm run lint:yamllint && npm run lint:actions && npm run lint:circular",
|
|
169
169
|
"lint:circular": "npm run madge:circular",
|
|
170
170
|
"lint:compat:eslint9": "node scripts/eslint9-compat-smoke.mjs",
|
|
171
171
|
"lint:config:build": "npm run build:eslint-inspector",
|
|
@@ -182,6 +182,7 @@ var package_default = {
|
|
|
182
182
|
"lint:exports": "ts-unused-exports tsconfig.json src/plugin.ts --excludePathsFromReport=plugin.ts",
|
|
183
183
|
"lint:fix": "cross-env NODE_OPTIONS=--max_old_space_size=16384 eslint --cache --cache-strategy content --cache-location .cache/.eslintcache --fix",
|
|
184
184
|
"lint:fix:quiet": 'cross-env ESLINT_PROGRESS=off NODE_OPTIONS=--max_old_space_size=16384 eslint --cache --cache-strategy content --cache-location .cache/.eslintcache --fix && echo "Eslint fix done!"',
|
|
185
|
+
"lint:gitleaks": "gitleaks dir --config .gitleaks.toml .",
|
|
185
186
|
"lint:grype": "grype . -c .grype.yaml --name eslint-plugin-sdl-2",
|
|
186
187
|
"lint:knip": "npm run knip",
|
|
187
188
|
"lint:knip:exports": "npm run knip -- --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates",
|
|
@@ -209,13 +210,14 @@ var package_default = {
|
|
|
209
210
|
"lint:unused-deps": "npm run knip -- --include dependencies",
|
|
210
211
|
"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
212
|
"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!"',
|
|
213
|
+
"lint:yamllint": "yamllint .",
|
|
212
214
|
"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$"',
|
|
213
215
|
"madge:leaves": 'madge --leaves --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$"',
|
|
214
216
|
"madge:orphans": 'madge --orphans --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$"',
|
|
215
217
|
"open:coverage": "open-cli coverage/index.html",
|
|
216
218
|
prepublishOnly: "npm run release:check",
|
|
217
219
|
"release:check": "npm run release:verify",
|
|
218
|
-
"release:verify": "npm run build && npm run lint && npm run typecheck && npm run test && npm run sync:readme-rules-table && npm run sync:presets-rules-matrix && npm run docs:check-links && npm pack --dry-run",
|
|
220
|
+
"release:verify": "npm run build && npm run docs:api && npm run lint && npm run typecheck && npm run test && npm run sync:readme-rules-table && npm run sync:presets-rules-matrix && npm run docs:check-links && npm pack --dry-run",
|
|
219
221
|
"remark:fix": 'remark --rc-path .remarkrc.mjs --silently-ignore --ignore-path .remarkignore --frail --quiet --output -- "*.{md,mdx}" "docs/**/*.{md,mdx}"',
|
|
220
222
|
"remark:test-config": 'remark --rc-path .remarkrc.mjs --silently-ignore --ignore-path .remarkignore --frail "README.md"',
|
|
221
223
|
"sync:node-version-files": "node scripts/sync-node-version-files.mjs",
|
|
@@ -251,6 +253,7 @@ var package_default = {
|
|
|
251
253
|
typecheck: "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.build.json --noEmit && tsc -p tsconfig.eslint.json --noEmit && tsc -p tsconfig.js.json --noEmit && npm run --workspace docs/docusaurus typecheck",
|
|
252
254
|
"typecheck:all": "npm run typecheck",
|
|
253
255
|
"types:update": "typesync",
|
|
256
|
+
"update-actions": "npx actions-up --yes --style sha",
|
|
254
257
|
"update-deps": "npx ncu -i --install never && npm update --workspaces --force && npm install --force && npm run sync:peer-eslint-range && npm run sync:node-version-files && npm run sync:rules:write",
|
|
255
258
|
"verify:readme-rules-table": "npm run build && npm run sync:readme-rules-table"
|
|
256
259
|
},
|
|
@@ -259,21 +262,21 @@ var package_default = {
|
|
|
259
262
|
},
|
|
260
263
|
dependencies: {
|
|
261
264
|
"@types/eslint-plugin-security": "^3.0.1",
|
|
262
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
263
|
-
"@typescript-eslint/parser": "^8.
|
|
264
|
-
"@typescript-eslint/type-utils": "^8.
|
|
265
|
-
"@typescript-eslint/utils": "^8.
|
|
266
|
-
"eslint-plugin-n": "^18.0
|
|
267
|
-
"eslint-plugin-security": "^
|
|
265
|
+
"@typescript-eslint/eslint-plugin": "^8.61.1",
|
|
266
|
+
"@typescript-eslint/parser": "^8.61.1",
|
|
267
|
+
"@typescript-eslint/type-utils": "^8.61.1",
|
|
268
|
+
"@typescript-eslint/utils": "^8.61.1",
|
|
269
|
+
"eslint-plugin-n": "^18.1.0",
|
|
270
|
+
"eslint-plugin-security": "^4.0.1",
|
|
268
271
|
"ts-extras": "^1.0.0",
|
|
269
|
-
"type-fest": "^5.
|
|
272
|
+
"type-fest": "^5.7.0"
|
|
270
273
|
},
|
|
271
274
|
devDependencies: {
|
|
272
|
-
"@arethetypeswrong/cli": "^0.18.
|
|
275
|
+
"@arethetypeswrong/cli": "^0.18.3",
|
|
273
276
|
"@csstools/stylelint-formatter-github": "^2.0.0",
|
|
274
277
|
"@double-great/remark-lint-alt-text": "^1.1.1",
|
|
275
278
|
"@eslint/compat": "^2.1.0",
|
|
276
|
-
"@eslint/config-inspector": "^3.0.
|
|
279
|
+
"@eslint/config-inspector": "^3.0.4",
|
|
277
280
|
"@microsoft/tsdoc-config": "^0.18.1",
|
|
278
281
|
"@stryker-ignorer/console-all": "^0.3.2",
|
|
279
282
|
"@stryker-mutator/core": "^9.6.1",
|
|
@@ -281,63 +284,69 @@ var package_default = {
|
|
|
281
284
|
"@stryker-mutator/vitest-runner": "^9.6.1",
|
|
282
285
|
"@types/htmlhint": "^1.1.5",
|
|
283
286
|
"@types/madge": "^5.0.3",
|
|
284
|
-
"@types/node": "^25.
|
|
287
|
+
"@types/node": "^25.9.3",
|
|
285
288
|
"@types/sloc": "^0.2.3",
|
|
286
|
-
"@typescript-eslint/rule-tester": "^8.
|
|
287
|
-
"@vitest/coverage-v8": "^4.1.
|
|
288
|
-
"@vitest/ui": "^4.1.
|
|
289
|
+
"@typescript-eslint/rule-tester": "^8.61.1",
|
|
290
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
291
|
+
"@vitest/ui": "^4.1.9",
|
|
289
292
|
actionlint: "^2.0.6",
|
|
290
293
|
"all-contributors-cli": "^6.26.1",
|
|
291
|
-
"cognitive-complexity-ts": "^0.8.
|
|
292
|
-
commitlint: "^21.0.
|
|
294
|
+
"cognitive-complexity-ts": "^0.8.2",
|
|
295
|
+
commitlint: "^21.0.2",
|
|
293
296
|
"commitlint-config-gitmoji": "^2.3.1",
|
|
294
297
|
"cross-env": "^10.1.0",
|
|
295
298
|
"detect-secrets": "^1.0.6",
|
|
296
|
-
eslint: "^10.
|
|
297
|
-
"eslint-config-nick2bad4u": "^
|
|
299
|
+
eslint: "^10.5.0",
|
|
300
|
+
"eslint-config-nick2bad4u": "^2.0.4",
|
|
298
301
|
"eslint-formatter-unix": "^9.0.1",
|
|
299
302
|
"eslint-rule-benchmark": "^0.8.0",
|
|
300
303
|
"fast-check": "^4.8.0",
|
|
301
304
|
"git-cliff": "^2.13.1",
|
|
305
|
+
"gitleaks-config-nick2bad4u": "^1.0.2",
|
|
302
306
|
"gitleaks-secret-scanner": "^2.1.1",
|
|
303
307
|
htmlhint: "^1.9.2",
|
|
304
|
-
jscpd: "^
|
|
305
|
-
knip: "^6.
|
|
308
|
+
jscpd: "^5.0.10",
|
|
309
|
+
knip: "^6.17.1",
|
|
306
310
|
leasot: "^14.4.0",
|
|
307
311
|
madge: "^8.0.0",
|
|
308
312
|
"markdown-link-check": "^3.14.2",
|
|
309
|
-
"npm-check-updates": "^22.2.
|
|
310
|
-
"npm-package-json-lint": "^10.4.
|
|
313
|
+
"npm-check-updates": "^22.2.3",
|
|
314
|
+
"npm-package-json-lint": "^10.4.1",
|
|
315
|
+
"npm-package-json-lint-config-nick2bad4u": "^1.0.3",
|
|
311
316
|
picocolors: "^1.1.1",
|
|
312
|
-
prettier: "^3.8.
|
|
313
|
-
"prettier-config-nick2bad4u": "^1.0.
|
|
317
|
+
prettier: "^3.8.4",
|
|
318
|
+
"prettier-config-nick2bad4u": "^1.0.17",
|
|
314
319
|
publint: "^0.3.21",
|
|
315
320
|
"rehype-katex": "^7.0.1",
|
|
316
321
|
remark: "^15.0.1",
|
|
317
322
|
"remark-cli": "^12.0.1",
|
|
318
|
-
"remark-config-nick2bad4u": "^1.0.
|
|
319
|
-
secretlint: "^13.0.
|
|
320
|
-
"secretlint-config-nick2bad4u": "^1.0
|
|
323
|
+
"remark-config-nick2bad4u": "^1.0.8",
|
|
324
|
+
secretlint: "^13.0.2",
|
|
325
|
+
"secretlint-config-nick2bad4u": "^1.1.0",
|
|
321
326
|
sloc: "^0.3.2",
|
|
322
|
-
"sort-package-json": "^
|
|
323
|
-
|
|
324
|
-
|
|
327
|
+
"sort-package-json": "^4.0.0",
|
|
328
|
+
storybook: "^10.4.6",
|
|
329
|
+
stylelint: "^17.13.0",
|
|
330
|
+
"stylelint-config-nick2bad4u": "^1.0.19",
|
|
325
331
|
"ts-unused-exports": "^11.0.1",
|
|
332
|
+
"tsdoc-config-nick2bad4u": "^1.0.5",
|
|
326
333
|
typedoc: "^0.28.19",
|
|
334
|
+
"typedoc-config-nick2bad4u": "^2.0.0",
|
|
327
335
|
typescript: "^6.0.3",
|
|
328
|
-
"typescript-eslint": "^8.
|
|
336
|
+
"typescript-eslint": "^8.61.1",
|
|
329
337
|
typesync: "^0.14.3",
|
|
330
338
|
vfile: "^6.0.3",
|
|
331
|
-
vite: "^8.0.
|
|
339
|
+
vite: "^8.0.16",
|
|
332
340
|
"vite-tsconfig-paths": "^6.1.1",
|
|
333
|
-
vitest: "^4.1.
|
|
341
|
+
vitest: "^4.1.9",
|
|
342
|
+
"yamllint-config-nick2bad4u": "^1.0.2",
|
|
334
343
|
"yamllint-js": "^0.2.4"
|
|
335
344
|
},
|
|
336
345
|
peerDependencies: {
|
|
337
|
-
eslint: "^9.0.0 || ^10.
|
|
346
|
+
eslint: "^9.0.0 || ^10.5.0",
|
|
338
347
|
typescript: ">=5.0.0"
|
|
339
348
|
},
|
|
340
|
-
packageManager: "npm@11.
|
|
349
|
+
packageManager: "npm@11.18.0",
|
|
341
350
|
engines: {
|
|
342
351
|
node: ">=20.19.0"
|
|
343
352
|
},
|
|
@@ -371,16 +380,14 @@ var createRule = ruleCreatorFactory;
|
|
|
371
380
|
|
|
372
381
|
// dist/rules/no-angular-bypass-sanitizer.js
|
|
373
382
|
var rule = createRule({
|
|
374
|
-
create(context) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
};
|
|
383
|
-
},
|
|
383
|
+
create: (context) => ({
|
|
384
|
+
"CallExpression[arguments.length>0][callee.property.name=/^bypassSecurityTrust(?:html|resourceurl|script|style|url)$/i]"(node) {
|
|
385
|
+
context.report({
|
|
386
|
+
messageId: "noBypass",
|
|
387
|
+
node
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
}),
|
|
384
391
|
meta: {
|
|
385
392
|
deprecated: false,
|
|
386
393
|
docs: {
|
|
@@ -411,22 +418,20 @@ var getMemberPropertyName = (memberExpression) => {
|
|
|
411
418
|
return void 0;
|
|
412
419
|
};
|
|
413
420
|
var rule2 = createRule({
|
|
414
|
-
create(context) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
if (getMemberPropertyName(node.callee) !== "bypassSecurityTrustHtml") {
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
context.report({
|
|
424
|
-
messageId: "default",
|
|
425
|
-
node
|
|
426
|
-
});
|
|
421
|
+
create: (context) => ({
|
|
422
|
+
CallExpression(node) {
|
|
423
|
+
if (node.callee.type !== import_utils2.AST_NODE_TYPES.MemberExpression) {
|
|
424
|
+
return;
|
|
427
425
|
}
|
|
428
|
-
|
|
429
|
-
|
|
426
|
+
if (getMemberPropertyName(node.callee) !== "bypassSecurityTrustHtml") {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
context.report({
|
|
430
|
+
messageId: "default",
|
|
431
|
+
node
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
}),
|
|
430
435
|
meta: {
|
|
431
436
|
deprecated: false,
|
|
432
437
|
docs: {
|
|
@@ -449,38 +454,36 @@ var no_angular_bypass_security_trust_html_default = rule2;
|
|
|
449
454
|
var import_ts_extras = require("ts-extras");
|
|
450
455
|
var hasInnerHtmlBindingPattern = (text) => /\[\s*innerhtml\s*\]\s*=/iv.test(text);
|
|
451
456
|
var rule3 = createRule({
|
|
452
|
-
create(context) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
if (!hasInnerHtmlBindingPattern(node.value)) {
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
context.report({
|
|
462
|
-
messageId: "default",
|
|
463
|
-
node
|
|
464
|
-
});
|
|
465
|
-
},
|
|
466
|
-
TemplateLiteral(node) {
|
|
467
|
-
if (node.expressions.length > 0) {
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
const templateValue = (0, import_ts_extras.arrayFirst)(node.quasis)?.value.cooked;
|
|
471
|
-
if (typeof templateValue !== "string") {
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
if (!hasInnerHtmlBindingPattern(templateValue)) {
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
context.report({
|
|
478
|
-
messageId: "default",
|
|
479
|
-
node
|
|
480
|
-
});
|
|
457
|
+
create: (context) => ({
|
|
458
|
+
Literal(node) {
|
|
459
|
+
if (typeof node.value !== "string") {
|
|
460
|
+
return;
|
|
481
461
|
}
|
|
482
|
-
|
|
483
|
-
|
|
462
|
+
if (!hasInnerHtmlBindingPattern(node.value)) {
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
context.report({
|
|
466
|
+
messageId: "default",
|
|
467
|
+
node
|
|
468
|
+
});
|
|
469
|
+
},
|
|
470
|
+
TemplateLiteral(node) {
|
|
471
|
+
if (node.expressions.length > 0) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
const templateValue = (0, import_ts_extras.arrayFirst)(node.quasis)?.value.cooked;
|
|
475
|
+
if (typeof templateValue !== "string") {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
if (!hasInnerHtmlBindingPattern(templateValue)) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
context.report({
|
|
482
|
+
messageId: "default",
|
|
483
|
+
node
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}),
|
|
484
487
|
meta: {
|
|
485
488
|
deprecated: false,
|
|
486
489
|
docs: {
|
|
@@ -501,16 +504,14 @@ var no_angular_innerhtml_binding_default = rule3;
|
|
|
501
504
|
|
|
502
505
|
// dist/rules/no-angular-sanitization-trusted-urls.js
|
|
503
506
|
var rule4 = createRule({
|
|
504
|
-
create(context) {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
};
|
|
513
|
-
},
|
|
507
|
+
create: (context) => ({
|
|
508
|
+
"CallExpression[arguments.length>0][callee.object.name='$compileProvider'][callee.property.name=/^(?:aHref|imgSrc)SanitizationTrustedUrlList$/]"(node) {
|
|
509
|
+
context.report({
|
|
510
|
+
messageId: "noSanitizationTrustedUrls",
|
|
511
|
+
node
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
}),
|
|
514
515
|
meta: {
|
|
515
516
|
deprecated: false,
|
|
516
517
|
docs: {
|
|
@@ -653,44 +654,42 @@ var import_ts_extras4 = require("ts-extras");
|
|
|
653
654
|
var hasNgBindHtmlPattern = (text) => /\bng-bind-html\b/iv.test(text);
|
|
654
655
|
var hasKnownSanitizePattern = (text) => /\b(?:ngsanitize|\$sanitize|sanitize)\b/iv.test(text);
|
|
655
656
|
var rule6 = createRule({
|
|
656
|
-
create(context) {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
|
-
if (!hasNgBindHtmlPattern(node.value)) {
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
if (hasKnownSanitizePattern(node.value)) {
|
|
666
|
-
return;
|
|
667
|
-
}
|
|
668
|
-
context.report({
|
|
669
|
-
messageId: "default",
|
|
670
|
-
node
|
|
671
|
-
});
|
|
672
|
-
},
|
|
673
|
-
TemplateLiteral(node) {
|
|
674
|
-
if (node.expressions.length > 0) {
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
const templateValue = (0, import_ts_extras4.arrayFirst)(node.quasis)?.value.cooked;
|
|
678
|
-
if (typeof templateValue !== "string") {
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
if (!hasNgBindHtmlPattern(templateValue)) {
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
if (hasKnownSanitizePattern(templateValue)) {
|
|
685
|
-
return;
|
|
686
|
-
}
|
|
687
|
-
context.report({
|
|
688
|
-
messageId: "default",
|
|
689
|
-
node
|
|
690
|
-
});
|
|
657
|
+
create: (context) => ({
|
|
658
|
+
Literal(node) {
|
|
659
|
+
if (typeof node.value !== "string") {
|
|
660
|
+
return;
|
|
691
661
|
}
|
|
692
|
-
|
|
693
|
-
|
|
662
|
+
if (!hasNgBindHtmlPattern(node.value)) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
if (hasKnownSanitizePattern(node.value)) {
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
context.report({
|
|
669
|
+
messageId: "default",
|
|
670
|
+
node
|
|
671
|
+
});
|
|
672
|
+
},
|
|
673
|
+
TemplateLiteral(node) {
|
|
674
|
+
if (node.expressions.length > 0) {
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
const templateValue = (0, import_ts_extras4.arrayFirst)(node.quasis)?.value.cooked;
|
|
678
|
+
if (typeof templateValue !== "string") {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
if (!hasNgBindHtmlPattern(templateValue)) {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
if (hasKnownSanitizePattern(templateValue)) {
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
context.report({
|
|
688
|
+
messageId: "default",
|
|
689
|
+
node
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
}),
|
|
694
693
|
meta: {
|
|
695
694
|
deprecated: false,
|
|
696
695
|
docs: {
|
|
@@ -711,16 +710,14 @@ var no_angularjs_ng_bind_html_without_sanitize_default = rule6;
|
|
|
711
710
|
|
|
712
711
|
// dist/rules/no-angularjs-sanitization-whitelist.js
|
|
713
712
|
var rule7 = createRule({
|
|
714
|
-
create(context) {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
};
|
|
723
|
-
},
|
|
713
|
+
create: (context) => ({
|
|
714
|
+
"CallExpression[arguments.length>0][callee.object.name='$compileProvider'][callee.property.name=/^(?:aHref|imgSrc)SanitizationWhitelist$/]"(node) {
|
|
715
|
+
context.report({
|
|
716
|
+
messageId: "noSanitizationWhitelist",
|
|
717
|
+
node
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
}),
|
|
724
721
|
meta: {
|
|
725
722
|
deprecated: false,
|
|
726
723
|
docs: {
|
|
@@ -1261,6 +1258,7 @@ var no_document_execcommand_insert_html_default = rule13;
|
|
|
1261
1258
|
|
|
1262
1259
|
// dist/rules/no-document-parse-html-unsafe.js
|
|
1263
1260
|
var import_utils12 = require("@typescript-eslint/utils");
|
|
1261
|
+
var import_ts_extras8 = require("ts-extras");
|
|
1264
1262
|
var isDocumentConstructorReference = (expression) => {
|
|
1265
1263
|
if (expression.type === import_utils12.AST_NODE_TYPES.Identifier) {
|
|
1266
1264
|
return expression.name === "Document";
|
|
@@ -1271,7 +1269,11 @@ var isDocumentConstructorReference = (expression) => {
|
|
|
1271
1269
|
if (getMemberPropertyName3(expression) !== "Document") {
|
|
1272
1270
|
return false;
|
|
1273
1271
|
}
|
|
1274
|
-
return expression.object.type === import_utils12.AST_NODE_TYPES.Identifier && (
|
|
1272
|
+
return expression.object.type === import_utils12.AST_NODE_TYPES.Identifier && (0, import_ts_extras8.arrayIncludes)([
|
|
1273
|
+
"globalThis",
|
|
1274
|
+
"self",
|
|
1275
|
+
"window"
|
|
1276
|
+
], expression.object.name);
|
|
1275
1277
|
};
|
|
1276
1278
|
var isDocumentParseHtmlUnsafeCall = (node) => {
|
|
1277
1279
|
if (node.callee.type !== import_utils12.AST_NODE_TYPES.MemberExpression) {
|
|
@@ -1358,7 +1360,7 @@ var no_document_write_default = rule15;
|
|
|
1358
1360
|
|
|
1359
1361
|
// dist/rules/no-domparser-html-without-sanitization.js
|
|
1360
1362
|
var import_utils15 = require("@typescript-eslint/utils");
|
|
1361
|
-
var
|
|
1363
|
+
var import_ts_extras9 = require("ts-extras");
|
|
1362
1364
|
|
|
1363
1365
|
// dist/_internal/domparser.js
|
|
1364
1366
|
var import_utils14 = require("@typescript-eslint/utils");
|
|
@@ -1401,7 +1403,7 @@ var rule16 = createRule({
|
|
|
1401
1403
|
return;
|
|
1402
1404
|
}
|
|
1403
1405
|
const [firstArgument, secondArgument] = node.arguments;
|
|
1404
|
-
if (!(0,
|
|
1406
|
+
if (!(0, import_ts_extras9.isDefined)(firstArgument) || !(0, import_ts_extras9.isDefined)(secondArgument)) {
|
|
1405
1407
|
return;
|
|
1406
1408
|
}
|
|
1407
1409
|
if (firstArgument.type === import_utils15.AST_NODE_TYPES.SpreadElement || secondArgument.type === import_utils15.AST_NODE_TYPES.SpreadElement) {
|
|
@@ -1441,7 +1443,7 @@ var no_domparser_html_without_sanitization_default = rule16;
|
|
|
1441
1443
|
|
|
1442
1444
|
// dist/rules/no-domparser-svg-without-sanitization.js
|
|
1443
1445
|
var import_utils16 = require("@typescript-eslint/utils");
|
|
1444
|
-
var
|
|
1446
|
+
var import_ts_extras10 = require("ts-extras");
|
|
1445
1447
|
var rule17 = createRule({
|
|
1446
1448
|
create(context) {
|
|
1447
1449
|
return {
|
|
@@ -1453,7 +1455,7 @@ var rule17 = createRule({
|
|
|
1453
1455
|
return;
|
|
1454
1456
|
}
|
|
1455
1457
|
const [firstArgument, secondArgument] = node.arguments;
|
|
1456
|
-
if (!(0,
|
|
1458
|
+
if (!(0, import_ts_extras10.isDefined)(firstArgument) || !(0, import_ts_extras10.isDefined)(secondArgument)) {
|
|
1457
1459
|
return;
|
|
1458
1460
|
}
|
|
1459
1461
|
if (firstArgument.type === import_utils16.AST_NODE_TYPES.SpreadElement || secondArgument.type === import_utils16.AST_NODE_TYPES.SpreadElement) {
|
|
@@ -1493,7 +1495,7 @@ var no_domparser_svg_without_sanitization_default = rule17;
|
|
|
1493
1495
|
|
|
1494
1496
|
// dist/_internal/worker-code-loading.js
|
|
1495
1497
|
var import_utils17 = require("@typescript-eslint/utils");
|
|
1496
|
-
var
|
|
1498
|
+
var import_ts_extras11 = require("ts-extras");
|
|
1497
1499
|
var WORKER_CONSTRUCTOR_NAMES = /* @__PURE__ */ new Set(["SharedWorker", "Worker"]);
|
|
1498
1500
|
var GLOBAL_OBJECT_NAMES = /* @__PURE__ */ new Set([
|
|
1499
1501
|
"globalThis",
|
|
@@ -1507,12 +1509,12 @@ var isNavigatorObject = (value) => {
|
|
|
1507
1509
|
if (value.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1508
1510
|
return false;
|
|
1509
1511
|
}
|
|
1510
|
-
return getMemberPropertyName3(value) === "navigator" && value.object.type === import_utils17.AST_NODE_TYPES.Identifier && (0,
|
|
1512
|
+
return getMemberPropertyName3(value) === "navigator" && value.object.type === import_utils17.AST_NODE_TYPES.Identifier && (0, import_ts_extras11.setHas)(GLOBAL_OBJECT_NAMES, value.object.name);
|
|
1511
1513
|
};
|
|
1512
1514
|
var isBlobUrl = (value) => /^\s*blob:/iv.test(value);
|
|
1513
1515
|
var isDataUrl = (value) => /^\s*data:/iv.test(value);
|
|
1514
|
-
var isWorkerConstructorName = (value) => (0,
|
|
1515
|
-
var isGlobalObjectName = (value) => (0,
|
|
1516
|
+
var isWorkerConstructorName = (value) => (0, import_ts_extras11.isDefined)(value) && (0, import_ts_extras11.setHas)(WORKER_CONSTRUCTOR_NAMES, value);
|
|
1517
|
+
var isGlobalObjectName = (value) => (0, import_ts_extras11.setHas)(GLOBAL_OBJECT_NAMES, value);
|
|
1516
1518
|
var isWorkerGlobalObject = (value) => value.type === import_utils17.AST_NODE_TYPES.Identifier && isGlobalObjectName(value.name);
|
|
1517
1519
|
var isWorkerConstructor = (callee) => {
|
|
1518
1520
|
if (callee.type === import_utils17.AST_NODE_TYPES.Identifier) {
|
|
@@ -1562,19 +1564,17 @@ var isUnsafeDynamicImportSource = (expression) => {
|
|
|
1562
1564
|
return typeof configuredValue === "string" && (isBlobUrl(configuredValue) || isDataUrl(configuredValue) || isJavaScriptUrl(configuredValue)) || isUrlCreateObjectUrlCall(expression);
|
|
1563
1565
|
};
|
|
1564
1566
|
var rule18 = createRule({
|
|
1565
|
-
create(context) {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
return;
|
|
1570
|
-
}
|
|
1571
|
-
context.report({
|
|
1572
|
-
messageId: "default",
|
|
1573
|
-
node: node.source
|
|
1574
|
-
});
|
|
1567
|
+
create: (context) => ({
|
|
1568
|
+
ImportExpression(node) {
|
|
1569
|
+
if (!isUnsafeDynamicImportSource(node.source)) {
|
|
1570
|
+
return;
|
|
1575
1571
|
}
|
|
1576
|
-
|
|
1577
|
-
|
|
1572
|
+
context.report({
|
|
1573
|
+
messageId: "default",
|
|
1574
|
+
node: node.source
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
}),
|
|
1578
1578
|
meta: {
|
|
1579
1579
|
deprecated: false,
|
|
1580
1580
|
docs: {
|
|
@@ -1641,9 +1641,7 @@ var createElectronWebPreferencesBooleanListener = (context, check) => ({
|
|
|
1641
1641
|
return;
|
|
1642
1642
|
}
|
|
1643
1643
|
context.report({
|
|
1644
|
-
fix(fixer)
|
|
1645
|
-
return fixer.replaceText(preferenceValueNode, String(!check.disallowedValue));
|
|
1646
|
-
},
|
|
1644
|
+
fix: (fixer) => fixer.replaceText(preferenceValueNode, String(!check.disallowedValue)),
|
|
1647
1645
|
messageId: "default",
|
|
1648
1646
|
node: preferenceProperty
|
|
1649
1647
|
});
|
|
@@ -1652,12 +1650,10 @@ var createElectronWebPreferencesBooleanListener = (context, check) => ({
|
|
|
1652
1650
|
|
|
1653
1651
|
// dist/rules/no-electron-allow-running-insecure-content.js
|
|
1654
1652
|
var rule19 = createRule({
|
|
1655
|
-
create(context) {
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
});
|
|
1660
|
-
},
|
|
1653
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1654
|
+
disallowedValue: true,
|
|
1655
|
+
preferenceName: "allowRunningInsecureContent"
|
|
1656
|
+
}),
|
|
1661
1657
|
meta: {
|
|
1662
1658
|
deprecated: false,
|
|
1663
1659
|
docs: {
|
|
@@ -1679,7 +1675,7 @@ var no_electron_allow_running_insecure_content_default = rule19;
|
|
|
1679
1675
|
|
|
1680
1676
|
// dist/rules/no-electron-dangerous-blink-features.js
|
|
1681
1677
|
var import_utils19 = require("@typescript-eslint/utils");
|
|
1682
|
-
var
|
|
1678
|
+
var import_ts_extras12 = require("ts-extras");
|
|
1683
1679
|
var getPropertyName3 = (property) => {
|
|
1684
1680
|
if (property.computed) {
|
|
1685
1681
|
return void 0;
|
|
@@ -1705,7 +1701,7 @@ var getStaticStringValue2 = (node) => {
|
|
|
1705
1701
|
return node.value;
|
|
1706
1702
|
}
|
|
1707
1703
|
if (node.type === import_utils19.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
1708
|
-
return (0,
|
|
1704
|
+
return (0, import_ts_extras12.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
1709
1705
|
}
|
|
1710
1706
|
return void 0;
|
|
1711
1707
|
};
|
|
@@ -1762,12 +1758,10 @@ var no_electron_dangerous_blink_features_default = rule20;
|
|
|
1762
1758
|
|
|
1763
1759
|
// dist/rules/no-electron-disable-context-isolation.js
|
|
1764
1760
|
var rule21 = createRule({
|
|
1765
|
-
create(context) {
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
});
|
|
1770
|
-
},
|
|
1761
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1762
|
+
disallowedValue: false,
|
|
1763
|
+
preferenceName: "contextIsolation"
|
|
1764
|
+
}),
|
|
1771
1765
|
meta: {
|
|
1772
1766
|
deprecated: false,
|
|
1773
1767
|
docs: {
|
|
@@ -1789,12 +1783,10 @@ var no_electron_disable_context_isolation_default = rule21;
|
|
|
1789
1783
|
|
|
1790
1784
|
// dist/rules/no-electron-disable-sandbox.js
|
|
1791
1785
|
var rule22 = createRule({
|
|
1792
|
-
create(context) {
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
});
|
|
1797
|
-
},
|
|
1786
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1787
|
+
disallowedValue: false,
|
|
1788
|
+
preferenceName: "sandbox"
|
|
1789
|
+
}),
|
|
1798
1790
|
meta: {
|
|
1799
1791
|
deprecated: false,
|
|
1800
1792
|
docs: {
|
|
@@ -1816,12 +1808,10 @@ var no_electron_disable_sandbox_default = rule22;
|
|
|
1816
1808
|
|
|
1817
1809
|
// dist/rules/no-electron-disable-web-security.js
|
|
1818
1810
|
var rule23 = createRule({
|
|
1819
|
-
create(context) {
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
});
|
|
1824
|
-
},
|
|
1811
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1812
|
+
disallowedValue: false,
|
|
1813
|
+
preferenceName: "webSecurity"
|
|
1814
|
+
}),
|
|
1825
1815
|
meta: {
|
|
1826
1816
|
deprecated: false,
|
|
1827
1817
|
docs: {
|
|
@@ -1843,12 +1833,10 @@ var no_electron_disable_web_security_default = rule23;
|
|
|
1843
1833
|
|
|
1844
1834
|
// dist/rules/no-electron-enable-remote-module.js
|
|
1845
1835
|
var rule24 = createRule({
|
|
1846
|
-
create(context) {
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
});
|
|
1851
|
-
},
|
|
1836
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1837
|
+
disallowedValue: true,
|
|
1838
|
+
preferenceName: "enableRemoteModule"
|
|
1839
|
+
}),
|
|
1852
1840
|
meta: {
|
|
1853
1841
|
deprecated: false,
|
|
1854
1842
|
docs: {
|
|
@@ -1870,12 +1858,10 @@ var no_electron_enable_remote_module_default = rule24;
|
|
|
1870
1858
|
|
|
1871
1859
|
// dist/rules/no-electron-enable-webview-tag.js
|
|
1872
1860
|
var rule25 = createRule({
|
|
1873
|
-
create(context) {
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
});
|
|
1878
|
-
},
|
|
1861
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1862
|
+
disallowedValue: true,
|
|
1863
|
+
preferenceName: "webviewTag"
|
|
1864
|
+
}),
|
|
1879
1865
|
meta: {
|
|
1880
1866
|
deprecated: false,
|
|
1881
1867
|
docs: {
|
|
@@ -1897,12 +1883,10 @@ var no_electron_enable_webview_tag_default = rule25;
|
|
|
1897
1883
|
|
|
1898
1884
|
// dist/rules/no-electron-experimental-features.js
|
|
1899
1885
|
var rule26 = createRule({
|
|
1900
|
-
create(context) {
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
});
|
|
1905
|
-
},
|
|
1886
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1887
|
+
disallowedValue: true,
|
|
1888
|
+
preferenceName: "experimentalFeatures"
|
|
1889
|
+
}),
|
|
1906
1890
|
meta: {
|
|
1907
1891
|
deprecated: false,
|
|
1908
1892
|
docs: {
|
|
@@ -2017,13 +2001,13 @@ var no_electron_expose_raw_ipc_renderer_default = rule27;
|
|
|
2017
2001
|
|
|
2018
2002
|
// dist/rules/no-electron-insecure-certificate-error-handler.js
|
|
2019
2003
|
var import_utils21 = require("@typescript-eslint/utils");
|
|
2020
|
-
var
|
|
2004
|
+
var import_ts_extras13 = require("ts-extras");
|
|
2021
2005
|
var getStaticStringValue3 = (node) => {
|
|
2022
2006
|
if (node.type === import_utils21.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
2023
2007
|
return node.value;
|
|
2024
2008
|
}
|
|
2025
2009
|
if (node.type === import_utils21.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
2026
|
-
return (0,
|
|
2010
|
+
return (0, import_ts_extras13.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
2027
2011
|
}
|
|
2028
2012
|
return void 0;
|
|
2029
2013
|
};
|
|
@@ -2034,7 +2018,7 @@ var isOnMemberExpression = (callee) => {
|
|
|
2034
2018
|
return callee.property.type === import_utils21.AST_NODE_TYPES.Identifier && callee.property.name === "on";
|
|
2035
2019
|
};
|
|
2036
2020
|
var getCallbackParameterName = (node) => {
|
|
2037
|
-
const callbackParameter = (0,
|
|
2021
|
+
const callbackParameter = (0, import_ts_extras13.arrayAt)(node.params, -1);
|
|
2038
2022
|
return callbackParameter?.type === import_utils21.AST_NODE_TYPES.Identifier ? callbackParameter.name : void 0;
|
|
2039
2023
|
};
|
|
2040
2024
|
var toUnsafeCallbackTruePattern = (callbackName) => (
|
|
@@ -2103,7 +2087,7 @@ var no_electron_insecure_certificate_error_handler_default = rule28;
|
|
|
2103
2087
|
|
|
2104
2088
|
// dist/rules/no-electron-insecure-certificate-verify-proc.js
|
|
2105
2089
|
var import_utils22 = require("@typescript-eslint/utils");
|
|
2106
|
-
var
|
|
2090
|
+
var import_ts_extras14 = require("ts-extras");
|
|
2107
2091
|
var getMemberPropertyName6 = (memberExpression) => {
|
|
2108
2092
|
if (!memberExpression.computed && memberExpression.property.type === import_utils22.AST_NODE_TYPES.Identifier) {
|
|
2109
2093
|
return memberExpression.property.name;
|
|
@@ -2139,7 +2123,7 @@ var rule29 = createRule({
|
|
|
2139
2123
|
if (firstArgument === void 0 || firstArgument.type === import_utils22.AST_NODE_TYPES.SpreadElement || !isFunctionExpression(firstArgument)) {
|
|
2140
2124
|
return;
|
|
2141
2125
|
}
|
|
2142
|
-
const callbackParameter = (0,
|
|
2126
|
+
const callbackParameter = (0, import_ts_extras14.arrayAt)(firstArgument.params, -1);
|
|
2143
2127
|
if (callbackParameter?.type !== import_utils22.AST_NODE_TYPES.Identifier) {
|
|
2144
2128
|
return;
|
|
2145
2129
|
}
|
|
@@ -2173,7 +2157,7 @@ var no_electron_insecure_certificate_verify_proc_default = rule29;
|
|
|
2173
2157
|
|
|
2174
2158
|
// dist/rules/no-electron-insecure-permission-request-handler.js
|
|
2175
2159
|
var import_utils23 = require("@typescript-eslint/utils");
|
|
2176
|
-
var
|
|
2160
|
+
var import_ts_extras15 = require("ts-extras");
|
|
2177
2161
|
var getMemberPropertyName7 = (memberExpression) => {
|
|
2178
2162
|
if (!memberExpression.computed && memberExpression.property.type === import_utils23.AST_NODE_TYPES.Identifier) {
|
|
2179
2163
|
return memberExpression.property.name;
|
|
@@ -2209,7 +2193,7 @@ var rule30 = createRule({
|
|
|
2209
2193
|
if (firstArgument === void 0 || firstArgument.type === import_utils23.AST_NODE_TYPES.SpreadElement || !isFunctionExpression2(firstArgument)) {
|
|
2210
2194
|
return;
|
|
2211
2195
|
}
|
|
2212
|
-
const callbackParameter = (0,
|
|
2196
|
+
const callbackParameter = (0, import_ts_extras15.arrayAt)(firstArgument.params, -1);
|
|
2213
2197
|
if (callbackParameter?.type !== import_utils23.AST_NODE_TYPES.Identifier) {
|
|
2214
2198
|
return;
|
|
2215
2199
|
}
|
|
@@ -2243,35 +2227,33 @@ var no_electron_insecure_permission_request_handler_default = rule30;
|
|
|
2243
2227
|
|
|
2244
2228
|
// dist/rules/no-electron-node-integration.js
|
|
2245
2229
|
var rule31 = createRule({
|
|
2246
|
-
create(context) {
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
};
|
|
2274
|
-
},
|
|
2230
|
+
create: (context) => ({
|
|
2231
|
+
"NewExpression[callee.name=/^(?:BrowserWindow|BrowserView)$/] > ObjectExpression.arguments > Property.properties[key.name='webPreferences'] > ObjectExpression.value > Property.properties[key.name=/^(?:nodeIntegration|nodeIntegrationInWorker|nodeIntegrationInSubFrames)$/][value.value=true]"(node) {
|
|
2232
|
+
context.report({
|
|
2233
|
+
fix(fixer) {
|
|
2234
|
+
const propertyText = context.sourceCode.getText(node);
|
|
2235
|
+
const separatorIndex = propertyText.indexOf(":");
|
|
2236
|
+
if (separatorIndex === -1) {
|
|
2237
|
+
return null;
|
|
2238
|
+
}
|
|
2239
|
+
const valuePortion = propertyText.slice(separatorIndex + 1);
|
|
2240
|
+
const trimmedValuePortion = valuePortion.trimStart();
|
|
2241
|
+
if (!trimmedValuePortion.startsWith("true")) {
|
|
2242
|
+
return null;
|
|
2243
|
+
}
|
|
2244
|
+
const leadingWhitespaceLength = valuePortion.length - trimmedValuePortion.length;
|
|
2245
|
+
const nextValuePortion = `${valuePortion.slice(0, leadingWhitespaceLength)}false${trimmedValuePortion.slice("true".length)}`;
|
|
2246
|
+
const nextPropertyText = `${propertyText.slice(0, separatorIndex + 1)}${nextValuePortion}`;
|
|
2247
|
+
if (nextPropertyText === propertyText) {
|
|
2248
|
+
return null;
|
|
2249
|
+
}
|
|
2250
|
+
return fixer.replaceText(node, nextPropertyText);
|
|
2251
|
+
},
|
|
2252
|
+
messageId: "default",
|
|
2253
|
+
node
|
|
2254
|
+
});
|
|
2255
|
+
}
|
|
2256
|
+
}),
|
|
2275
2257
|
meta: {
|
|
2276
2258
|
deprecated: false,
|
|
2277
2259
|
docs: {
|
|
@@ -2293,7 +2275,7 @@ var no_electron_node_integration_default = rule31;
|
|
|
2293
2275
|
|
|
2294
2276
|
// dist/rules/no-electron-permission-check-handler-allow-all.js
|
|
2295
2277
|
var import_utils24 = require("@typescript-eslint/utils");
|
|
2296
|
-
var
|
|
2278
|
+
var import_ts_extras16 = require("ts-extras");
|
|
2297
2279
|
var isFunctionExpression3 = (expression) => expression.type === import_utils24.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils24.AST_NODE_TYPES.FunctionExpression;
|
|
2298
2280
|
var isBooleanTrueLiteral = (expression) => expression?.type === import_utils24.AST_NODE_TYPES.Literal && expression.value === true;
|
|
2299
2281
|
var isAllowAllPermissionCheckHandler = (callbackNode) => {
|
|
@@ -2303,7 +2285,7 @@ var isAllowAllPermissionCheckHandler = (callbackNode) => {
|
|
|
2303
2285
|
if (callbackNode.body.body.length !== 1) {
|
|
2304
2286
|
return false;
|
|
2305
2287
|
}
|
|
2306
|
-
const onlyStatement = (0,
|
|
2288
|
+
const onlyStatement = (0, import_ts_extras16.arrayFirst)(callbackNode.body.body);
|
|
2307
2289
|
return onlyStatement?.type === import_utils24.AST_NODE_TYPES.ReturnStatement && isBooleanTrueLiteral(onlyStatement.argument);
|
|
2308
2290
|
};
|
|
2309
2291
|
var rule32 = createRule({
|
|
@@ -2347,7 +2329,7 @@ var no_electron_permission_check_handler_allow_all_default = rule32;
|
|
|
2347
2329
|
|
|
2348
2330
|
// dist/rules/no-electron-unchecked-ipc-sender.js
|
|
2349
2331
|
var import_utils25 = require("@typescript-eslint/utils");
|
|
2350
|
-
var
|
|
2332
|
+
var import_ts_extras17 = require("ts-extras");
|
|
2351
2333
|
var getMemberPropertyName8 = (memberExpression) => {
|
|
2352
2334
|
if (!memberExpression.computed && memberExpression.property.type === import_utils25.AST_NODE_TYPES.Identifier) {
|
|
2353
2335
|
return memberExpression.property.name;
|
|
@@ -2399,7 +2381,7 @@ var rule33 = createRule({
|
|
|
2399
2381
|
if (handlerNode === void 0 || handlerNode.type === import_utils25.AST_NODE_TYPES.SpreadElement || !isFunctionExpression4(handlerNode)) {
|
|
2400
2382
|
return;
|
|
2401
2383
|
}
|
|
2402
|
-
const eventParameter = (0,
|
|
2384
|
+
const eventParameter = (0, import_ts_extras17.arrayFirst)(handlerNode.params);
|
|
2403
2385
|
if (eventParameter?.type !== import_utils25.AST_NODE_TYPES.Identifier) {
|
|
2404
2386
|
return;
|
|
2405
2387
|
}
|
|
@@ -2433,7 +2415,7 @@ var no_electron_unchecked_ipc_sender_default = rule33;
|
|
|
2433
2415
|
|
|
2434
2416
|
// dist/rules/no-electron-unrestricted-navigation.js
|
|
2435
2417
|
var import_utils26 = require("@typescript-eslint/utils");
|
|
2436
|
-
var
|
|
2418
|
+
var import_ts_extras18 = require("ts-extras");
|
|
2437
2419
|
var getMemberPropertyName9 = (memberExpression) => {
|
|
2438
2420
|
if (!memberExpression.computed && memberExpression.property.type === import_utils26.AST_NODE_TYPES.Identifier) {
|
|
2439
2421
|
return memberExpression.property.name;
|
|
@@ -2490,7 +2472,7 @@ var rule34 = createRule({
|
|
|
2490
2472
|
if (firstArgument.type !== import_utils26.AST_NODE_TYPES.Literal || firstArgument.value !== "will-navigate") {
|
|
2491
2473
|
return;
|
|
2492
2474
|
}
|
|
2493
|
-
const eventParameter = (0,
|
|
2475
|
+
const eventParameter = (0, import_ts_extras18.arrayFirst)(secondArgument.params);
|
|
2494
2476
|
if (eventParameter?.type !== import_utils26.AST_NODE_TYPES.Identifier) {
|
|
2495
2477
|
return;
|
|
2496
2478
|
}
|
|
@@ -2524,12 +2506,12 @@ var no_electron_unrestricted_navigation_default = rule34;
|
|
|
2524
2506
|
|
|
2525
2507
|
// dist/rules/no-electron-untrusted-open-external.js
|
|
2526
2508
|
var import_utils27 = require("@typescript-eslint/utils");
|
|
2527
|
-
var
|
|
2509
|
+
var import_ts_extras19 = require("ts-extras");
|
|
2528
2510
|
var getStaticTemplateLiteralValue = (templateLiteral) => {
|
|
2529
2511
|
if (templateLiteral.expressions.length > 0) {
|
|
2530
2512
|
return void 0;
|
|
2531
2513
|
}
|
|
2532
|
-
return (0,
|
|
2514
|
+
return (0, import_ts_extras19.arrayFirst)(templateLiteral.quasis)?.value.cooked ?? void 0;
|
|
2533
2515
|
};
|
|
2534
2516
|
var getStringValue = (node) => {
|
|
2535
2517
|
if (node.type === import_utils27.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
@@ -2644,33 +2626,29 @@ var isTruthyJsxAttributeValue = (attributeValue) => {
|
|
|
2644
2626
|
return true;
|
|
2645
2627
|
};
|
|
2646
2628
|
var rule36 = createRule({
|
|
2647
|
-
create(context) {
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2629
|
+
create: (context) => ({
|
|
2630
|
+
JSXOpeningElement(node) {
|
|
2631
|
+
if (!isJsxWebviewElement(node)) {
|
|
2632
|
+
return;
|
|
2633
|
+
}
|
|
2634
|
+
for (const attributeNode of node.attributes) {
|
|
2635
|
+
if (attributeNode.type !== import_utils28.AST_NODE_TYPES.JSXAttribute) {
|
|
2636
|
+
continue;
|
|
2652
2637
|
}
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
continue;
|
|
2659
|
-
}
|
|
2660
|
-
if (!isTruthyJsxAttributeValue(attributeNode.value)) {
|
|
2661
|
-
continue;
|
|
2662
|
-
}
|
|
2663
|
-
context.report({
|
|
2664
|
-
fix(fixer) {
|
|
2665
|
-
return fixer.remove(attributeNode);
|
|
2666
|
-
},
|
|
2667
|
-
messageId: "default",
|
|
2668
|
-
node: attributeNode
|
|
2669
|
-
});
|
|
2638
|
+
if (getJsxAttributeName(attributeNode) !== "allowpopups") {
|
|
2639
|
+
continue;
|
|
2640
|
+
}
|
|
2641
|
+
if (!isTruthyJsxAttributeValue(attributeNode.value)) {
|
|
2642
|
+
continue;
|
|
2670
2643
|
}
|
|
2644
|
+
context.report({
|
|
2645
|
+
fix: (fixer) => fixer.remove(attributeNode),
|
|
2646
|
+
messageId: "default",
|
|
2647
|
+
node: attributeNode
|
|
2648
|
+
});
|
|
2671
2649
|
}
|
|
2672
|
-
}
|
|
2673
|
-
},
|
|
2650
|
+
}
|
|
2651
|
+
}),
|
|
2674
2652
|
meta: {
|
|
2675
2653
|
deprecated: false,
|
|
2676
2654
|
docs: {
|
|
@@ -2692,7 +2670,7 @@ var no_electron_webview_allowpopups_default = rule36;
|
|
|
2692
2670
|
|
|
2693
2671
|
// dist/rules/no-electron-webview-insecure-webpreferences.js
|
|
2694
2672
|
var import_utils29 = require("@typescript-eslint/utils");
|
|
2695
|
-
var
|
|
2673
|
+
var import_ts_extras20 = require("ts-extras");
|
|
2696
2674
|
var UNSAFE_WEBPREFERENCES_PATTERNS = [
|
|
2697
2675
|
{
|
|
2698
2676
|
flagName: "allowRunningInsecureContent",
|
|
@@ -2724,38 +2702,36 @@ var getJsxAttributeName2 = (attributeNode) => {
|
|
|
2724
2702
|
};
|
|
2725
2703
|
var getUnsafeWebPreferencesFlags = (attributeValue) => UNSAFE_WEBPREFERENCES_PATTERNS.flatMap(({ flagName, pattern }) => pattern.test(attributeValue) ? [flagName] : []);
|
|
2726
2704
|
var rule37 = createRule({
|
|
2727
|
-
create(context) {
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2705
|
+
create: (context) => ({
|
|
2706
|
+
JSXOpeningElement(node) {
|
|
2707
|
+
if (!isJsxWebviewElement2(node)) {
|
|
2708
|
+
return;
|
|
2709
|
+
}
|
|
2710
|
+
for (const attributeNode of node.attributes) {
|
|
2711
|
+
if (attributeNode.type !== import_utils29.AST_NODE_TYPES.JSXAttribute) {
|
|
2712
|
+
continue;
|
|
2732
2713
|
}
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
}
|
|
2744
|
-
const unsafeFlags = getUnsafeWebPreferencesFlags(staticValue);
|
|
2745
|
-
if ((0, import_ts_extras19.isEmpty)(unsafeFlags)) {
|
|
2746
|
-
continue;
|
|
2747
|
-
}
|
|
2748
|
-
context.report({
|
|
2749
|
-
data: {
|
|
2750
|
-
flags: (0, import_ts_extras19.arrayJoin)(unsafeFlags, ", ")
|
|
2751
|
-
},
|
|
2752
|
-
messageId: "default",
|
|
2753
|
-
node: attributeNode
|
|
2754
|
-
});
|
|
2714
|
+
if (getJsxAttributeName2(attributeNode) !== "webpreferences") {
|
|
2715
|
+
continue;
|
|
2716
|
+
}
|
|
2717
|
+
const staticValue = getStaticJsxAttributeStringValue(attributeNode.value);
|
|
2718
|
+
if (typeof staticValue !== "string") {
|
|
2719
|
+
continue;
|
|
2720
|
+
}
|
|
2721
|
+
const unsafeFlags = getUnsafeWebPreferencesFlags(staticValue);
|
|
2722
|
+
if ((0, import_ts_extras20.isEmpty)(unsafeFlags)) {
|
|
2723
|
+
continue;
|
|
2755
2724
|
}
|
|
2725
|
+
context.report({
|
|
2726
|
+
data: {
|
|
2727
|
+
flags: (0, import_ts_extras20.arrayJoin)(unsafeFlags, ", ")
|
|
2728
|
+
},
|
|
2729
|
+
messageId: "default",
|
|
2730
|
+
node: attributeNode
|
|
2731
|
+
});
|
|
2756
2732
|
}
|
|
2757
|
-
}
|
|
2758
|
-
},
|
|
2733
|
+
}
|
|
2734
|
+
}),
|
|
2759
2735
|
meta: {
|
|
2760
2736
|
deprecated: false,
|
|
2761
2737
|
docs: {
|
|
@@ -2808,7 +2784,7 @@ var isTruthyJsxAttributeValue2 = (attributeValue) => {
|
|
|
2808
2784
|
}
|
|
2809
2785
|
return true;
|
|
2810
2786
|
};
|
|
2811
|
-
var
|
|
2787
|
+
var hasNodeIntegrationWebPreference = (attributeValue) => {
|
|
2812
2788
|
if (attributeValue === null) {
|
|
2813
2789
|
return false;
|
|
2814
2790
|
}
|
|
@@ -2818,44 +2794,40 @@ var webPreferencesHasNodeIntegration = (attributeValue) => {
|
|
|
2818
2794
|
return false;
|
|
2819
2795
|
};
|
|
2820
2796
|
var rule38 = createRule({
|
|
2821
|
-
create(context) {
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
if (
|
|
2833
|
-
if (!isTruthyJsxAttributeValue2(attributeNode.value)) {
|
|
2834
|
-
continue;
|
|
2835
|
-
}
|
|
2836
|
-
context.report({
|
|
2837
|
-
fix(fixer) {
|
|
2838
|
-
return fixer.remove(attributeNode);
|
|
2839
|
-
},
|
|
2840
|
-
messageId: "default",
|
|
2841
|
-
node: attributeNode
|
|
2842
|
-
});
|
|
2843
|
-
continue;
|
|
2844
|
-
}
|
|
2845
|
-
if (attributeName !== "webpreferences") {
|
|
2846
|
-
continue;
|
|
2847
|
-
}
|
|
2848
|
-
if (!webPreferencesHasNodeIntegration(attributeNode.value)) {
|
|
2797
|
+
create: (context) => ({
|
|
2798
|
+
JSXOpeningElement(node) {
|
|
2799
|
+
if (!isJsxWebviewElement3(node)) {
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
for (const attributeNode of node.attributes) {
|
|
2803
|
+
if (attributeNode.type !== import_utils30.AST_NODE_TYPES.JSXAttribute) {
|
|
2804
|
+
continue;
|
|
2805
|
+
}
|
|
2806
|
+
const attributeName = getJsxAttributeName3(attributeNode);
|
|
2807
|
+
if (isNodeIntegrationAttribute(attributeName)) {
|
|
2808
|
+
if (!isTruthyJsxAttributeValue2(attributeNode.value)) {
|
|
2849
2809
|
continue;
|
|
2850
2810
|
}
|
|
2851
2811
|
context.report({
|
|
2812
|
+
fix: (fixer) => fixer.remove(attributeNode),
|
|
2852
2813
|
messageId: "default",
|
|
2853
2814
|
node: attributeNode
|
|
2854
2815
|
});
|
|
2816
|
+
continue;
|
|
2817
|
+
}
|
|
2818
|
+
if (attributeName !== "webpreferences") {
|
|
2819
|
+
continue;
|
|
2855
2820
|
}
|
|
2821
|
+
if (!hasNodeIntegrationWebPreference(attributeNode.value)) {
|
|
2822
|
+
continue;
|
|
2823
|
+
}
|
|
2824
|
+
context.report({
|
|
2825
|
+
messageId: "default",
|
|
2826
|
+
node: attributeNode
|
|
2827
|
+
});
|
|
2856
2828
|
}
|
|
2857
|
-
}
|
|
2858
|
-
},
|
|
2829
|
+
}
|
|
2830
|
+
}),
|
|
2859
2831
|
meta: {
|
|
2860
2832
|
deprecated: false,
|
|
2861
2833
|
docs: {
|
|
@@ -2916,7 +2888,7 @@ var no_html_method_default = rule39;
|
|
|
2916
2888
|
|
|
2917
2889
|
// dist/rules/no-http-request-to-insecure-protocol.js
|
|
2918
2890
|
var import_utils32 = require("@typescript-eslint/utils");
|
|
2919
|
-
var
|
|
2891
|
+
var import_ts_extras21 = require("ts-extras");
|
|
2920
2892
|
var getMemberPropertyName11 = (memberExpression) => {
|
|
2921
2893
|
if (!memberExpression.computed && memberExpression.property.type === import_utils32.AST_NODE_TYPES.Identifier) {
|
|
2922
2894
|
return memberExpression.property.name;
|
|
@@ -2931,7 +2903,7 @@ var getStaticStringValue4 = (node) => {
|
|
|
2931
2903
|
return node.value;
|
|
2932
2904
|
}
|
|
2933
2905
|
if (node.type === import_utils32.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
2934
|
-
return (0,
|
|
2906
|
+
return (0, import_ts_extras21.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
2935
2907
|
}
|
|
2936
2908
|
return void 0;
|
|
2937
2909
|
};
|
|
@@ -3139,7 +3111,7 @@ var isEmptyStringLiteral = (node) => node.type === import_utils34.AST_NODE_TYPES
|
|
|
3139
3111
|
var rule42 = createRule({
|
|
3140
3112
|
create(context) {
|
|
3141
3113
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
3142
|
-
const
|
|
3114
|
+
const isPossibleHtmlElement = (node) => {
|
|
3143
3115
|
const nodeType = getNodeTypeAsString(fullTypeChecker, node, context);
|
|
3144
3116
|
return /HTML.*Element/v.test(nodeType) || nodeType === "any";
|
|
3145
3117
|
};
|
|
@@ -3151,7 +3123,7 @@ var rule42 = createRule({
|
|
|
3151
3123
|
if (node.left.type !== import_utils34.AST_NODE_TYPES.MemberExpression) {
|
|
3152
3124
|
return;
|
|
3153
3125
|
}
|
|
3154
|
-
if (!
|
|
3126
|
+
if (!isPossibleHtmlElement(node.left.object)) {
|
|
3155
3127
|
return;
|
|
3156
3128
|
}
|
|
3157
3129
|
context.report({
|
|
@@ -3167,7 +3139,7 @@ var rule42 = createRule({
|
|
|
3167
3139
|
if (secondArgument !== void 0 && isEmptyStringLiteral(secondArgument)) {
|
|
3168
3140
|
return;
|
|
3169
3141
|
}
|
|
3170
|
-
if (!
|
|
3142
|
+
if (!isPossibleHtmlElement(node.object)) {
|
|
3171
3143
|
return;
|
|
3172
3144
|
}
|
|
3173
3145
|
context.report({
|
|
@@ -3198,8 +3170,8 @@ var no_inner_html_default = rule42;
|
|
|
3198
3170
|
|
|
3199
3171
|
// dist/rules/no-insecure-random.js
|
|
3200
3172
|
var import_utils35 = require("@typescript-eslint/utils");
|
|
3201
|
-
var
|
|
3202
|
-
var
|
|
3173
|
+
var path = __toESM(require("node:path"), 1);
|
|
3174
|
+
var import_ts_extras22 = require("ts-extras");
|
|
3203
3175
|
var bannedRandomLibraries = [
|
|
3204
3176
|
"chance",
|
|
3205
3177
|
"random-float",
|
|
@@ -3209,13 +3181,13 @@ var bannedRandomLibraries = [
|
|
|
3209
3181
|
"unique-random"
|
|
3210
3182
|
];
|
|
3211
3183
|
var bannedRandomLibrarySet = new Set(bannedRandomLibraries);
|
|
3212
|
-
var isBannedRandomLibrary = (value) => (0,
|
|
3184
|
+
var isBannedRandomLibrary = (value) => (0, import_ts_extras22.setHas)(bannedRandomLibrarySet, value);
|
|
3213
3185
|
var rule43 = createRule({
|
|
3214
3186
|
create(context) {
|
|
3215
3187
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
3216
3188
|
return {
|
|
3217
3189
|
"CallExpression > MemberExpression[property.name='pseudoRandomBytes']"(node) {
|
|
3218
|
-
const isUnsafe = (0,
|
|
3190
|
+
const isUnsafe = (0, import_ts_extras22.isDefined)(fullTypeChecker) ? (0, import_ts_extras22.arrayIncludes)(["any", "Crypto"], getNodeTypeAsString(fullTypeChecker, node.object, context)) : node.object.type === import_utils35.AST_NODE_TYPES.Identifier && node.object.name === "crypto";
|
|
3219
3191
|
if (!isUnsafe) {
|
|
3220
3192
|
return;
|
|
3221
3193
|
}
|
|
@@ -3225,7 +3197,7 @@ var rule43 = createRule({
|
|
|
3225
3197
|
});
|
|
3226
3198
|
},
|
|
3227
3199
|
"CallExpression > MemberExpression[property.name='random']"(node) {
|
|
3228
|
-
const isUnsafe = (0,
|
|
3200
|
+
const isUnsafe = (0, import_ts_extras22.isDefined)(fullTypeChecker) ? (0, import_ts_extras22.arrayIncludes)(["any", "Math"], getNodeTypeAsString(fullTypeChecker, node.object, context)) : node.object.type === import_utils35.AST_NODE_TYPES.Identifier && node.object.name === "Math";
|
|
3229
3201
|
if (!isUnsafe) {
|
|
3230
3202
|
return;
|
|
3231
3203
|
}
|
|
@@ -3236,10 +3208,10 @@ var rule43 = createRule({
|
|
|
3236
3208
|
},
|
|
3237
3209
|
"CallExpression[callee.name='require'][arguments.length=1]"(node) {
|
|
3238
3210
|
const [sourceArgument] = node.arguments;
|
|
3239
|
-
if (!(0,
|
|
3211
|
+
if (!(0, import_ts_extras22.isDefined)(sourceArgument) || sourceArgument.type !== import_utils35.AST_NODE_TYPES.Literal || typeof sourceArgument.value !== "string") {
|
|
3240
3212
|
return;
|
|
3241
3213
|
}
|
|
3242
|
-
const requireName =
|
|
3214
|
+
const requireName = path.parse(path.basename(sourceArgument.value)).name;
|
|
3243
3215
|
if (!isBannedRandomLibrary(requireName)) {
|
|
3244
3216
|
return;
|
|
3245
3217
|
}
|
|
@@ -3253,7 +3225,7 @@ var rule43 = createRule({
|
|
|
3253
3225
|
if (typeof sourceText !== "string") {
|
|
3254
3226
|
return;
|
|
3255
3227
|
}
|
|
3256
|
-
if (!isBannedRandomLibrary(
|
|
3228
|
+
if (!isBannedRandomLibrary(path.basename(sourceText))) {
|
|
3257
3229
|
return;
|
|
3258
3230
|
}
|
|
3259
3231
|
context.report({
|
|
@@ -3308,26 +3280,24 @@ var findRejectUnauthorizedFalseProperty = (objectExpression) => {
|
|
|
3308
3280
|
return void 0;
|
|
3309
3281
|
};
|
|
3310
3282
|
var rule44 = createRule({
|
|
3311
|
-
create(context) {
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
return;
|
|
3317
|
-
}
|
|
3318
|
-
context.report({
|
|
3319
|
-
fix(fixer) {
|
|
3320
|
-
if (insecureOptionProperty.value.type !== import_utils36.AST_NODE_TYPES.Literal || insecureOptionProperty.value.value !== false) {
|
|
3321
|
-
return null;
|
|
3322
|
-
}
|
|
3323
|
-
return fixer.replaceText(insecureOptionProperty.value, "true");
|
|
3324
|
-
},
|
|
3325
|
-
messageId: "default",
|
|
3326
|
-
node: insecureOptionProperty
|
|
3327
|
-
});
|
|
3283
|
+
create: (context) => ({
|
|
3284
|
+
ObjectExpression(node) {
|
|
3285
|
+
const insecureOptionProperty = findRejectUnauthorizedFalseProperty(node);
|
|
3286
|
+
if (insecureOptionProperty === void 0) {
|
|
3287
|
+
return;
|
|
3328
3288
|
}
|
|
3329
|
-
|
|
3330
|
-
|
|
3289
|
+
context.report({
|
|
3290
|
+
fix(fixer) {
|
|
3291
|
+
if (insecureOptionProperty.value.type !== import_utils36.AST_NODE_TYPES.Literal || insecureOptionProperty.value.value !== false) {
|
|
3292
|
+
return null;
|
|
3293
|
+
}
|
|
3294
|
+
return fixer.replaceText(insecureOptionProperty.value, "true");
|
|
3295
|
+
},
|
|
3296
|
+
messageId: "default",
|
|
3297
|
+
node: insecureOptionProperty
|
|
3298
|
+
});
|
|
3299
|
+
}
|
|
3300
|
+
}),
|
|
3331
3301
|
meta: {
|
|
3332
3302
|
deprecated: false,
|
|
3333
3303
|
docs: {
|
|
@@ -3364,12 +3334,12 @@ var asCaseInsensitiveRegex = (pattern) => {
|
|
|
3364
3334
|
}
|
|
3365
3335
|
return new RegExp(pattern, "iu");
|
|
3366
3336
|
};
|
|
3367
|
-
var
|
|
3337
|
+
var hasPatternMatch = (patterns, value) => patterns.some((pattern) => pattern.test(value));
|
|
3368
3338
|
var toRegexSources = (patterns) => patterns.map((pattern) => pattern.source);
|
|
3369
3339
|
var shouldAttemptFix = (variableExceptions, context, node) => {
|
|
3370
3340
|
const targetNode = node.parent ?? node;
|
|
3371
3341
|
const targetText = context.sourceCode.getText(targetNode);
|
|
3372
|
-
return !
|
|
3342
|
+
return !hasPatternMatch(variableExceptions, targetText);
|
|
3373
3343
|
};
|
|
3374
3344
|
var reportInsecureUrl = (context, node, replacementSourceText) => {
|
|
3375
3345
|
context.report({
|
|
@@ -3397,7 +3367,7 @@ var rule45 = createRule({
|
|
|
3397
3367
|
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") {
|
|
3398
3368
|
return;
|
|
3399
3369
|
}
|
|
3400
|
-
if (!
|
|
3370
|
+
if (!hasPatternMatch(blocklist, node.value) || hasPatternMatch(exceptions, node.value)) {
|
|
3401
3371
|
return;
|
|
3402
3372
|
}
|
|
3403
3373
|
if (!shouldAttemptFix(variableExceptions, context, node)) {
|
|
@@ -3409,8 +3379,8 @@ var rule45 = createRule({
|
|
|
3409
3379
|
if (typeof node.value.raw !== "string" || typeof node.value.cooked !== "string") {
|
|
3410
3380
|
return;
|
|
3411
3381
|
}
|
|
3412
|
-
const isRawMatch = shouldAttemptFix(variableExceptions, context, node) &&
|
|
3413
|
-
const isCookedMatch =
|
|
3382
|
+
const isRawMatch = shouldAttemptFix(variableExceptions, context, node) && hasPatternMatch(blocklist, node.value.raw) && !hasPatternMatch(exceptions, node.value.raw);
|
|
3383
|
+
const isCookedMatch = hasPatternMatch(blocklist, node.value.cooked) && !hasPatternMatch(exceptions, node.value.cooked);
|
|
3414
3384
|
if (!isRawMatch && !isCookedMatch) {
|
|
3415
3385
|
return;
|
|
3416
3386
|
}
|
|
@@ -3469,7 +3439,7 @@ var no_insecure_url_default = rule45;
|
|
|
3469
3439
|
|
|
3470
3440
|
// dist/rules/no-location-javascript-url.js
|
|
3471
3441
|
var import_utils38 = require("@typescript-eslint/utils");
|
|
3472
|
-
var
|
|
3442
|
+
var import_ts_extras23 = require("ts-extras");
|
|
3473
3443
|
var getMemberPropertyName12 = (memberExpression) => {
|
|
3474
3444
|
if (!memberExpression.computed && memberExpression.property.type === import_utils38.AST_NODE_TYPES.Identifier) {
|
|
3475
3445
|
return memberExpression.property.name;
|
|
@@ -3484,7 +3454,7 @@ var getStaticStringValue5 = (node) => {
|
|
|
3484
3454
|
return node.value;
|
|
3485
3455
|
}
|
|
3486
3456
|
if (node.type === import_utils38.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
3487
|
-
return (0,
|
|
3457
|
+
return (0, import_ts_extras23.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
3488
3458
|
}
|
|
3489
3459
|
return void 0;
|
|
3490
3460
|
};
|
|
@@ -3558,31 +3528,31 @@ var no_location_javascript_url_default = rule46;
|
|
|
3558
3528
|
|
|
3559
3529
|
// dist/rules/no-message-event-without-origin-check.js
|
|
3560
3530
|
var import_utils39 = require("@typescript-eslint/utils");
|
|
3561
|
-
var
|
|
3531
|
+
var import_ts_extras24 = require("ts-extras");
|
|
3562
3532
|
var isFunctionExpression6 = (expression) => expression.type === import_utils39.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils39.AST_NODE_TYPES.FunctionExpression;
|
|
3563
3533
|
var hasMessageEventGuardKeywords = (callbackText) => /\b(?:allowlist|origin|trusted|validate|verify|whitelist)\b/iv.test(callbackText);
|
|
3564
3534
|
var isUnknownRecord2 = (value) => typeof value === "object" && value !== null;
|
|
3565
|
-
var isNodeLike = (value) => isUnknownRecord2(value) && (0,
|
|
3535
|
+
var isNodeLike = (value) => isUnknownRecord2(value) && (0, import_ts_extras24.keyIn)(value, "type") && typeof value["type"] === "string";
|
|
3566
3536
|
var toNode = (value) => isNodeLike(value) ? value : void 0;
|
|
3567
|
-
var
|
|
3568
|
-
if (
|
|
3537
|
+
var hasDescendantNode = (node, hasMatchingNode) => {
|
|
3538
|
+
if (hasMatchingNode(node)) {
|
|
3569
3539
|
return true;
|
|
3570
3540
|
}
|
|
3571
|
-
for (const [propertyName, propertyValue] of (0,
|
|
3541
|
+
for (const [propertyName, propertyValue] of (0, import_ts_extras24.objectEntries)(node)) {
|
|
3572
3542
|
if (propertyName === "parent") {
|
|
3573
3543
|
continue;
|
|
3574
3544
|
}
|
|
3575
3545
|
if (Array.isArray(propertyValue)) {
|
|
3576
3546
|
for (const element of propertyValue) {
|
|
3577
3547
|
const childNode2 = toNode(element);
|
|
3578
|
-
if (childNode2 !== void 0 &&
|
|
3548
|
+
if (childNode2 !== void 0 && hasDescendantNode(childNode2, hasMatchingNode)) {
|
|
3579
3549
|
return true;
|
|
3580
3550
|
}
|
|
3581
3551
|
}
|
|
3582
3552
|
continue;
|
|
3583
3553
|
}
|
|
3584
3554
|
const childNode = toNode(propertyValue);
|
|
3585
|
-
if (childNode !== void 0 &&
|
|
3555
|
+
if (childNode !== void 0 && hasDescendantNode(childNode, hasMatchingNode)) {
|
|
3586
3556
|
return true;
|
|
3587
3557
|
}
|
|
3588
3558
|
}
|
|
@@ -3590,35 +3560,35 @@ var someDescendantNode = (node, predicate) => {
|
|
|
3590
3560
|
};
|
|
3591
3561
|
var isIdentifierNamed = (node, identifierName) => node.type === import_utils39.AST_NODE_TYPES.Identifier && node.name === identifierName;
|
|
3592
3562
|
var isStaticPropertyMatch = (memberExpression, objectName, propertyName) => isIdentifierNamed(memberExpression.object, objectName) && getMemberPropertyName3(memberExpression) === propertyName;
|
|
3593
|
-
var
|
|
3563
|
+
var hasPatternProperty = (pattern, propertyName) => pattern.properties.some((propertyNode) => {
|
|
3594
3564
|
if (propertyNode.type !== import_utils39.AST_NODE_TYPES.Property) {
|
|
3595
3565
|
return false;
|
|
3596
3566
|
}
|
|
3597
3567
|
return getPropertyName(propertyNode) === propertyName;
|
|
3598
3568
|
});
|
|
3599
|
-
var
|
|
3569
|
+
var hasObjectDestructureFromIdentifier = (rootNode, sourceName, propertyName) => hasDescendantNode(rootNode, (node) => {
|
|
3600
3570
|
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) &&
|
|
3571
|
+
return node.id.type === import_utils39.AST_NODE_TYPES.ObjectPattern && node.init !== null && isIdentifierNamed(node.init, sourceName) && hasPatternProperty(node.id, propertyName);
|
|
3602
3572
|
}
|
|
3603
3573
|
if (node.type !== import_utils39.AST_NODE_TYPES.AssignmentExpression) {
|
|
3604
3574
|
return false;
|
|
3605
3575
|
}
|
|
3606
|
-
return node.left.type === import_utils39.AST_NODE_TYPES.ObjectPattern && isIdentifierNamed(node.right, sourceName) &&
|
|
3576
|
+
return node.left.type === import_utils39.AST_NODE_TYPES.ObjectPattern && isIdentifierNamed(node.right, sourceName) && hasPatternProperty(node.left, propertyName);
|
|
3607
3577
|
});
|
|
3608
|
-
var
|
|
3578
|
+
var hasMemberPropertyAccess = (rootNode, objectName, propertyName) => hasDescendantNode(rootNode, (node) => node.type === import_utils39.AST_NODE_TYPES.MemberExpression ? isStaticPropertyMatch(node, objectName, propertyName) : false);
|
|
3609
3579
|
var hasObjectPatternProperty = (objectPattern, propertyName) => objectPattern.properties.some((propertyNode) => {
|
|
3610
3580
|
if (propertyNode.type !== import_utils39.AST_NODE_TYPES.Property) {
|
|
3611
3581
|
return false;
|
|
3612
3582
|
}
|
|
3613
3583
|
return getPropertyName(propertyNode) === propertyName;
|
|
3614
3584
|
});
|
|
3615
|
-
var
|
|
3616
|
-
var
|
|
3585
|
+
var hasCallbackMessageDataUsage = (callbackNode, eventParameterName) => hasMemberPropertyAccess(callbackNode.body, eventParameterName, "data") || hasObjectDestructureFromIdentifier(callbackNode.body, eventParameterName, "data");
|
|
3586
|
+
var hasCallbackOriginValidation = (callbackNode, context, eventParameterName) => {
|
|
3617
3587
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
3618
|
-
return
|
|
3588
|
+
return hasMemberPropertyAccess(callbackNode.body, eventParameterName, "origin") || hasObjectDestructureFromIdentifier(callbackNode.body, eventParameterName, "origin") || hasMessageEventGuardKeywords(callbackSourceText);
|
|
3619
3589
|
};
|
|
3620
|
-
var
|
|
3621
|
-
var
|
|
3590
|
+
var shouldReportIdentifierCallback = (callbackNode, context, eventParameter) => hasCallbackMessageDataUsage(callbackNode, eventParameter.name) && !hasCallbackOriginValidation(callbackNode, context, eventParameter.name);
|
|
3591
|
+
var shouldReportObjectPatternCallback = (callbackNode, context, eventParameter) => {
|
|
3622
3592
|
if (!hasObjectPatternProperty(eventParameter, "data")) {
|
|
3623
3593
|
return false;
|
|
3624
3594
|
}
|
|
@@ -3633,10 +3603,10 @@ var shouldReportMessageEventCallback = (callbackNode, context) => {
|
|
|
3633
3603
|
return false;
|
|
3634
3604
|
}
|
|
3635
3605
|
if (firstParameter.type === import_utils39.AST_NODE_TYPES.Identifier) {
|
|
3636
|
-
return
|
|
3606
|
+
return shouldReportIdentifierCallback(callbackNode, context, firstParameter);
|
|
3637
3607
|
}
|
|
3638
3608
|
if (firstParameter.type === import_utils39.AST_NODE_TYPES.ObjectPattern) {
|
|
3639
|
-
return
|
|
3609
|
+
return shouldReportObjectPatternCallback(callbackNode, context, firstParameter);
|
|
3640
3610
|
}
|
|
3641
3611
|
return false;
|
|
3642
3612
|
};
|
|
@@ -3710,16 +3680,14 @@ var no_message_event_without_origin_check_default = rule47;
|
|
|
3710
3680
|
|
|
3711
3681
|
// dist/rules/no-msapp-exec-unsafe.js
|
|
3712
3682
|
var rule48 = createRule({
|
|
3713
|
-
create(context) {
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
};
|
|
3722
|
-
},
|
|
3683
|
+
create: (context) => ({
|
|
3684
|
+
"CallExpression[arguments.length=1][callee.object.name='MSApp'][callee.property.name='execUnsafeLocalFunction']"(node) {
|
|
3685
|
+
context.report({
|
|
3686
|
+
messageId: "default",
|
|
3687
|
+
node
|
|
3688
|
+
});
|
|
3689
|
+
}
|
|
3690
|
+
}),
|
|
3723
3691
|
meta: {
|
|
3724
3692
|
deprecated: false,
|
|
3725
3693
|
docs: {
|
|
@@ -3740,11 +3708,11 @@ var no_msapp_exec_unsafe_default = rule48;
|
|
|
3740
3708
|
|
|
3741
3709
|
// dist/rules/no-node-tls-check-server-identity-bypass.js
|
|
3742
3710
|
var import_utils41 = require("@typescript-eslint/utils");
|
|
3743
|
-
var
|
|
3711
|
+
var import_ts_extras26 = require("ts-extras");
|
|
3744
3712
|
|
|
3745
3713
|
// dist/_internal/node-tls-config.js
|
|
3746
3714
|
var import_utils40 = require("@typescript-eslint/utils");
|
|
3747
|
-
var
|
|
3715
|
+
var import_ts_extras25 = require("ts-extras");
|
|
3748
3716
|
var NODE_TLS_OBJECT_NAMES = /* @__PURE__ */ new Set([
|
|
3749
3717
|
"http2",
|
|
3750
3718
|
"https",
|
|
@@ -3760,13 +3728,13 @@ var NODE_TLS_CALL_METHOD_NAMES = /* @__PURE__ */ new Set([
|
|
|
3760
3728
|
]);
|
|
3761
3729
|
var isNodeTlsObjectExpression = (expression) => {
|
|
3762
3730
|
if (expression.type === import_utils40.AST_NODE_TYPES.Identifier) {
|
|
3763
|
-
return (0,
|
|
3731
|
+
return (0, import_ts_extras25.setHas)(NODE_TLS_OBJECT_NAMES, expression.name);
|
|
3764
3732
|
}
|
|
3765
3733
|
if (expression.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
3766
3734
|
return false;
|
|
3767
3735
|
}
|
|
3768
3736
|
const propertyName = getMemberPropertyName3(expression);
|
|
3769
|
-
return (0,
|
|
3737
|
+
return (0, import_ts_extras25.isDefined)(propertyName) && (0, import_ts_extras25.setHas)(NODE_TLS_OBJECT_NAMES, propertyName);
|
|
3770
3738
|
};
|
|
3771
3739
|
var isRelevantNodeTlsCall = (callee) => {
|
|
3772
3740
|
if (callee.type === import_utils40.AST_NODE_TYPES.Identifier) {
|
|
@@ -3776,7 +3744,7 @@ var isRelevantNodeTlsCall = (callee) => {
|
|
|
3776
3744
|
return false;
|
|
3777
3745
|
}
|
|
3778
3746
|
const methodName = getMemberPropertyName3(callee);
|
|
3779
|
-
return (0,
|
|
3747
|
+
return (0, import_ts_extras25.isDefined)(methodName) && (0, import_ts_extras25.setHas)(NODE_TLS_CALL_METHOD_NAMES, methodName) && isNodeTlsObjectExpression(callee.object);
|
|
3780
3748
|
};
|
|
3781
3749
|
var isRelevantNodeTlsConstructor = (callee) => {
|
|
3782
3750
|
if (callee.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
@@ -3799,7 +3767,7 @@ var isNodeTlsStaticMember = (node, propertyNames) => {
|
|
|
3799
3767
|
return false;
|
|
3800
3768
|
}
|
|
3801
3769
|
const propertyName = getMemberPropertyName3(node);
|
|
3802
|
-
return (0,
|
|
3770
|
+
return (0, import_ts_extras25.isDefined)(propertyName) && (0, import_ts_extras25.setHas)(propertyNames, propertyName) && isNodeTlsObjectExpression(node.object);
|
|
3803
3771
|
};
|
|
3804
3772
|
|
|
3805
3773
|
// dist/rules/no-node-tls-check-server-identity-bypass.js
|
|
@@ -3825,40 +3793,38 @@ var isAlwaysSuccessfulCheckServerIdentity = (callbackNode) => {
|
|
|
3825
3793
|
if (callbackNode.body.body.length !== 1) {
|
|
3826
3794
|
return false;
|
|
3827
3795
|
}
|
|
3828
|
-
const onlyStatement = (0,
|
|
3796
|
+
const onlyStatement = (0, import_ts_extras26.arrayFirst)(callbackNode.body.body);
|
|
3829
3797
|
if (onlyStatement?.type !== import_utils41.AST_NODE_TYPES.ReturnStatement) {
|
|
3830
3798
|
return false;
|
|
3831
3799
|
}
|
|
3832
3800
|
return onlyStatement.argument === null || isAlwaysSuccessfulReturnExpression(onlyStatement.argument);
|
|
3833
3801
|
};
|
|
3834
3802
|
var rule49 = createRule({
|
|
3835
|
-
create(context) {
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3803
|
+
create: (context) => ({
|
|
3804
|
+
AssignmentExpression(node) {
|
|
3805
|
+
if (node.operator !== "=" || !isNodeTlsStaticMember(node.left, CHECK_SERVER_IDENTITY_PROPERTY_NAMES) || !isFunctionExpression7(node.right) || !isAlwaysSuccessfulCheckServerIdentity(node.right)) {
|
|
3806
|
+
return;
|
|
3807
|
+
}
|
|
3808
|
+
context.report({
|
|
3809
|
+
messageId: "default",
|
|
3810
|
+
node: node.right
|
|
3811
|
+
});
|
|
3812
|
+
},
|
|
3813
|
+
ObjectExpression(node) {
|
|
3814
|
+
if (!isRelevantNodeTlsOptionsObject(node)) {
|
|
3815
|
+
return;
|
|
3816
|
+
}
|
|
3817
|
+
for (const propertyNode of node.properties) {
|
|
3818
|
+
if (propertyNode.type !== import_utils41.AST_NODE_TYPES.Property || propertyNode.kind !== "init" || getPropertyName(propertyNode) !== "checkServerIdentity" || !isExpressionNode2(propertyNode.value) || !isFunctionExpression7(propertyNode.value) || !isAlwaysSuccessfulCheckServerIdentity(propertyNode.value)) {
|
|
3819
|
+
continue;
|
|
3840
3820
|
}
|
|
3841
3821
|
context.report({
|
|
3842
3822
|
messageId: "default",
|
|
3843
|
-
node:
|
|
3823
|
+
node: propertyNode.value
|
|
3844
3824
|
});
|
|
3845
|
-
},
|
|
3846
|
-
ObjectExpression(node) {
|
|
3847
|
-
if (!isRelevantNodeTlsOptionsObject(node)) {
|
|
3848
|
-
return;
|
|
3849
|
-
}
|
|
3850
|
-
for (const propertyNode of node.properties) {
|
|
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)) {
|
|
3852
|
-
continue;
|
|
3853
|
-
}
|
|
3854
|
-
context.report({
|
|
3855
|
-
messageId: "default",
|
|
3856
|
-
node: propertyNode.value
|
|
3857
|
-
});
|
|
3858
|
-
}
|
|
3859
3825
|
}
|
|
3860
|
-
}
|
|
3861
|
-
},
|
|
3826
|
+
}
|
|
3827
|
+
}),
|
|
3862
3828
|
meta: {
|
|
3863
3829
|
deprecated: false,
|
|
3864
3830
|
docs: {
|
|
@@ -3879,7 +3845,12 @@ var no_node_tls_check_server_identity_bypass_default = rule49;
|
|
|
3879
3845
|
|
|
3880
3846
|
// dist/rules/no-node-tls-legacy-protocol.js
|
|
3881
3847
|
var import_utils42 = require("@typescript-eslint/utils");
|
|
3882
|
-
var
|
|
3848
|
+
var import_ts_extras27 = require("ts-extras");
|
|
3849
|
+
var LEGACY_TLS_PROPERTY_NAMES = [
|
|
3850
|
+
"maxVersion",
|
|
3851
|
+
"minVersion",
|
|
3852
|
+
"secureProtocol"
|
|
3853
|
+
];
|
|
3883
3854
|
var LEGACY_TLS_VERSION_VALUES = /* @__PURE__ */ new Set([
|
|
3884
3855
|
"TLSv1",
|
|
3885
3856
|
"TLSv1.0",
|
|
@@ -3891,67 +3862,65 @@ var isLegacyTlsPropertyValue = (propertyName, configuredValue) => {
|
|
|
3891
3862
|
if (propertyName === "secureProtocol") {
|
|
3892
3863
|
return isLegacySecureProtocolValue(configuredValue);
|
|
3893
3864
|
}
|
|
3894
|
-
return (0,
|
|
3865
|
+
return (0, import_ts_extras27.setHas)(LEGACY_TLS_VERSION_VALUES, configuredValue);
|
|
3895
3866
|
};
|
|
3896
3867
|
var getLegacyTlsPropertyName = (propertyNode) => {
|
|
3897
3868
|
const propertyName = getPropertyName(propertyNode);
|
|
3898
|
-
if (
|
|
3869
|
+
if ((0, import_ts_extras27.arrayIncludes)(LEGACY_TLS_PROPERTY_NAMES, propertyName)) {
|
|
3899
3870
|
return propertyName;
|
|
3900
3871
|
}
|
|
3901
3872
|
return void 0;
|
|
3902
3873
|
};
|
|
3903
3874
|
var isTlsDefaultVersionMember = (node) => isNodeTlsStaticMember(node, /* @__PURE__ */ new Set(["DEFAULT_MAX_VERSION", "DEFAULT_MIN_VERSION"]));
|
|
3904
3875
|
var rule50 = createRule({
|
|
3905
|
-
create(context) {
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3876
|
+
create: (context) => ({
|
|
3877
|
+
AssignmentExpression(node) {
|
|
3878
|
+
if (node.operator !== "=" || !isTlsDefaultVersionMember(node.left)) {
|
|
3879
|
+
return;
|
|
3880
|
+
}
|
|
3881
|
+
const configuredValue = getStaticStringValue(node.right);
|
|
3882
|
+
if (typeof configuredValue !== "string" || !(0, import_ts_extras27.setHas)(LEGACY_TLS_VERSION_VALUES, configuredValue)) {
|
|
3883
|
+
return;
|
|
3884
|
+
}
|
|
3885
|
+
context.report({
|
|
3886
|
+
data: {
|
|
3887
|
+
configuredValue,
|
|
3888
|
+
propertyName: getMemberPropertyName3(node.left) ?? "DEFAULT_MIN_VERSION"
|
|
3889
|
+
},
|
|
3890
|
+
messageId: "default",
|
|
3891
|
+
node: node.right
|
|
3892
|
+
});
|
|
3893
|
+
},
|
|
3894
|
+
ObjectExpression(node) {
|
|
3895
|
+
if (!isRelevantNodeTlsOptionsObject(node)) {
|
|
3896
|
+
return;
|
|
3897
|
+
}
|
|
3898
|
+
for (const propertyNode of node.properties) {
|
|
3899
|
+
if (propertyNode.type !== import_utils42.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
3900
|
+
continue;
|
|
3910
3901
|
}
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3902
|
+
if (!isExpressionNode3(propertyNode.value)) {
|
|
3903
|
+
continue;
|
|
3904
|
+
}
|
|
3905
|
+
const propertyName = getLegacyTlsPropertyName(propertyNode);
|
|
3906
|
+
if (!(0, import_ts_extras27.isDefined)(propertyName)) {
|
|
3907
|
+
continue;
|
|
3908
|
+
}
|
|
3909
|
+
const configuredValue = getStaticStringValue(propertyNode.value);
|
|
3910
|
+
if (typeof configuredValue !== "string" || !isLegacyTlsPropertyValue(propertyName, configuredValue)) {
|
|
3911
|
+
continue;
|
|
3914
3912
|
}
|
|
3915
3913
|
context.report({
|
|
3916
3914
|
data: {
|
|
3917
3915
|
configuredValue,
|
|
3918
|
-
propertyName
|
|
3916
|
+
propertyName
|
|
3919
3917
|
},
|
|
3920
3918
|
messageId: "default",
|
|
3921
|
-
node:
|
|
3919
|
+
node: propertyNode.value
|
|
3922
3920
|
});
|
|
3923
|
-
},
|
|
3924
|
-
ObjectExpression(node) {
|
|
3925
|
-
if (!isRelevantNodeTlsOptionsObject(node)) {
|
|
3926
|
-
return;
|
|
3927
|
-
}
|
|
3928
|
-
for (const propertyNode of node.properties) {
|
|
3929
|
-
if (propertyNode.type !== import_utils42.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
3930
|
-
continue;
|
|
3931
|
-
}
|
|
3932
|
-
if (!isExpressionNode3(propertyNode.value)) {
|
|
3933
|
-
continue;
|
|
3934
|
-
}
|
|
3935
|
-
const propertyName = getLegacyTlsPropertyName(propertyNode);
|
|
3936
|
-
if (!(0, import_ts_extras26.isDefined)(propertyName)) {
|
|
3937
|
-
continue;
|
|
3938
|
-
}
|
|
3939
|
-
const configuredValue = getStaticStringValue(propertyNode.value);
|
|
3940
|
-
if (typeof configuredValue !== "string" || !isLegacyTlsPropertyValue(propertyName, configuredValue)) {
|
|
3941
|
-
continue;
|
|
3942
|
-
}
|
|
3943
|
-
context.report({
|
|
3944
|
-
data: {
|
|
3945
|
-
configuredValue,
|
|
3946
|
-
propertyName
|
|
3947
|
-
},
|
|
3948
|
-
messageId: "default",
|
|
3949
|
-
node: propertyNode.value
|
|
3950
|
-
});
|
|
3951
|
-
}
|
|
3952
3921
|
}
|
|
3953
|
-
}
|
|
3954
|
-
},
|
|
3922
|
+
}
|
|
3923
|
+
}),
|
|
3955
3924
|
meta: {
|
|
3956
3925
|
deprecated: false,
|
|
3957
3926
|
docs: {
|
|
@@ -3972,7 +3941,7 @@ var no_node_tls_legacy_protocol_default = rule50;
|
|
|
3972
3941
|
|
|
3973
3942
|
// dist/rules/no-node-tls-reject-unauthorized-zero.js
|
|
3974
3943
|
var import_utils43 = require("@typescript-eslint/utils");
|
|
3975
|
-
var
|
|
3944
|
+
var import_ts_extras28 = require("ts-extras");
|
|
3976
3945
|
var getMemberPropertyName13 = (memberExpression) => {
|
|
3977
3946
|
if (!memberExpression.computed && memberExpression.property.type === import_utils43.AST_NODE_TYPES.Identifier) {
|
|
3978
3947
|
return memberExpression.property.name;
|
|
@@ -4004,37 +3973,35 @@ var isUnsafeOverrideValue = (node) => {
|
|
|
4004
3973
|
if (node.type === import_utils43.AST_NODE_TYPES.Literal) {
|
|
4005
3974
|
return node.value === 0 || node.value === "0";
|
|
4006
3975
|
}
|
|
4007
|
-
return node.type === import_utils43.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0 && (0,
|
|
3976
|
+
return node.type === import_utils43.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0 && (0, import_ts_extras28.arrayFirst)(node.quasis)?.value.cooked === "0";
|
|
4008
3977
|
};
|
|
4009
3978
|
var rule51 = createRule({
|
|
4010
|
-
create(context) {
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
return;
|
|
4015
|
-
}
|
|
4016
|
-
if (!isTlsRejectUnauthorizedMember(node.left)) {
|
|
4017
|
-
return;
|
|
4018
|
-
}
|
|
4019
|
-
if (!isUnsafeOverrideValue(node.right)) {
|
|
4020
|
-
return;
|
|
4021
|
-
}
|
|
4022
|
-
context.report({
|
|
4023
|
-
messageId: "default",
|
|
4024
|
-
node,
|
|
4025
|
-
suggest: [
|
|
4026
|
-
{
|
|
4027
|
-
fix(fixer) {
|
|
4028
|
-
const replacementValue = node.right.type === import_utils43.AST_NODE_TYPES.TemplateLiteral ? "`1`" : "'1'";
|
|
4029
|
-
return fixer.replaceText(node.right, replacementValue);
|
|
4030
|
-
},
|
|
4031
|
-
messageId: "replaceWithTlsRejectUnauthorizedOne"
|
|
4032
|
-
}
|
|
4033
|
-
]
|
|
4034
|
-
});
|
|
3979
|
+
create: (context) => ({
|
|
3980
|
+
AssignmentExpression(node) {
|
|
3981
|
+
if (node.operator !== "=") {
|
|
3982
|
+
return;
|
|
4035
3983
|
}
|
|
4036
|
-
|
|
4037
|
-
|
|
3984
|
+
if (!isTlsRejectUnauthorizedMember(node.left)) {
|
|
3985
|
+
return;
|
|
3986
|
+
}
|
|
3987
|
+
if (!isUnsafeOverrideValue(node.right)) {
|
|
3988
|
+
return;
|
|
3989
|
+
}
|
|
3990
|
+
context.report({
|
|
3991
|
+
messageId: "default",
|
|
3992
|
+
node,
|
|
3993
|
+
suggest: [
|
|
3994
|
+
{
|
|
3995
|
+
fix(fixer) {
|
|
3996
|
+
const replacementValue = node.right.type === import_utils43.AST_NODE_TYPES.TemplateLiteral ? "`1`" : "'1'";
|
|
3997
|
+
return fixer.replaceText(node.right, replacementValue);
|
|
3998
|
+
},
|
|
3999
|
+
messageId: "replaceWithTlsRejectUnauthorizedOne"
|
|
4000
|
+
}
|
|
4001
|
+
]
|
|
4002
|
+
});
|
|
4003
|
+
}
|
|
4004
|
+
}),
|
|
4038
4005
|
meta: {
|
|
4039
4006
|
deprecated: false,
|
|
4040
4007
|
docs: {
|
|
@@ -4062,49 +4029,47 @@ var TLS_SECURITY_LEVEL_ZERO_PATTERN = /@seclevel\s*=\s*0\b/iv;
|
|
|
4062
4029
|
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;
|
|
4063
4030
|
var isSecurityLevelZeroCipherString = (value) => TLS_SECURITY_LEVEL_ZERO_PATTERN.test(value);
|
|
4064
4031
|
var rule52 = createRule({
|
|
4065
|
-
create(context) {
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4032
|
+
create: (context) => ({
|
|
4033
|
+
AssignmentExpression(node) {
|
|
4034
|
+
if (node.operator !== "=" || !isNodeTlsStaticMember(node.left, TLS_DEFAULT_CIPHERS_PROPERTY_NAMES)) {
|
|
4035
|
+
return;
|
|
4036
|
+
}
|
|
4037
|
+
const configuredValue = getStaticStringValue(node.right);
|
|
4038
|
+
if (typeof configuredValue !== "string" || !isSecurityLevelZeroCipherString(configuredValue)) {
|
|
4039
|
+
return;
|
|
4040
|
+
}
|
|
4041
|
+
context.report({
|
|
4042
|
+
data: {
|
|
4043
|
+
configuredValue,
|
|
4044
|
+
propertyName: "DEFAULT_CIPHERS"
|
|
4045
|
+
},
|
|
4046
|
+
messageId: "default",
|
|
4047
|
+
node: node.right
|
|
4048
|
+
});
|
|
4049
|
+
},
|
|
4050
|
+
ObjectExpression(node) {
|
|
4051
|
+
if (!isRelevantNodeTlsOptionsObject(node)) {
|
|
4052
|
+
return;
|
|
4053
|
+
}
|
|
4054
|
+
for (const propertyNode of node.properties) {
|
|
4055
|
+
if (propertyNode.type !== import_utils44.AST_NODE_TYPES.Property || propertyNode.kind !== "init" || getPropertyName(propertyNode) !== "ciphers" || !isExpressionNode4(propertyNode.value)) {
|
|
4056
|
+
continue;
|
|
4070
4057
|
}
|
|
4071
|
-
const configuredValue = getStaticStringValue(
|
|
4058
|
+
const configuredValue = getStaticStringValue(propertyNode.value);
|
|
4072
4059
|
if (typeof configuredValue !== "string" || !isSecurityLevelZeroCipherString(configuredValue)) {
|
|
4073
|
-
|
|
4060
|
+
continue;
|
|
4074
4061
|
}
|
|
4075
4062
|
context.report({
|
|
4076
4063
|
data: {
|
|
4077
4064
|
configuredValue,
|
|
4078
|
-
propertyName: "
|
|
4065
|
+
propertyName: "ciphers"
|
|
4079
4066
|
},
|
|
4080
4067
|
messageId: "default",
|
|
4081
|
-
node:
|
|
4068
|
+
node: propertyNode.value
|
|
4082
4069
|
});
|
|
4083
|
-
},
|
|
4084
|
-
ObjectExpression(node) {
|
|
4085
|
-
if (!isRelevantNodeTlsOptionsObject(node)) {
|
|
4086
|
-
return;
|
|
4087
|
-
}
|
|
4088
|
-
for (const propertyNode of node.properties) {
|
|
4089
|
-
if (propertyNode.type !== import_utils44.AST_NODE_TYPES.Property || propertyNode.kind !== "init" || getPropertyName(propertyNode) !== "ciphers" || !isExpressionNode4(propertyNode.value)) {
|
|
4090
|
-
continue;
|
|
4091
|
-
}
|
|
4092
|
-
const configuredValue = getStaticStringValue(propertyNode.value);
|
|
4093
|
-
if (typeof configuredValue !== "string" || !isSecurityLevelZeroCipherString(configuredValue)) {
|
|
4094
|
-
continue;
|
|
4095
|
-
}
|
|
4096
|
-
context.report({
|
|
4097
|
-
data: {
|
|
4098
|
-
configuredValue,
|
|
4099
|
-
propertyName: "ciphers"
|
|
4100
|
-
},
|
|
4101
|
-
messageId: "default",
|
|
4102
|
-
node: propertyNode.value
|
|
4103
|
-
});
|
|
4104
|
-
}
|
|
4105
4070
|
}
|
|
4106
|
-
}
|
|
4107
|
-
},
|
|
4071
|
+
}
|
|
4072
|
+
}),
|
|
4108
4073
|
meta: {
|
|
4109
4074
|
deprecated: false,
|
|
4110
4075
|
docs: {
|
|
@@ -4125,7 +4090,7 @@ var no_node_tls_security_level_zero_default = rule52;
|
|
|
4125
4090
|
|
|
4126
4091
|
// dist/rules/no-node-vm-run-in-context.js
|
|
4127
4092
|
var import_utils45 = require("@typescript-eslint/utils");
|
|
4128
|
-
var
|
|
4093
|
+
var import_ts_extras29 = require("ts-extras");
|
|
4129
4094
|
var VM_MODULE_NAMES = /* @__PURE__ */ new Set(["node:vm", "vm"]);
|
|
4130
4095
|
var DISALLOWED_VM_CALL_NAMES = /* @__PURE__ */ new Set([
|
|
4131
4096
|
"compileFunction",
|
|
@@ -4134,9 +4099,9 @@ var DISALLOWED_VM_CALL_NAMES = /* @__PURE__ */ new Set([
|
|
|
4134
4099
|
"runInThisContext"
|
|
4135
4100
|
]);
|
|
4136
4101
|
var DISALLOWED_VM_CONSTRUCTOR_NAMES = /* @__PURE__ */ new Set(["Script"]);
|
|
4137
|
-
var isVmModuleSource = (value) => (0,
|
|
4138
|
-
var isDisallowedVmCallName = (value) => (0,
|
|
4139
|
-
var isDisallowedVmConstructorName = (value) => (0,
|
|
4102
|
+
var isVmModuleSource = (value) => (0, import_ts_extras29.setHas)(VM_MODULE_NAMES, value);
|
|
4103
|
+
var isDisallowedVmCallName = (value) => (0, import_ts_extras29.isDefined)(value) && (0, import_ts_extras29.setHas)(DISALLOWED_VM_CALL_NAMES, value);
|
|
4104
|
+
var isDisallowedVmConstructorName = (value) => (0, import_ts_extras29.isDefined)(value) && (0, import_ts_extras29.setHas)(DISALLOWED_VM_CONSTRUCTOR_NAMES, value);
|
|
4140
4105
|
var isRequireCallFromVmModule = (expression) => {
|
|
4141
4106
|
if (expression?.type !== import_utils45.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils45.AST_NODE_TYPES.Identifier || expression.callee.name !== "require") {
|
|
4142
4107
|
return false;
|
|
@@ -4161,7 +4126,7 @@ var rule53 = createRule({
|
|
|
4161
4126
|
return {
|
|
4162
4127
|
CallExpression(node) {
|
|
4163
4128
|
if (node.callee.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4164
|
-
if (!(0,
|
|
4129
|
+
if (!(0, import_ts_extras29.setHas)(vmCallBindingNames, node.callee.name)) {
|
|
4165
4130
|
return;
|
|
4166
4131
|
}
|
|
4167
4132
|
context.report({
|
|
@@ -4177,7 +4142,7 @@ var rule53 = createRule({
|
|
|
4177
4142
|
if (!isDisallowedVmCallName(methodName)) {
|
|
4178
4143
|
return;
|
|
4179
4144
|
}
|
|
4180
|
-
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.Identifier && (0,
|
|
4145
|
+
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.Identifier && (0, import_ts_extras29.setHas)(vmNamespaceBindingNames, node.callee.object.name)) {
|
|
4181
4146
|
context.report({
|
|
4182
4147
|
messageId: "default",
|
|
4183
4148
|
node: node.callee
|
|
@@ -4212,7 +4177,7 @@ var rule53 = createRule({
|
|
|
4212
4177
|
},
|
|
4213
4178
|
NewExpression(node) {
|
|
4214
4179
|
if (node.callee.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4215
|
-
if (!(0,
|
|
4180
|
+
if (!(0, import_ts_extras29.setHas)(vmConstructorBindingNames, node.callee.name)) {
|
|
4216
4181
|
return;
|
|
4217
4182
|
}
|
|
4218
4183
|
context.report({
|
|
@@ -4228,7 +4193,7 @@ var rule53 = createRule({
|
|
|
4228
4193
|
if (!isDisallowedVmConstructorName(constructorName)) {
|
|
4229
4194
|
return;
|
|
4230
4195
|
}
|
|
4231
|
-
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.Identifier && (0,
|
|
4196
|
+
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.Identifier && (0, import_ts_extras29.setHas)(vmNamespaceBindingNames, node.callee.object.name)) {
|
|
4232
4197
|
context.report({
|
|
4233
4198
|
messageId: "default",
|
|
4234
4199
|
node: node.callee
|
|
@@ -4293,10 +4258,10 @@ var no_node_vm_run_in_context_default = rule53;
|
|
|
4293
4258
|
|
|
4294
4259
|
// dist/rules/no-node-vm-source-text-module.js
|
|
4295
4260
|
var import_utils46 = require("@typescript-eslint/utils");
|
|
4296
|
-
var
|
|
4261
|
+
var import_ts_extras30 = require("ts-extras");
|
|
4297
4262
|
var VM_MODULE_NAMES2 = /* @__PURE__ */ new Set(["node:vm", "vm"]);
|
|
4298
4263
|
var SOURCE_TEXT_MODULE_NAME = "SourceTextModule";
|
|
4299
|
-
var isVmModuleSource2 = (value) => (0,
|
|
4264
|
+
var isVmModuleSource2 = (value) => (0, import_ts_extras30.setHas)(VM_MODULE_NAMES2, value);
|
|
4300
4265
|
var isRequireCallFromVmModule2 = (expression) => {
|
|
4301
4266
|
if (expression?.type !== import_utils46.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils46.AST_NODE_TYPES.Identifier || expression.callee.name !== "require") {
|
|
4302
4267
|
return false;
|
|
@@ -4315,7 +4280,7 @@ var getPatternIdentifier3 = (pattern) => {
|
|
|
4315
4280
|
};
|
|
4316
4281
|
var isSourceTextModuleConstructor = (callee, sourceTextModuleBindingNames, vmNamespaceBindingNames) => {
|
|
4317
4282
|
if (callee.type === import_utils46.AST_NODE_TYPES.Identifier) {
|
|
4318
|
-
return (0,
|
|
4283
|
+
return (0, import_ts_extras30.setHas)(sourceTextModuleBindingNames, callee.name);
|
|
4319
4284
|
}
|
|
4320
4285
|
if (callee.type !== import_utils46.AST_NODE_TYPES.MemberExpression) {
|
|
4321
4286
|
return false;
|
|
@@ -4323,7 +4288,7 @@ var isSourceTextModuleConstructor = (callee, sourceTextModuleBindingNames, vmNam
|
|
|
4323
4288
|
if (getMemberPropertyName3(callee) !== SOURCE_TEXT_MODULE_NAME) {
|
|
4324
4289
|
return false;
|
|
4325
4290
|
}
|
|
4326
|
-
return callee.object.type === import_utils46.AST_NODE_TYPES.Identifier && (0,
|
|
4291
|
+
return callee.object.type === import_utils46.AST_NODE_TYPES.Identifier && (0, import_ts_extras30.setHas)(vmNamespaceBindingNames, callee.object.name) || callee.object.type === import_utils46.AST_NODE_TYPES.CallExpression && isRequireCallFromVmModule2(callee.object);
|
|
4327
4292
|
};
|
|
4328
4293
|
var rule54 = createRule({
|
|
4329
4294
|
create(context) {
|
|
@@ -4401,12 +4366,12 @@ var no_node_vm_source_text_module_default = rule54;
|
|
|
4401
4366
|
|
|
4402
4367
|
// dist/rules/no-node-worker-threads-eval.js
|
|
4403
4368
|
var import_utils47 = require("@typescript-eslint/utils");
|
|
4404
|
-
var
|
|
4369
|
+
var import_ts_extras31 = require("ts-extras");
|
|
4405
4370
|
var WORKER_THREADS_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
4406
4371
|
"node:worker_threads",
|
|
4407
4372
|
"worker_threads"
|
|
4408
4373
|
]);
|
|
4409
|
-
var isWorkerThreadsModuleSource = (value) => (0,
|
|
4374
|
+
var isWorkerThreadsModuleSource = (value) => (0, import_ts_extras31.setHas)(WORKER_THREADS_MODULE_NAMES, value);
|
|
4410
4375
|
var isRequireCallFromWorkerThreads = (expression) => {
|
|
4411
4376
|
if (expression?.type !== import_utils47.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils47.AST_NODE_TYPES.Identifier || expression.callee.name !== "require") {
|
|
4412
4377
|
return false;
|
|
@@ -4442,7 +4407,7 @@ var hasEvalTrueOption = (optionsNode) => {
|
|
|
4442
4407
|
};
|
|
4443
4408
|
var isWorkerThreadsWorkerConstructor = (callee, workerBindingNames, workerThreadsNamespaceBindingNames) => {
|
|
4444
4409
|
if (callee.type === import_utils47.AST_NODE_TYPES.Identifier) {
|
|
4445
|
-
return (0,
|
|
4410
|
+
return (0, import_ts_extras31.setHas)(workerBindingNames, callee.name);
|
|
4446
4411
|
}
|
|
4447
4412
|
if (callee.type !== import_utils47.AST_NODE_TYPES.MemberExpression) {
|
|
4448
4413
|
return false;
|
|
@@ -4450,7 +4415,7 @@ var isWorkerThreadsWorkerConstructor = (callee, workerBindingNames, workerThread
|
|
|
4450
4415
|
if (getMemberPropertyName3(callee) !== "Worker") {
|
|
4451
4416
|
return false;
|
|
4452
4417
|
}
|
|
4453
|
-
return callee.object.type === import_utils47.AST_NODE_TYPES.Identifier && (0,
|
|
4418
|
+
return callee.object.type === import_utils47.AST_NODE_TYPES.Identifier && (0, import_ts_extras31.setHas)(workerThreadsNamespaceBindingNames, callee.object.name) || callee.object.type === import_utils47.AST_NODE_TYPES.CallExpression && isRequireCallFromWorkerThreads(callee.object);
|
|
4454
4419
|
};
|
|
4455
4420
|
var rule55 = createRule({
|
|
4456
4421
|
create(context) {
|
|
@@ -4543,19 +4508,17 @@ var isSecuritySensitiveExpression = (expression) => {
|
|
|
4543
4508
|
return false;
|
|
4544
4509
|
};
|
|
4545
4510
|
var rule56 = createRule({
|
|
4546
|
-
create(context) {
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
return;
|
|
4551
|
-
}
|
|
4552
|
-
context.report({
|
|
4553
|
-
messageId: "default",
|
|
4554
|
-
node
|
|
4555
|
-
});
|
|
4511
|
+
create: (context) => ({
|
|
4512
|
+
TSNonNullExpression(node) {
|
|
4513
|
+
if (!isSecuritySensitiveExpression(node.expression)) {
|
|
4514
|
+
return;
|
|
4556
4515
|
}
|
|
4557
|
-
|
|
4558
|
-
|
|
4516
|
+
context.report({
|
|
4517
|
+
messageId: "default",
|
|
4518
|
+
node
|
|
4519
|
+
});
|
|
4520
|
+
}
|
|
4521
|
+
}),
|
|
4559
4522
|
meta: {
|
|
4560
4523
|
deprecated: false,
|
|
4561
4524
|
docs: {
|
|
@@ -4576,19 +4539,19 @@ var no_nonnull_assertion_on_security_input_default = rule56;
|
|
|
4576
4539
|
|
|
4577
4540
|
// dist/rules/no-postmessage-star-origin.js
|
|
4578
4541
|
var import_utils49 = require("@typescript-eslint/utils");
|
|
4579
|
-
var
|
|
4542
|
+
var import_ts_extras32 = require("ts-extras");
|
|
4580
4543
|
var rule57 = createRule({
|
|
4581
4544
|
create(context) {
|
|
4582
4545
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
4583
4546
|
return {
|
|
4584
4547
|
"CallExpression[arguments.length>=2][arguments.length<=3][callee.property.name='postMessage']"(node) {
|
|
4585
4548
|
const [, targetOrigin] = node.arguments;
|
|
4586
|
-
if (!(0,
|
|
4549
|
+
if (!(0, import_ts_extras32.isDefined)(targetOrigin) || targetOrigin.type !== import_utils49.AST_NODE_TYPES.Literal || targetOrigin.value !== "*") {
|
|
4587
4550
|
return;
|
|
4588
4551
|
}
|
|
4589
|
-
if ((0,
|
|
4552
|
+
if ((0, import_ts_extras32.isDefined)(fullTypeChecker) && node.callee.type === import_utils49.AST_NODE_TYPES.MemberExpression) {
|
|
4590
4553
|
const calleeObjectType = getNodeTypeAsString(fullTypeChecker, node.callee.object, context);
|
|
4591
|
-
if (!(0,
|
|
4554
|
+
if (!(0, import_ts_extras32.arrayIncludes)(["any", "Window"], calleeObjectType)) {
|
|
4592
4555
|
return;
|
|
4593
4556
|
}
|
|
4594
4557
|
}
|
|
@@ -4597,9 +4560,7 @@ var rule57 = createRule({
|
|
|
4597
4560
|
node: targetOrigin,
|
|
4598
4561
|
suggest: [
|
|
4599
4562
|
{
|
|
4600
|
-
fix(fixer)
|
|
4601
|
-
return fixer.replaceText(targetOrigin, "location.origin");
|
|
4602
|
-
},
|
|
4563
|
+
fix: (fixer) => fixer.replaceText(targetOrigin, "location.origin"),
|
|
4603
4564
|
messageId: "replaceWithExplicitOrigin"
|
|
4604
4565
|
}
|
|
4605
4566
|
]
|
|
@@ -4629,7 +4590,7 @@ var no_postmessage_star_origin_default = rule57;
|
|
|
4629
4590
|
|
|
4630
4591
|
// dist/rules/no-postmessage-without-origin-allowlist.js
|
|
4631
4592
|
var import_utils50 = require("@typescript-eslint/utils");
|
|
4632
|
-
var
|
|
4593
|
+
var import_ts_extras33 = require("ts-extras");
|
|
4633
4594
|
var getMemberPropertyName14 = (memberExpression) => {
|
|
4634
4595
|
if (!memberExpression.computed && memberExpression.property.type === import_utils50.AST_NODE_TYPES.Identifier) {
|
|
4635
4596
|
return memberExpression.property.name;
|
|
@@ -4644,7 +4605,7 @@ var getStaticStringValue6 = (node) => {
|
|
|
4644
4605
|
return node.value;
|
|
4645
4606
|
}
|
|
4646
4607
|
if (node.type === import_utils50.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
4647
|
-
return (0,
|
|
4608
|
+
return (0, import_ts_extras33.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
4648
4609
|
}
|
|
4649
4610
|
return void 0;
|
|
4650
4611
|
};
|
|
@@ -4887,7 +4848,12 @@ var no_script_src_data_url_default = rule60;
|
|
|
4887
4848
|
|
|
4888
4849
|
// dist/rules/no-script-text.js
|
|
4889
4850
|
var import_utils54 = require("@typescript-eslint/utils");
|
|
4890
|
-
var
|
|
4851
|
+
var import_ts_extras34 = require("ts-extras");
|
|
4852
|
+
var isScriptTextPropertyName = (propertyName) => (0, import_ts_extras34.arrayIncludes)([
|
|
4853
|
+
"innerText",
|
|
4854
|
+
"text",
|
|
4855
|
+
"textContent"
|
|
4856
|
+
], propertyName ?? "");
|
|
4891
4857
|
var rule61 = createRule({
|
|
4892
4858
|
create(context) {
|
|
4893
4859
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
@@ -5019,7 +4985,7 @@ var no_set_html_unsafe_default = rule63;
|
|
|
5019
4985
|
|
|
5020
4986
|
// dist/rules/no-trusted-types-policy-pass-through.js
|
|
5021
4987
|
var import_utils57 = require("@typescript-eslint/utils");
|
|
5022
|
-
var
|
|
4988
|
+
var import_ts_extras35 = require("ts-extras");
|
|
5023
4989
|
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;
|
|
5024
4990
|
var POLICY_FACTORY_NAMES = /* @__PURE__ */ new Set([
|
|
5025
4991
|
"createHTML",
|
|
@@ -5045,7 +5011,7 @@ var isPassThroughFactory = (factoryNode) => {
|
|
|
5045
5011
|
if (factoryNode.body.body.length !== 1) {
|
|
5046
5012
|
return false;
|
|
5047
5013
|
}
|
|
5048
|
-
const onlyStatement = (0,
|
|
5014
|
+
const onlyStatement = (0, import_ts_extras35.arrayFirst)(factoryNode.body.body);
|
|
5049
5015
|
if (onlyStatement?.type !== import_utils57.AST_NODE_TYPES.ReturnStatement || onlyStatement.argument === null) {
|
|
5050
5016
|
return false;
|
|
5051
5017
|
}
|
|
@@ -5083,7 +5049,7 @@ var rule64 = createRule({
|
|
|
5083
5049
|
continue;
|
|
5084
5050
|
}
|
|
5085
5051
|
const propertyName = getPropertyName(propertyNode);
|
|
5086
|
-
if (!(0,
|
|
5052
|
+
if (!(0, import_ts_extras35.isDefined)(propertyName) || !(0, import_ts_extras35.setHas)(POLICY_FACTORY_NAMES, propertyName) || !isExpressionNode5(propertyNode.value) || !isFunctionExpression8(propertyNode.value) || !isPassThroughFactory(propertyNode.value)) {
|
|
5087
5053
|
continue;
|
|
5088
5054
|
}
|
|
5089
5055
|
context.report({
|
|
@@ -5162,7 +5128,7 @@ var no_unsafe_alloc_default = rule65;
|
|
|
5162
5128
|
|
|
5163
5129
|
// dist/rules/no-unsafe-cast-to-trusted-types.js
|
|
5164
5130
|
var import_utils59 = require("@typescript-eslint/utils");
|
|
5165
|
-
var
|
|
5131
|
+
var import_ts_extras36 = require("ts-extras");
|
|
5166
5132
|
var TRUSTED_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
5167
5133
|
"TrustedHTML",
|
|
5168
5134
|
"TrustedScript",
|
|
@@ -5176,7 +5142,7 @@ var getTypeName = (node) => {
|
|
|
5176
5142
|
};
|
|
5177
5143
|
var isTrustedTypeNode = (node) => {
|
|
5178
5144
|
const typeName = getTypeName(node);
|
|
5179
|
-
return (0,
|
|
5145
|
+
return (0, import_ts_extras36.isDefined)(typeName) && (0, import_ts_extras36.setHas)(TRUSTED_TYPE_NAMES, typeName);
|
|
5180
5146
|
};
|
|
5181
5147
|
var getExpressionCalleeName = (expression) => {
|
|
5182
5148
|
if (expression.type !== import_utils59.AST_NODE_TYPES.CallExpression) {
|
|
@@ -5192,40 +5158,38 @@ var getExpressionCalleeName = (expression) => {
|
|
|
5192
5158
|
};
|
|
5193
5159
|
var isKnownTrustedFactoryCall = (expression) => {
|
|
5194
5160
|
const calleeName = getExpressionCalleeName(expression);
|
|
5195
|
-
if (!(0,
|
|
5161
|
+
if (!(0, import_ts_extras36.isDefined)(calleeName)) {
|
|
5196
5162
|
return false;
|
|
5197
5163
|
}
|
|
5198
5164
|
return /sanitize|createhtml|createscripturl|createscript|trusted/v.test(calleeName.toLowerCase());
|
|
5199
5165
|
};
|
|
5200
5166
|
var rule66 = createRule({
|
|
5201
|
-
create(context) {
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
return;
|
|
5206
|
-
}
|
|
5207
|
-
if (isKnownTrustedFactoryCall(node.expression)) {
|
|
5208
|
-
return;
|
|
5209
|
-
}
|
|
5210
|
-
context.report({
|
|
5211
|
-
messageId: "default",
|
|
5212
|
-
node
|
|
5213
|
-
});
|
|
5214
|
-
},
|
|
5215
|
-
TSTypeAssertion(node) {
|
|
5216
|
-
if (!isTrustedTypeNode(node.typeAnnotation)) {
|
|
5217
|
-
return;
|
|
5218
|
-
}
|
|
5219
|
-
if (isKnownTrustedFactoryCall(node.expression)) {
|
|
5220
|
-
return;
|
|
5221
|
-
}
|
|
5222
|
-
context.report({
|
|
5223
|
-
messageId: "default",
|
|
5224
|
-
node
|
|
5225
|
-
});
|
|
5167
|
+
create: (context) => ({
|
|
5168
|
+
TSAsExpression(node) {
|
|
5169
|
+
if (!isTrustedTypeNode(node.typeAnnotation)) {
|
|
5170
|
+
return;
|
|
5226
5171
|
}
|
|
5227
|
-
|
|
5228
|
-
|
|
5172
|
+
if (isKnownTrustedFactoryCall(node.expression)) {
|
|
5173
|
+
return;
|
|
5174
|
+
}
|
|
5175
|
+
context.report({
|
|
5176
|
+
messageId: "default",
|
|
5177
|
+
node
|
|
5178
|
+
});
|
|
5179
|
+
},
|
|
5180
|
+
TSTypeAssertion(node) {
|
|
5181
|
+
if (!isTrustedTypeNode(node.typeAnnotation)) {
|
|
5182
|
+
return;
|
|
5183
|
+
}
|
|
5184
|
+
if (isKnownTrustedFactoryCall(node.expression)) {
|
|
5185
|
+
return;
|
|
5186
|
+
}
|
|
5187
|
+
context.report({
|
|
5188
|
+
messageId: "default",
|
|
5189
|
+
node
|
|
5190
|
+
});
|
|
5191
|
+
}
|
|
5192
|
+
}),
|
|
5229
5193
|
meta: {
|
|
5230
5194
|
deprecated: false,
|
|
5231
5195
|
docs: {
|
|
@@ -5246,14 +5210,14 @@ var no_unsafe_cast_to_trusted_types_default = rule66;
|
|
|
5246
5210
|
|
|
5247
5211
|
// dist/rules/no-window-open-without-noopener.js
|
|
5248
5212
|
var import_utils60 = require("@typescript-eslint/utils");
|
|
5249
|
-
var
|
|
5213
|
+
var import_ts_extras37 = require("ts-extras");
|
|
5250
5214
|
var getStaticStringValue7 = (node) => {
|
|
5251
5215
|
if (node.type === import_utils60.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
5252
5216
|
return node.value;
|
|
5253
5217
|
}
|
|
5254
5218
|
if (node.type === import_utils60.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
5255
|
-
const firstQuasi = (0,
|
|
5256
|
-
if (!(0,
|
|
5219
|
+
const firstQuasi = (0, import_ts_extras37.arrayFirst)(node.quasis);
|
|
5220
|
+
if (!(0, import_ts_extras37.isDefined)(firstQuasi) || typeof firstQuasi.value.cooked !== "string") {
|
|
5257
5221
|
return void 0;
|
|
5258
5222
|
}
|
|
5259
5223
|
return firstQuasi.value.cooked;
|
|
@@ -5266,7 +5230,7 @@ var isWindowOpenCallee = (callee) => {
|
|
|
5266
5230
|
}
|
|
5267
5231
|
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";
|
|
5268
5232
|
};
|
|
5269
|
-
var hasNoopenerToken = (features) => (0,
|
|
5233
|
+
var hasNoopenerToken = (features) => (0, import_ts_extras37.stringSplit)(features.toLowerCase(), ",").map((token) => token.trim()).some((token) => token === "noopener" || token.startsWith("noopener="));
|
|
5270
5234
|
var rule67 = createRule({
|
|
5271
5235
|
create(context) {
|
|
5272
5236
|
return {
|
|
@@ -5319,16 +5283,14 @@ var no_window_open_without_noopener_default = rule67;
|
|
|
5319
5283
|
|
|
5320
5284
|
// dist/rules/no-winjs-html-unsafe.js
|
|
5321
5285
|
var rule68 = createRule({
|
|
5322
|
-
create(context) {
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
};
|
|
5331
|
-
},
|
|
5286
|
+
create: (context) => ({
|
|
5287
|
+
"CallExpression[callee.object.object.name='WinJS'][callee.object.property.name='Utilities'][callee.property.name=/^(?:insertAdjacent|setInner|setOuter)HTMLUnsafe$/]"(node) {
|
|
5288
|
+
context.report({
|
|
5289
|
+
messageId: "default",
|
|
5290
|
+
node
|
|
5291
|
+
});
|
|
5292
|
+
}
|
|
5293
|
+
}),
|
|
5332
5294
|
meta: {
|
|
5333
5295
|
deprecated: false,
|
|
5334
5296
|
docs: {
|