eslint-plugin-sdl-2 1.2.4 → 1.2.6
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/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 +613 -652
- package/dist/plugin.cjs.map +3 -3
- package/dist/plugin.js +13 -13
- package/dist/plugin.js.map +1 -1
- 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-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-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.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-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-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/package.json +49 -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.6",
|
|
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,68 @@ 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.2",
|
|
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
|
-
stylelint: "^17.
|
|
324
|
-
"stylelint-config-nick2bad4u": "^1.0.
|
|
327
|
+
"sort-package-json": "^4.0.0",
|
|
328
|
+
stylelint: "^17.13.0",
|
|
329
|
+
"stylelint-config-nick2bad4u": "^1.0.19",
|
|
325
330
|
"ts-unused-exports": "^11.0.1",
|
|
331
|
+
"tsdoc-config-nick2bad4u": "^1.0.5",
|
|
326
332
|
typedoc: "^0.28.19",
|
|
333
|
+
"typedoc-config-nick2bad4u": "^2.0.0",
|
|
327
334
|
typescript: "^6.0.3",
|
|
328
|
-
"typescript-eslint": "^8.
|
|
335
|
+
"typescript-eslint": "^8.61.1",
|
|
329
336
|
typesync: "^0.14.3",
|
|
330
337
|
vfile: "^6.0.3",
|
|
331
|
-
vite: "^8.0.
|
|
338
|
+
vite: "^8.0.16",
|
|
332
339
|
"vite-tsconfig-paths": "^6.1.1",
|
|
333
|
-
vitest: "^4.1.
|
|
340
|
+
vitest: "^4.1.9",
|
|
341
|
+
"yamllint-config-nick2bad4u": "^1.0.2",
|
|
334
342
|
"yamllint-js": "^0.2.4"
|
|
335
343
|
},
|
|
336
344
|
peerDependencies: {
|
|
337
|
-
eslint: "^9.0.0 || ^10.
|
|
345
|
+
eslint: "^9.0.0 || ^10.5.0",
|
|
338
346
|
typescript: ">=5.0.0"
|
|
339
347
|
},
|
|
340
|
-
packageManager: "npm@11.
|
|
348
|
+
packageManager: "npm@11.17.0",
|
|
341
349
|
engines: {
|
|
342
350
|
node: ">=20.19.0"
|
|
343
351
|
},
|
|
@@ -371,16 +379,14 @@ var createRule = ruleCreatorFactory;
|
|
|
371
379
|
|
|
372
380
|
// dist/rules/no-angular-bypass-sanitizer.js
|
|
373
381
|
var rule = createRule({
|
|
374
|
-
create(context) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
};
|
|
383
|
-
},
|
|
382
|
+
create: (context) => ({
|
|
383
|
+
"CallExpression[arguments.length>0][callee.property.name=/^bypassSecurityTrust(?:html|resourceurl|script|style|url)$/i]"(node) {
|
|
384
|
+
context.report({
|
|
385
|
+
messageId: "noBypass",
|
|
386
|
+
node
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}),
|
|
384
390
|
meta: {
|
|
385
391
|
deprecated: false,
|
|
386
392
|
docs: {
|
|
@@ -411,22 +417,20 @@ var getMemberPropertyName = (memberExpression) => {
|
|
|
411
417
|
return void 0;
|
|
412
418
|
};
|
|
413
419
|
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
|
-
});
|
|
420
|
+
create: (context) => ({
|
|
421
|
+
CallExpression(node) {
|
|
422
|
+
if (node.callee.type !== import_utils2.AST_NODE_TYPES.MemberExpression) {
|
|
423
|
+
return;
|
|
427
424
|
}
|
|
428
|
-
|
|
429
|
-
|
|
425
|
+
if (getMemberPropertyName(node.callee) !== "bypassSecurityTrustHtml") {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
context.report({
|
|
429
|
+
messageId: "default",
|
|
430
|
+
node
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
}),
|
|
430
434
|
meta: {
|
|
431
435
|
deprecated: false,
|
|
432
436
|
docs: {
|
|
@@ -449,38 +453,36 @@ var no_angular_bypass_security_trust_html_default = rule2;
|
|
|
449
453
|
var import_ts_extras = require("ts-extras");
|
|
450
454
|
var hasInnerHtmlBindingPattern = (text) => /\[\s*innerhtml\s*\]\s*=/iv.test(text);
|
|
451
455
|
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
|
-
});
|
|
456
|
+
create: (context) => ({
|
|
457
|
+
Literal(node) {
|
|
458
|
+
if (typeof node.value !== "string") {
|
|
459
|
+
return;
|
|
481
460
|
}
|
|
482
|
-
|
|
483
|
-
|
|
461
|
+
if (!hasInnerHtmlBindingPattern(node.value)) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
context.report({
|
|
465
|
+
messageId: "default",
|
|
466
|
+
node
|
|
467
|
+
});
|
|
468
|
+
},
|
|
469
|
+
TemplateLiteral(node) {
|
|
470
|
+
if (node.expressions.length > 0) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
const templateValue = (0, import_ts_extras.arrayFirst)(node.quasis)?.value.cooked;
|
|
474
|
+
if (typeof templateValue !== "string") {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
if (!hasInnerHtmlBindingPattern(templateValue)) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
context.report({
|
|
481
|
+
messageId: "default",
|
|
482
|
+
node
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
}),
|
|
484
486
|
meta: {
|
|
485
487
|
deprecated: false,
|
|
486
488
|
docs: {
|
|
@@ -501,16 +503,14 @@ var no_angular_innerhtml_binding_default = rule3;
|
|
|
501
503
|
|
|
502
504
|
// dist/rules/no-angular-sanitization-trusted-urls.js
|
|
503
505
|
var rule4 = createRule({
|
|
504
|
-
create(context) {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
};
|
|
513
|
-
},
|
|
506
|
+
create: (context) => ({
|
|
507
|
+
"CallExpression[arguments.length>0][callee.object.name='$compileProvider'][callee.property.name=/^(?:aHref|imgSrc)SanitizationTrustedUrlList$/]"(node) {
|
|
508
|
+
context.report({
|
|
509
|
+
messageId: "noSanitizationTrustedUrls",
|
|
510
|
+
node
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
}),
|
|
514
514
|
meta: {
|
|
515
515
|
deprecated: false,
|
|
516
516
|
docs: {
|
|
@@ -653,44 +653,42 @@ var import_ts_extras4 = require("ts-extras");
|
|
|
653
653
|
var hasNgBindHtmlPattern = (text) => /\bng-bind-html\b/iv.test(text);
|
|
654
654
|
var hasKnownSanitizePattern = (text) => /\b(?:ngsanitize|\$sanitize|sanitize)\b/iv.test(text);
|
|
655
655
|
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
|
-
});
|
|
656
|
+
create: (context) => ({
|
|
657
|
+
Literal(node) {
|
|
658
|
+
if (typeof node.value !== "string") {
|
|
659
|
+
return;
|
|
691
660
|
}
|
|
692
|
-
|
|
693
|
-
|
|
661
|
+
if (!hasNgBindHtmlPattern(node.value)) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
if (hasKnownSanitizePattern(node.value)) {
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
context.report({
|
|
668
|
+
messageId: "default",
|
|
669
|
+
node
|
|
670
|
+
});
|
|
671
|
+
},
|
|
672
|
+
TemplateLiteral(node) {
|
|
673
|
+
if (node.expressions.length > 0) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
const templateValue = (0, import_ts_extras4.arrayFirst)(node.quasis)?.value.cooked;
|
|
677
|
+
if (typeof templateValue !== "string") {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
if (!hasNgBindHtmlPattern(templateValue)) {
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
if (hasKnownSanitizePattern(templateValue)) {
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
context.report({
|
|
687
|
+
messageId: "default",
|
|
688
|
+
node
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
}),
|
|
694
692
|
meta: {
|
|
695
693
|
deprecated: false,
|
|
696
694
|
docs: {
|
|
@@ -711,16 +709,14 @@ var no_angularjs_ng_bind_html_without_sanitize_default = rule6;
|
|
|
711
709
|
|
|
712
710
|
// dist/rules/no-angularjs-sanitization-whitelist.js
|
|
713
711
|
var rule7 = createRule({
|
|
714
|
-
create(context) {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
};
|
|
723
|
-
},
|
|
712
|
+
create: (context) => ({
|
|
713
|
+
"CallExpression[arguments.length>0][callee.object.name='$compileProvider'][callee.property.name=/^(?:aHref|imgSrc)SanitizationWhitelist$/]"(node) {
|
|
714
|
+
context.report({
|
|
715
|
+
messageId: "noSanitizationWhitelist",
|
|
716
|
+
node
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
}),
|
|
724
720
|
meta: {
|
|
725
721
|
deprecated: false,
|
|
726
722
|
docs: {
|
|
@@ -1261,6 +1257,7 @@ var no_document_execcommand_insert_html_default = rule13;
|
|
|
1261
1257
|
|
|
1262
1258
|
// dist/rules/no-document-parse-html-unsafe.js
|
|
1263
1259
|
var import_utils12 = require("@typescript-eslint/utils");
|
|
1260
|
+
var import_ts_extras8 = require("ts-extras");
|
|
1264
1261
|
var isDocumentConstructorReference = (expression) => {
|
|
1265
1262
|
if (expression.type === import_utils12.AST_NODE_TYPES.Identifier) {
|
|
1266
1263
|
return expression.name === "Document";
|
|
@@ -1271,7 +1268,11 @@ var isDocumentConstructorReference = (expression) => {
|
|
|
1271
1268
|
if (getMemberPropertyName3(expression) !== "Document") {
|
|
1272
1269
|
return false;
|
|
1273
1270
|
}
|
|
1274
|
-
return expression.object.type === import_utils12.AST_NODE_TYPES.Identifier && (
|
|
1271
|
+
return expression.object.type === import_utils12.AST_NODE_TYPES.Identifier && (0, import_ts_extras8.arrayIncludes)([
|
|
1272
|
+
"globalThis",
|
|
1273
|
+
"self",
|
|
1274
|
+
"window"
|
|
1275
|
+
], expression.object.name);
|
|
1275
1276
|
};
|
|
1276
1277
|
var isDocumentParseHtmlUnsafeCall = (node) => {
|
|
1277
1278
|
if (node.callee.type !== import_utils12.AST_NODE_TYPES.MemberExpression) {
|
|
@@ -1358,7 +1359,7 @@ var no_document_write_default = rule15;
|
|
|
1358
1359
|
|
|
1359
1360
|
// dist/rules/no-domparser-html-without-sanitization.js
|
|
1360
1361
|
var import_utils15 = require("@typescript-eslint/utils");
|
|
1361
|
-
var
|
|
1362
|
+
var import_ts_extras9 = require("ts-extras");
|
|
1362
1363
|
|
|
1363
1364
|
// dist/_internal/domparser.js
|
|
1364
1365
|
var import_utils14 = require("@typescript-eslint/utils");
|
|
@@ -1401,7 +1402,7 @@ var rule16 = createRule({
|
|
|
1401
1402
|
return;
|
|
1402
1403
|
}
|
|
1403
1404
|
const [firstArgument, secondArgument] = node.arguments;
|
|
1404
|
-
if (!(0,
|
|
1405
|
+
if (!(0, import_ts_extras9.isDefined)(firstArgument) || !(0, import_ts_extras9.isDefined)(secondArgument)) {
|
|
1405
1406
|
return;
|
|
1406
1407
|
}
|
|
1407
1408
|
if (firstArgument.type === import_utils15.AST_NODE_TYPES.SpreadElement || secondArgument.type === import_utils15.AST_NODE_TYPES.SpreadElement) {
|
|
@@ -1441,7 +1442,7 @@ var no_domparser_html_without_sanitization_default = rule16;
|
|
|
1441
1442
|
|
|
1442
1443
|
// dist/rules/no-domparser-svg-without-sanitization.js
|
|
1443
1444
|
var import_utils16 = require("@typescript-eslint/utils");
|
|
1444
|
-
var
|
|
1445
|
+
var import_ts_extras10 = require("ts-extras");
|
|
1445
1446
|
var rule17 = createRule({
|
|
1446
1447
|
create(context) {
|
|
1447
1448
|
return {
|
|
@@ -1453,7 +1454,7 @@ var rule17 = createRule({
|
|
|
1453
1454
|
return;
|
|
1454
1455
|
}
|
|
1455
1456
|
const [firstArgument, secondArgument] = node.arguments;
|
|
1456
|
-
if (!(0,
|
|
1457
|
+
if (!(0, import_ts_extras10.isDefined)(firstArgument) || !(0, import_ts_extras10.isDefined)(secondArgument)) {
|
|
1457
1458
|
return;
|
|
1458
1459
|
}
|
|
1459
1460
|
if (firstArgument.type === import_utils16.AST_NODE_TYPES.SpreadElement || secondArgument.type === import_utils16.AST_NODE_TYPES.SpreadElement) {
|
|
@@ -1493,7 +1494,7 @@ var no_domparser_svg_without_sanitization_default = rule17;
|
|
|
1493
1494
|
|
|
1494
1495
|
// dist/_internal/worker-code-loading.js
|
|
1495
1496
|
var import_utils17 = require("@typescript-eslint/utils");
|
|
1496
|
-
var
|
|
1497
|
+
var import_ts_extras11 = require("ts-extras");
|
|
1497
1498
|
var WORKER_CONSTRUCTOR_NAMES = /* @__PURE__ */ new Set(["SharedWorker", "Worker"]);
|
|
1498
1499
|
var GLOBAL_OBJECT_NAMES = /* @__PURE__ */ new Set([
|
|
1499
1500
|
"globalThis",
|
|
@@ -1507,12 +1508,12 @@ var isNavigatorObject = (value) => {
|
|
|
1507
1508
|
if (value.type !== import_utils17.AST_NODE_TYPES.MemberExpression) {
|
|
1508
1509
|
return false;
|
|
1509
1510
|
}
|
|
1510
|
-
return getMemberPropertyName3(value) === "navigator" && value.object.type === import_utils17.AST_NODE_TYPES.Identifier && (0,
|
|
1511
|
+
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
1512
|
};
|
|
1512
1513
|
var isBlobUrl = (value) => /^\s*blob:/iv.test(value);
|
|
1513
1514
|
var isDataUrl = (value) => /^\s*data:/iv.test(value);
|
|
1514
|
-
var isWorkerConstructorName = (value) => (0,
|
|
1515
|
-
var isGlobalObjectName = (value) => (0,
|
|
1515
|
+
var isWorkerConstructorName = (value) => (0, import_ts_extras11.isDefined)(value) && (0, import_ts_extras11.setHas)(WORKER_CONSTRUCTOR_NAMES, value);
|
|
1516
|
+
var isGlobalObjectName = (value) => (0, import_ts_extras11.setHas)(GLOBAL_OBJECT_NAMES, value);
|
|
1516
1517
|
var isWorkerGlobalObject = (value) => value.type === import_utils17.AST_NODE_TYPES.Identifier && isGlobalObjectName(value.name);
|
|
1517
1518
|
var isWorkerConstructor = (callee) => {
|
|
1518
1519
|
if (callee.type === import_utils17.AST_NODE_TYPES.Identifier) {
|
|
@@ -1562,19 +1563,17 @@ var isUnsafeDynamicImportSource = (expression) => {
|
|
|
1562
1563
|
return typeof configuredValue === "string" && (isBlobUrl(configuredValue) || isDataUrl(configuredValue) || isJavaScriptUrl(configuredValue)) || isUrlCreateObjectUrlCall(expression);
|
|
1563
1564
|
};
|
|
1564
1565
|
var rule18 = createRule({
|
|
1565
|
-
create(context) {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
return;
|
|
1570
|
-
}
|
|
1571
|
-
context.report({
|
|
1572
|
-
messageId: "default",
|
|
1573
|
-
node: node.source
|
|
1574
|
-
});
|
|
1566
|
+
create: (context) => ({
|
|
1567
|
+
ImportExpression(node) {
|
|
1568
|
+
if (!isUnsafeDynamicImportSource(node.source)) {
|
|
1569
|
+
return;
|
|
1575
1570
|
}
|
|
1576
|
-
|
|
1577
|
-
|
|
1571
|
+
context.report({
|
|
1572
|
+
messageId: "default",
|
|
1573
|
+
node: node.source
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
}),
|
|
1578
1577
|
meta: {
|
|
1579
1578
|
deprecated: false,
|
|
1580
1579
|
docs: {
|
|
@@ -1641,9 +1640,7 @@ var createElectronWebPreferencesBooleanListener = (context, check) => ({
|
|
|
1641
1640
|
return;
|
|
1642
1641
|
}
|
|
1643
1642
|
context.report({
|
|
1644
|
-
fix(fixer)
|
|
1645
|
-
return fixer.replaceText(preferenceValueNode, String(!check.disallowedValue));
|
|
1646
|
-
},
|
|
1643
|
+
fix: (fixer) => fixer.replaceText(preferenceValueNode, String(!check.disallowedValue)),
|
|
1647
1644
|
messageId: "default",
|
|
1648
1645
|
node: preferenceProperty
|
|
1649
1646
|
});
|
|
@@ -1652,12 +1649,10 @@ var createElectronWebPreferencesBooleanListener = (context, check) => ({
|
|
|
1652
1649
|
|
|
1653
1650
|
// dist/rules/no-electron-allow-running-insecure-content.js
|
|
1654
1651
|
var rule19 = createRule({
|
|
1655
|
-
create(context) {
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
});
|
|
1660
|
-
},
|
|
1652
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1653
|
+
disallowedValue: true,
|
|
1654
|
+
preferenceName: "allowRunningInsecureContent"
|
|
1655
|
+
}),
|
|
1661
1656
|
meta: {
|
|
1662
1657
|
deprecated: false,
|
|
1663
1658
|
docs: {
|
|
@@ -1679,7 +1674,7 @@ var no_electron_allow_running_insecure_content_default = rule19;
|
|
|
1679
1674
|
|
|
1680
1675
|
// dist/rules/no-electron-dangerous-blink-features.js
|
|
1681
1676
|
var import_utils19 = require("@typescript-eslint/utils");
|
|
1682
|
-
var
|
|
1677
|
+
var import_ts_extras12 = require("ts-extras");
|
|
1683
1678
|
var getPropertyName3 = (property) => {
|
|
1684
1679
|
if (property.computed) {
|
|
1685
1680
|
return void 0;
|
|
@@ -1705,7 +1700,7 @@ var getStaticStringValue2 = (node) => {
|
|
|
1705
1700
|
return node.value;
|
|
1706
1701
|
}
|
|
1707
1702
|
if (node.type === import_utils19.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
1708
|
-
return (0,
|
|
1703
|
+
return (0, import_ts_extras12.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
1709
1704
|
}
|
|
1710
1705
|
return void 0;
|
|
1711
1706
|
};
|
|
@@ -1762,12 +1757,10 @@ var no_electron_dangerous_blink_features_default = rule20;
|
|
|
1762
1757
|
|
|
1763
1758
|
// dist/rules/no-electron-disable-context-isolation.js
|
|
1764
1759
|
var rule21 = createRule({
|
|
1765
|
-
create(context) {
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
});
|
|
1770
|
-
},
|
|
1760
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1761
|
+
disallowedValue: false,
|
|
1762
|
+
preferenceName: "contextIsolation"
|
|
1763
|
+
}),
|
|
1771
1764
|
meta: {
|
|
1772
1765
|
deprecated: false,
|
|
1773
1766
|
docs: {
|
|
@@ -1789,12 +1782,10 @@ var no_electron_disable_context_isolation_default = rule21;
|
|
|
1789
1782
|
|
|
1790
1783
|
// dist/rules/no-electron-disable-sandbox.js
|
|
1791
1784
|
var rule22 = createRule({
|
|
1792
|
-
create(context) {
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
});
|
|
1797
|
-
},
|
|
1785
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1786
|
+
disallowedValue: false,
|
|
1787
|
+
preferenceName: "sandbox"
|
|
1788
|
+
}),
|
|
1798
1789
|
meta: {
|
|
1799
1790
|
deprecated: false,
|
|
1800
1791
|
docs: {
|
|
@@ -1816,12 +1807,10 @@ var no_electron_disable_sandbox_default = rule22;
|
|
|
1816
1807
|
|
|
1817
1808
|
// dist/rules/no-electron-disable-web-security.js
|
|
1818
1809
|
var rule23 = createRule({
|
|
1819
|
-
create(context) {
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
});
|
|
1824
|
-
},
|
|
1810
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1811
|
+
disallowedValue: false,
|
|
1812
|
+
preferenceName: "webSecurity"
|
|
1813
|
+
}),
|
|
1825
1814
|
meta: {
|
|
1826
1815
|
deprecated: false,
|
|
1827
1816
|
docs: {
|
|
@@ -1843,12 +1832,10 @@ var no_electron_disable_web_security_default = rule23;
|
|
|
1843
1832
|
|
|
1844
1833
|
// dist/rules/no-electron-enable-remote-module.js
|
|
1845
1834
|
var rule24 = createRule({
|
|
1846
|
-
create(context) {
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
});
|
|
1851
|
-
},
|
|
1835
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1836
|
+
disallowedValue: true,
|
|
1837
|
+
preferenceName: "enableRemoteModule"
|
|
1838
|
+
}),
|
|
1852
1839
|
meta: {
|
|
1853
1840
|
deprecated: false,
|
|
1854
1841
|
docs: {
|
|
@@ -1870,12 +1857,10 @@ var no_electron_enable_remote_module_default = rule24;
|
|
|
1870
1857
|
|
|
1871
1858
|
// dist/rules/no-electron-enable-webview-tag.js
|
|
1872
1859
|
var rule25 = createRule({
|
|
1873
|
-
create(context) {
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
});
|
|
1878
|
-
},
|
|
1860
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1861
|
+
disallowedValue: true,
|
|
1862
|
+
preferenceName: "webviewTag"
|
|
1863
|
+
}),
|
|
1879
1864
|
meta: {
|
|
1880
1865
|
deprecated: false,
|
|
1881
1866
|
docs: {
|
|
@@ -1897,12 +1882,10 @@ var no_electron_enable_webview_tag_default = rule25;
|
|
|
1897
1882
|
|
|
1898
1883
|
// dist/rules/no-electron-experimental-features.js
|
|
1899
1884
|
var rule26 = createRule({
|
|
1900
|
-
create(context) {
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
});
|
|
1905
|
-
},
|
|
1885
|
+
create: (context) => createElectronWebPreferencesBooleanListener(context, {
|
|
1886
|
+
disallowedValue: true,
|
|
1887
|
+
preferenceName: "experimentalFeatures"
|
|
1888
|
+
}),
|
|
1906
1889
|
meta: {
|
|
1907
1890
|
deprecated: false,
|
|
1908
1891
|
docs: {
|
|
@@ -2017,13 +2000,13 @@ var no_electron_expose_raw_ipc_renderer_default = rule27;
|
|
|
2017
2000
|
|
|
2018
2001
|
// dist/rules/no-electron-insecure-certificate-error-handler.js
|
|
2019
2002
|
var import_utils21 = require("@typescript-eslint/utils");
|
|
2020
|
-
var
|
|
2003
|
+
var import_ts_extras13 = require("ts-extras");
|
|
2021
2004
|
var getStaticStringValue3 = (node) => {
|
|
2022
2005
|
if (node.type === import_utils21.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
2023
2006
|
return node.value;
|
|
2024
2007
|
}
|
|
2025
2008
|
if (node.type === import_utils21.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
2026
|
-
return (0,
|
|
2009
|
+
return (0, import_ts_extras13.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
2027
2010
|
}
|
|
2028
2011
|
return void 0;
|
|
2029
2012
|
};
|
|
@@ -2034,7 +2017,7 @@ var isOnMemberExpression = (callee) => {
|
|
|
2034
2017
|
return callee.property.type === import_utils21.AST_NODE_TYPES.Identifier && callee.property.name === "on";
|
|
2035
2018
|
};
|
|
2036
2019
|
var getCallbackParameterName = (node) => {
|
|
2037
|
-
const callbackParameter = (0,
|
|
2020
|
+
const callbackParameter = (0, import_ts_extras13.arrayAt)(node.params, -1);
|
|
2038
2021
|
return callbackParameter?.type === import_utils21.AST_NODE_TYPES.Identifier ? callbackParameter.name : void 0;
|
|
2039
2022
|
};
|
|
2040
2023
|
var toUnsafeCallbackTruePattern = (callbackName) => (
|
|
@@ -2103,7 +2086,7 @@ var no_electron_insecure_certificate_error_handler_default = rule28;
|
|
|
2103
2086
|
|
|
2104
2087
|
// dist/rules/no-electron-insecure-certificate-verify-proc.js
|
|
2105
2088
|
var import_utils22 = require("@typescript-eslint/utils");
|
|
2106
|
-
var
|
|
2089
|
+
var import_ts_extras14 = require("ts-extras");
|
|
2107
2090
|
var getMemberPropertyName6 = (memberExpression) => {
|
|
2108
2091
|
if (!memberExpression.computed && memberExpression.property.type === import_utils22.AST_NODE_TYPES.Identifier) {
|
|
2109
2092
|
return memberExpression.property.name;
|
|
@@ -2139,7 +2122,7 @@ var rule29 = createRule({
|
|
|
2139
2122
|
if (firstArgument === void 0 || firstArgument.type === import_utils22.AST_NODE_TYPES.SpreadElement || !isFunctionExpression(firstArgument)) {
|
|
2140
2123
|
return;
|
|
2141
2124
|
}
|
|
2142
|
-
const callbackParameter = (0,
|
|
2125
|
+
const callbackParameter = (0, import_ts_extras14.arrayAt)(firstArgument.params, -1);
|
|
2143
2126
|
if (callbackParameter?.type !== import_utils22.AST_NODE_TYPES.Identifier) {
|
|
2144
2127
|
return;
|
|
2145
2128
|
}
|
|
@@ -2173,7 +2156,7 @@ var no_electron_insecure_certificate_verify_proc_default = rule29;
|
|
|
2173
2156
|
|
|
2174
2157
|
// dist/rules/no-electron-insecure-permission-request-handler.js
|
|
2175
2158
|
var import_utils23 = require("@typescript-eslint/utils");
|
|
2176
|
-
var
|
|
2159
|
+
var import_ts_extras15 = require("ts-extras");
|
|
2177
2160
|
var getMemberPropertyName7 = (memberExpression) => {
|
|
2178
2161
|
if (!memberExpression.computed && memberExpression.property.type === import_utils23.AST_NODE_TYPES.Identifier) {
|
|
2179
2162
|
return memberExpression.property.name;
|
|
@@ -2209,7 +2192,7 @@ var rule30 = createRule({
|
|
|
2209
2192
|
if (firstArgument === void 0 || firstArgument.type === import_utils23.AST_NODE_TYPES.SpreadElement || !isFunctionExpression2(firstArgument)) {
|
|
2210
2193
|
return;
|
|
2211
2194
|
}
|
|
2212
|
-
const callbackParameter = (0,
|
|
2195
|
+
const callbackParameter = (0, import_ts_extras15.arrayAt)(firstArgument.params, -1);
|
|
2213
2196
|
if (callbackParameter?.type !== import_utils23.AST_NODE_TYPES.Identifier) {
|
|
2214
2197
|
return;
|
|
2215
2198
|
}
|
|
@@ -2243,35 +2226,33 @@ var no_electron_insecure_permission_request_handler_default = rule30;
|
|
|
2243
2226
|
|
|
2244
2227
|
// dist/rules/no-electron-node-integration.js
|
|
2245
2228
|
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
|
-
},
|
|
2229
|
+
create: (context) => ({
|
|
2230
|
+
"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) {
|
|
2231
|
+
context.report({
|
|
2232
|
+
fix(fixer) {
|
|
2233
|
+
const propertyText = context.sourceCode.getText(node);
|
|
2234
|
+
const separatorIndex = propertyText.indexOf(":");
|
|
2235
|
+
if (separatorIndex === -1) {
|
|
2236
|
+
return null;
|
|
2237
|
+
}
|
|
2238
|
+
const valuePortion = propertyText.slice(separatorIndex + 1);
|
|
2239
|
+
const trimmedValuePortion = valuePortion.trimStart();
|
|
2240
|
+
if (!trimmedValuePortion.startsWith("true")) {
|
|
2241
|
+
return null;
|
|
2242
|
+
}
|
|
2243
|
+
const leadingWhitespaceLength = valuePortion.length - trimmedValuePortion.length;
|
|
2244
|
+
const nextValuePortion = `${valuePortion.slice(0, leadingWhitespaceLength)}false${trimmedValuePortion.slice("true".length)}`;
|
|
2245
|
+
const nextPropertyText = `${propertyText.slice(0, separatorIndex + 1)}${nextValuePortion}`;
|
|
2246
|
+
if (nextPropertyText === propertyText) {
|
|
2247
|
+
return null;
|
|
2248
|
+
}
|
|
2249
|
+
return fixer.replaceText(node, nextPropertyText);
|
|
2250
|
+
},
|
|
2251
|
+
messageId: "default",
|
|
2252
|
+
node
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
}),
|
|
2275
2256
|
meta: {
|
|
2276
2257
|
deprecated: false,
|
|
2277
2258
|
docs: {
|
|
@@ -2293,7 +2274,7 @@ var no_electron_node_integration_default = rule31;
|
|
|
2293
2274
|
|
|
2294
2275
|
// dist/rules/no-electron-permission-check-handler-allow-all.js
|
|
2295
2276
|
var import_utils24 = require("@typescript-eslint/utils");
|
|
2296
|
-
var
|
|
2277
|
+
var import_ts_extras16 = require("ts-extras");
|
|
2297
2278
|
var isFunctionExpression3 = (expression) => expression.type === import_utils24.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils24.AST_NODE_TYPES.FunctionExpression;
|
|
2298
2279
|
var isBooleanTrueLiteral = (expression) => expression?.type === import_utils24.AST_NODE_TYPES.Literal && expression.value === true;
|
|
2299
2280
|
var isAllowAllPermissionCheckHandler = (callbackNode) => {
|
|
@@ -2303,7 +2284,7 @@ var isAllowAllPermissionCheckHandler = (callbackNode) => {
|
|
|
2303
2284
|
if (callbackNode.body.body.length !== 1) {
|
|
2304
2285
|
return false;
|
|
2305
2286
|
}
|
|
2306
|
-
const onlyStatement = (0,
|
|
2287
|
+
const onlyStatement = (0, import_ts_extras16.arrayFirst)(callbackNode.body.body);
|
|
2307
2288
|
return onlyStatement?.type === import_utils24.AST_NODE_TYPES.ReturnStatement && isBooleanTrueLiteral(onlyStatement.argument);
|
|
2308
2289
|
};
|
|
2309
2290
|
var rule32 = createRule({
|
|
@@ -2347,7 +2328,7 @@ var no_electron_permission_check_handler_allow_all_default = rule32;
|
|
|
2347
2328
|
|
|
2348
2329
|
// dist/rules/no-electron-unchecked-ipc-sender.js
|
|
2349
2330
|
var import_utils25 = require("@typescript-eslint/utils");
|
|
2350
|
-
var
|
|
2331
|
+
var import_ts_extras17 = require("ts-extras");
|
|
2351
2332
|
var getMemberPropertyName8 = (memberExpression) => {
|
|
2352
2333
|
if (!memberExpression.computed && memberExpression.property.type === import_utils25.AST_NODE_TYPES.Identifier) {
|
|
2353
2334
|
return memberExpression.property.name;
|
|
@@ -2399,7 +2380,7 @@ var rule33 = createRule({
|
|
|
2399
2380
|
if (handlerNode === void 0 || handlerNode.type === import_utils25.AST_NODE_TYPES.SpreadElement || !isFunctionExpression4(handlerNode)) {
|
|
2400
2381
|
return;
|
|
2401
2382
|
}
|
|
2402
|
-
const eventParameter = (0,
|
|
2383
|
+
const eventParameter = (0, import_ts_extras17.arrayFirst)(handlerNode.params);
|
|
2403
2384
|
if (eventParameter?.type !== import_utils25.AST_NODE_TYPES.Identifier) {
|
|
2404
2385
|
return;
|
|
2405
2386
|
}
|
|
@@ -2433,7 +2414,7 @@ var no_electron_unchecked_ipc_sender_default = rule33;
|
|
|
2433
2414
|
|
|
2434
2415
|
// dist/rules/no-electron-unrestricted-navigation.js
|
|
2435
2416
|
var import_utils26 = require("@typescript-eslint/utils");
|
|
2436
|
-
var
|
|
2417
|
+
var import_ts_extras18 = require("ts-extras");
|
|
2437
2418
|
var getMemberPropertyName9 = (memberExpression) => {
|
|
2438
2419
|
if (!memberExpression.computed && memberExpression.property.type === import_utils26.AST_NODE_TYPES.Identifier) {
|
|
2439
2420
|
return memberExpression.property.name;
|
|
@@ -2490,7 +2471,7 @@ var rule34 = createRule({
|
|
|
2490
2471
|
if (firstArgument.type !== import_utils26.AST_NODE_TYPES.Literal || firstArgument.value !== "will-navigate") {
|
|
2491
2472
|
return;
|
|
2492
2473
|
}
|
|
2493
|
-
const eventParameter = (0,
|
|
2474
|
+
const eventParameter = (0, import_ts_extras18.arrayFirst)(secondArgument.params);
|
|
2494
2475
|
if (eventParameter?.type !== import_utils26.AST_NODE_TYPES.Identifier) {
|
|
2495
2476
|
return;
|
|
2496
2477
|
}
|
|
@@ -2524,12 +2505,12 @@ var no_electron_unrestricted_navigation_default = rule34;
|
|
|
2524
2505
|
|
|
2525
2506
|
// dist/rules/no-electron-untrusted-open-external.js
|
|
2526
2507
|
var import_utils27 = require("@typescript-eslint/utils");
|
|
2527
|
-
var
|
|
2508
|
+
var import_ts_extras19 = require("ts-extras");
|
|
2528
2509
|
var getStaticTemplateLiteralValue = (templateLiteral) => {
|
|
2529
2510
|
if (templateLiteral.expressions.length > 0) {
|
|
2530
2511
|
return void 0;
|
|
2531
2512
|
}
|
|
2532
|
-
return (0,
|
|
2513
|
+
return (0, import_ts_extras19.arrayFirst)(templateLiteral.quasis)?.value.cooked ?? void 0;
|
|
2533
2514
|
};
|
|
2534
2515
|
var getStringValue = (node) => {
|
|
2535
2516
|
if (node.type === import_utils27.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
@@ -2644,33 +2625,29 @@ var isTruthyJsxAttributeValue = (attributeValue) => {
|
|
|
2644
2625
|
return true;
|
|
2645
2626
|
};
|
|
2646
2627
|
var rule36 = createRule({
|
|
2647
|
-
create(context) {
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2628
|
+
create: (context) => ({
|
|
2629
|
+
JSXOpeningElement(node) {
|
|
2630
|
+
if (!isJsxWebviewElement(node)) {
|
|
2631
|
+
return;
|
|
2632
|
+
}
|
|
2633
|
+
for (const attributeNode of node.attributes) {
|
|
2634
|
+
if (attributeNode.type !== import_utils28.AST_NODE_TYPES.JSXAttribute) {
|
|
2635
|
+
continue;
|
|
2652
2636
|
}
|
|
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
|
-
});
|
|
2637
|
+
if (getJsxAttributeName(attributeNode) !== "allowpopups") {
|
|
2638
|
+
continue;
|
|
2639
|
+
}
|
|
2640
|
+
if (!isTruthyJsxAttributeValue(attributeNode.value)) {
|
|
2641
|
+
continue;
|
|
2670
2642
|
}
|
|
2643
|
+
context.report({
|
|
2644
|
+
fix: (fixer) => fixer.remove(attributeNode),
|
|
2645
|
+
messageId: "default",
|
|
2646
|
+
node: attributeNode
|
|
2647
|
+
});
|
|
2671
2648
|
}
|
|
2672
|
-
}
|
|
2673
|
-
},
|
|
2649
|
+
}
|
|
2650
|
+
}),
|
|
2674
2651
|
meta: {
|
|
2675
2652
|
deprecated: false,
|
|
2676
2653
|
docs: {
|
|
@@ -2692,7 +2669,7 @@ var no_electron_webview_allowpopups_default = rule36;
|
|
|
2692
2669
|
|
|
2693
2670
|
// dist/rules/no-electron-webview-insecure-webpreferences.js
|
|
2694
2671
|
var import_utils29 = require("@typescript-eslint/utils");
|
|
2695
|
-
var
|
|
2672
|
+
var import_ts_extras20 = require("ts-extras");
|
|
2696
2673
|
var UNSAFE_WEBPREFERENCES_PATTERNS = [
|
|
2697
2674
|
{
|
|
2698
2675
|
flagName: "allowRunningInsecureContent",
|
|
@@ -2724,38 +2701,36 @@ var getJsxAttributeName2 = (attributeNode) => {
|
|
|
2724
2701
|
};
|
|
2725
2702
|
var getUnsafeWebPreferencesFlags = (attributeValue) => UNSAFE_WEBPREFERENCES_PATTERNS.flatMap(({ flagName, pattern }) => pattern.test(attributeValue) ? [flagName] : []);
|
|
2726
2703
|
var rule37 = createRule({
|
|
2727
|
-
create(context) {
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2704
|
+
create: (context) => ({
|
|
2705
|
+
JSXOpeningElement(node) {
|
|
2706
|
+
if (!isJsxWebviewElement2(node)) {
|
|
2707
|
+
return;
|
|
2708
|
+
}
|
|
2709
|
+
for (const attributeNode of node.attributes) {
|
|
2710
|
+
if (attributeNode.type !== import_utils29.AST_NODE_TYPES.JSXAttribute) {
|
|
2711
|
+
continue;
|
|
2732
2712
|
}
|
|
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
|
-
});
|
|
2713
|
+
if (getJsxAttributeName2(attributeNode) !== "webpreferences") {
|
|
2714
|
+
continue;
|
|
2715
|
+
}
|
|
2716
|
+
const staticValue = getStaticJsxAttributeStringValue(attributeNode.value);
|
|
2717
|
+
if (typeof staticValue !== "string") {
|
|
2718
|
+
continue;
|
|
2719
|
+
}
|
|
2720
|
+
const unsafeFlags = getUnsafeWebPreferencesFlags(staticValue);
|
|
2721
|
+
if ((0, import_ts_extras20.isEmpty)(unsafeFlags)) {
|
|
2722
|
+
continue;
|
|
2755
2723
|
}
|
|
2724
|
+
context.report({
|
|
2725
|
+
data: {
|
|
2726
|
+
flags: (0, import_ts_extras20.arrayJoin)(unsafeFlags, ", ")
|
|
2727
|
+
},
|
|
2728
|
+
messageId: "default",
|
|
2729
|
+
node: attributeNode
|
|
2730
|
+
});
|
|
2756
2731
|
}
|
|
2757
|
-
}
|
|
2758
|
-
},
|
|
2732
|
+
}
|
|
2733
|
+
}),
|
|
2759
2734
|
meta: {
|
|
2760
2735
|
deprecated: false,
|
|
2761
2736
|
docs: {
|
|
@@ -2808,7 +2783,7 @@ var isTruthyJsxAttributeValue2 = (attributeValue) => {
|
|
|
2808
2783
|
}
|
|
2809
2784
|
return true;
|
|
2810
2785
|
};
|
|
2811
|
-
var
|
|
2786
|
+
var hasNodeIntegrationWebPreference = (attributeValue) => {
|
|
2812
2787
|
if (attributeValue === null) {
|
|
2813
2788
|
return false;
|
|
2814
2789
|
}
|
|
@@ -2818,44 +2793,40 @@ var webPreferencesHasNodeIntegration = (attributeValue) => {
|
|
|
2818
2793
|
return false;
|
|
2819
2794
|
};
|
|
2820
2795
|
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)) {
|
|
2796
|
+
create: (context) => ({
|
|
2797
|
+
JSXOpeningElement(node) {
|
|
2798
|
+
if (!isJsxWebviewElement3(node)) {
|
|
2799
|
+
return;
|
|
2800
|
+
}
|
|
2801
|
+
for (const attributeNode of node.attributes) {
|
|
2802
|
+
if (attributeNode.type !== import_utils30.AST_NODE_TYPES.JSXAttribute) {
|
|
2803
|
+
continue;
|
|
2804
|
+
}
|
|
2805
|
+
const attributeName = getJsxAttributeName3(attributeNode);
|
|
2806
|
+
if (isNodeIntegrationAttribute(attributeName)) {
|
|
2807
|
+
if (!isTruthyJsxAttributeValue2(attributeNode.value)) {
|
|
2849
2808
|
continue;
|
|
2850
2809
|
}
|
|
2851
2810
|
context.report({
|
|
2811
|
+
fix: (fixer) => fixer.remove(attributeNode),
|
|
2852
2812
|
messageId: "default",
|
|
2853
2813
|
node: attributeNode
|
|
2854
2814
|
});
|
|
2815
|
+
continue;
|
|
2816
|
+
}
|
|
2817
|
+
if (attributeName !== "webpreferences") {
|
|
2818
|
+
continue;
|
|
2855
2819
|
}
|
|
2820
|
+
if (!hasNodeIntegrationWebPreference(attributeNode.value)) {
|
|
2821
|
+
continue;
|
|
2822
|
+
}
|
|
2823
|
+
context.report({
|
|
2824
|
+
messageId: "default",
|
|
2825
|
+
node: attributeNode
|
|
2826
|
+
});
|
|
2856
2827
|
}
|
|
2857
|
-
}
|
|
2858
|
-
},
|
|
2828
|
+
}
|
|
2829
|
+
}),
|
|
2859
2830
|
meta: {
|
|
2860
2831
|
deprecated: false,
|
|
2861
2832
|
docs: {
|
|
@@ -2916,7 +2887,7 @@ var no_html_method_default = rule39;
|
|
|
2916
2887
|
|
|
2917
2888
|
// dist/rules/no-http-request-to-insecure-protocol.js
|
|
2918
2889
|
var import_utils32 = require("@typescript-eslint/utils");
|
|
2919
|
-
var
|
|
2890
|
+
var import_ts_extras21 = require("ts-extras");
|
|
2920
2891
|
var getMemberPropertyName11 = (memberExpression) => {
|
|
2921
2892
|
if (!memberExpression.computed && memberExpression.property.type === import_utils32.AST_NODE_TYPES.Identifier) {
|
|
2922
2893
|
return memberExpression.property.name;
|
|
@@ -2931,7 +2902,7 @@ var getStaticStringValue4 = (node) => {
|
|
|
2931
2902
|
return node.value;
|
|
2932
2903
|
}
|
|
2933
2904
|
if (node.type === import_utils32.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
2934
|
-
return (0,
|
|
2905
|
+
return (0, import_ts_extras21.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
2935
2906
|
}
|
|
2936
2907
|
return void 0;
|
|
2937
2908
|
};
|
|
@@ -3139,7 +3110,7 @@ var isEmptyStringLiteral = (node) => node.type === import_utils34.AST_NODE_TYPES
|
|
|
3139
3110
|
var rule42 = createRule({
|
|
3140
3111
|
create(context) {
|
|
3141
3112
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
3142
|
-
const
|
|
3113
|
+
const isPossibleHtmlElement = (node) => {
|
|
3143
3114
|
const nodeType = getNodeTypeAsString(fullTypeChecker, node, context);
|
|
3144
3115
|
return /HTML.*Element/v.test(nodeType) || nodeType === "any";
|
|
3145
3116
|
};
|
|
@@ -3151,7 +3122,7 @@ var rule42 = createRule({
|
|
|
3151
3122
|
if (node.left.type !== import_utils34.AST_NODE_TYPES.MemberExpression) {
|
|
3152
3123
|
return;
|
|
3153
3124
|
}
|
|
3154
|
-
if (!
|
|
3125
|
+
if (!isPossibleHtmlElement(node.left.object)) {
|
|
3155
3126
|
return;
|
|
3156
3127
|
}
|
|
3157
3128
|
context.report({
|
|
@@ -3167,7 +3138,7 @@ var rule42 = createRule({
|
|
|
3167
3138
|
if (secondArgument !== void 0 && isEmptyStringLiteral(secondArgument)) {
|
|
3168
3139
|
return;
|
|
3169
3140
|
}
|
|
3170
|
-
if (!
|
|
3141
|
+
if (!isPossibleHtmlElement(node.object)) {
|
|
3171
3142
|
return;
|
|
3172
3143
|
}
|
|
3173
3144
|
context.report({
|
|
@@ -3198,8 +3169,8 @@ var no_inner_html_default = rule42;
|
|
|
3198
3169
|
|
|
3199
3170
|
// dist/rules/no-insecure-random.js
|
|
3200
3171
|
var import_utils35 = require("@typescript-eslint/utils");
|
|
3201
|
-
var
|
|
3202
|
-
var
|
|
3172
|
+
var path = __toESM(require("node:path"), 1);
|
|
3173
|
+
var import_ts_extras22 = require("ts-extras");
|
|
3203
3174
|
var bannedRandomLibraries = [
|
|
3204
3175
|
"chance",
|
|
3205
3176
|
"random-float",
|
|
@@ -3209,13 +3180,13 @@ var bannedRandomLibraries = [
|
|
|
3209
3180
|
"unique-random"
|
|
3210
3181
|
];
|
|
3211
3182
|
var bannedRandomLibrarySet = new Set(bannedRandomLibraries);
|
|
3212
|
-
var isBannedRandomLibrary = (value) => (0,
|
|
3183
|
+
var isBannedRandomLibrary = (value) => (0, import_ts_extras22.setHas)(bannedRandomLibrarySet, value);
|
|
3213
3184
|
var rule43 = createRule({
|
|
3214
3185
|
create(context) {
|
|
3215
3186
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
3216
3187
|
return {
|
|
3217
3188
|
"CallExpression > MemberExpression[property.name='pseudoRandomBytes']"(node) {
|
|
3218
|
-
const isUnsafe = (0,
|
|
3189
|
+
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
3190
|
if (!isUnsafe) {
|
|
3220
3191
|
return;
|
|
3221
3192
|
}
|
|
@@ -3225,7 +3196,7 @@ var rule43 = createRule({
|
|
|
3225
3196
|
});
|
|
3226
3197
|
},
|
|
3227
3198
|
"CallExpression > MemberExpression[property.name='random']"(node) {
|
|
3228
|
-
const isUnsafe = (0,
|
|
3199
|
+
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
3200
|
if (!isUnsafe) {
|
|
3230
3201
|
return;
|
|
3231
3202
|
}
|
|
@@ -3236,10 +3207,10 @@ var rule43 = createRule({
|
|
|
3236
3207
|
},
|
|
3237
3208
|
"CallExpression[callee.name='require'][arguments.length=1]"(node) {
|
|
3238
3209
|
const [sourceArgument] = node.arguments;
|
|
3239
|
-
if (!(0,
|
|
3210
|
+
if (!(0, import_ts_extras22.isDefined)(sourceArgument) || sourceArgument.type !== import_utils35.AST_NODE_TYPES.Literal || typeof sourceArgument.value !== "string") {
|
|
3240
3211
|
return;
|
|
3241
3212
|
}
|
|
3242
|
-
const requireName =
|
|
3213
|
+
const requireName = path.parse(path.basename(sourceArgument.value)).name;
|
|
3243
3214
|
if (!isBannedRandomLibrary(requireName)) {
|
|
3244
3215
|
return;
|
|
3245
3216
|
}
|
|
@@ -3253,7 +3224,7 @@ var rule43 = createRule({
|
|
|
3253
3224
|
if (typeof sourceText !== "string") {
|
|
3254
3225
|
return;
|
|
3255
3226
|
}
|
|
3256
|
-
if (!isBannedRandomLibrary(
|
|
3227
|
+
if (!isBannedRandomLibrary(path.basename(sourceText))) {
|
|
3257
3228
|
return;
|
|
3258
3229
|
}
|
|
3259
3230
|
context.report({
|
|
@@ -3308,26 +3279,24 @@ var findRejectUnauthorizedFalseProperty = (objectExpression) => {
|
|
|
3308
3279
|
return void 0;
|
|
3309
3280
|
};
|
|
3310
3281
|
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
|
-
});
|
|
3282
|
+
create: (context) => ({
|
|
3283
|
+
ObjectExpression(node) {
|
|
3284
|
+
const insecureOptionProperty = findRejectUnauthorizedFalseProperty(node);
|
|
3285
|
+
if (insecureOptionProperty === void 0) {
|
|
3286
|
+
return;
|
|
3328
3287
|
}
|
|
3329
|
-
|
|
3330
|
-
|
|
3288
|
+
context.report({
|
|
3289
|
+
fix(fixer) {
|
|
3290
|
+
if (insecureOptionProperty.value.type !== import_utils36.AST_NODE_TYPES.Literal || insecureOptionProperty.value.value !== false) {
|
|
3291
|
+
return null;
|
|
3292
|
+
}
|
|
3293
|
+
return fixer.replaceText(insecureOptionProperty.value, "true");
|
|
3294
|
+
},
|
|
3295
|
+
messageId: "default",
|
|
3296
|
+
node: insecureOptionProperty
|
|
3297
|
+
});
|
|
3298
|
+
}
|
|
3299
|
+
}),
|
|
3331
3300
|
meta: {
|
|
3332
3301
|
deprecated: false,
|
|
3333
3302
|
docs: {
|
|
@@ -3364,12 +3333,12 @@ var asCaseInsensitiveRegex = (pattern) => {
|
|
|
3364
3333
|
}
|
|
3365
3334
|
return new RegExp(pattern, "iu");
|
|
3366
3335
|
};
|
|
3367
|
-
var
|
|
3336
|
+
var hasPatternMatch = (patterns, value) => patterns.some((pattern) => pattern.test(value));
|
|
3368
3337
|
var toRegexSources = (patterns) => patterns.map((pattern) => pattern.source);
|
|
3369
3338
|
var shouldAttemptFix = (variableExceptions, context, node) => {
|
|
3370
3339
|
const targetNode = node.parent ?? node;
|
|
3371
3340
|
const targetText = context.sourceCode.getText(targetNode);
|
|
3372
|
-
return !
|
|
3341
|
+
return !hasPatternMatch(variableExceptions, targetText);
|
|
3373
3342
|
};
|
|
3374
3343
|
var reportInsecureUrl = (context, node, replacementSourceText) => {
|
|
3375
3344
|
context.report({
|
|
@@ -3397,7 +3366,7 @@ var rule45 = createRule({
|
|
|
3397
3366
|
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
3367
|
return;
|
|
3399
3368
|
}
|
|
3400
|
-
if (!
|
|
3369
|
+
if (!hasPatternMatch(blocklist, node.value) || hasPatternMatch(exceptions, node.value)) {
|
|
3401
3370
|
return;
|
|
3402
3371
|
}
|
|
3403
3372
|
if (!shouldAttemptFix(variableExceptions, context, node)) {
|
|
@@ -3409,8 +3378,8 @@ var rule45 = createRule({
|
|
|
3409
3378
|
if (typeof node.value.raw !== "string" || typeof node.value.cooked !== "string") {
|
|
3410
3379
|
return;
|
|
3411
3380
|
}
|
|
3412
|
-
const isRawMatch = shouldAttemptFix(variableExceptions, context, node) &&
|
|
3413
|
-
const isCookedMatch =
|
|
3381
|
+
const isRawMatch = shouldAttemptFix(variableExceptions, context, node) && hasPatternMatch(blocklist, node.value.raw) && !hasPatternMatch(exceptions, node.value.raw);
|
|
3382
|
+
const isCookedMatch = hasPatternMatch(blocklist, node.value.cooked) && !hasPatternMatch(exceptions, node.value.cooked);
|
|
3414
3383
|
if (!isRawMatch && !isCookedMatch) {
|
|
3415
3384
|
return;
|
|
3416
3385
|
}
|
|
@@ -3469,7 +3438,7 @@ var no_insecure_url_default = rule45;
|
|
|
3469
3438
|
|
|
3470
3439
|
// dist/rules/no-location-javascript-url.js
|
|
3471
3440
|
var import_utils38 = require("@typescript-eslint/utils");
|
|
3472
|
-
var
|
|
3441
|
+
var import_ts_extras23 = require("ts-extras");
|
|
3473
3442
|
var getMemberPropertyName12 = (memberExpression) => {
|
|
3474
3443
|
if (!memberExpression.computed && memberExpression.property.type === import_utils38.AST_NODE_TYPES.Identifier) {
|
|
3475
3444
|
return memberExpression.property.name;
|
|
@@ -3484,7 +3453,7 @@ var getStaticStringValue5 = (node) => {
|
|
|
3484
3453
|
return node.value;
|
|
3485
3454
|
}
|
|
3486
3455
|
if (node.type === import_utils38.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
3487
|
-
return (0,
|
|
3456
|
+
return (0, import_ts_extras23.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
3488
3457
|
}
|
|
3489
3458
|
return void 0;
|
|
3490
3459
|
};
|
|
@@ -3558,31 +3527,31 @@ var no_location_javascript_url_default = rule46;
|
|
|
3558
3527
|
|
|
3559
3528
|
// dist/rules/no-message-event-without-origin-check.js
|
|
3560
3529
|
var import_utils39 = require("@typescript-eslint/utils");
|
|
3561
|
-
var
|
|
3530
|
+
var import_ts_extras24 = require("ts-extras");
|
|
3562
3531
|
var isFunctionExpression6 = (expression) => expression.type === import_utils39.AST_NODE_TYPES.ArrowFunctionExpression || expression.type === import_utils39.AST_NODE_TYPES.FunctionExpression;
|
|
3563
3532
|
var hasMessageEventGuardKeywords = (callbackText) => /\b(?:allowlist|origin|trusted|validate|verify|whitelist)\b/iv.test(callbackText);
|
|
3564
3533
|
var isUnknownRecord2 = (value) => typeof value === "object" && value !== null;
|
|
3565
|
-
var isNodeLike = (value) => isUnknownRecord2(value) && (0,
|
|
3534
|
+
var isNodeLike = (value) => isUnknownRecord2(value) && (0, import_ts_extras24.keyIn)(value, "type") && typeof value["type"] === "string";
|
|
3566
3535
|
var toNode = (value) => isNodeLike(value) ? value : void 0;
|
|
3567
|
-
var
|
|
3568
|
-
if (
|
|
3536
|
+
var hasDescendantNode = (node, hasMatchingNode) => {
|
|
3537
|
+
if (hasMatchingNode(node)) {
|
|
3569
3538
|
return true;
|
|
3570
3539
|
}
|
|
3571
|
-
for (const [propertyName, propertyValue] of (0,
|
|
3540
|
+
for (const [propertyName, propertyValue] of (0, import_ts_extras24.objectEntries)(node)) {
|
|
3572
3541
|
if (propertyName === "parent") {
|
|
3573
3542
|
continue;
|
|
3574
3543
|
}
|
|
3575
3544
|
if (Array.isArray(propertyValue)) {
|
|
3576
3545
|
for (const element of propertyValue) {
|
|
3577
3546
|
const childNode2 = toNode(element);
|
|
3578
|
-
if (childNode2 !== void 0 &&
|
|
3547
|
+
if (childNode2 !== void 0 && hasDescendantNode(childNode2, hasMatchingNode)) {
|
|
3579
3548
|
return true;
|
|
3580
3549
|
}
|
|
3581
3550
|
}
|
|
3582
3551
|
continue;
|
|
3583
3552
|
}
|
|
3584
3553
|
const childNode = toNode(propertyValue);
|
|
3585
|
-
if (childNode !== void 0 &&
|
|
3554
|
+
if (childNode !== void 0 && hasDescendantNode(childNode, hasMatchingNode)) {
|
|
3586
3555
|
return true;
|
|
3587
3556
|
}
|
|
3588
3557
|
}
|
|
@@ -3590,35 +3559,35 @@ var someDescendantNode = (node, predicate) => {
|
|
|
3590
3559
|
};
|
|
3591
3560
|
var isIdentifierNamed = (node, identifierName) => node.type === import_utils39.AST_NODE_TYPES.Identifier && node.name === identifierName;
|
|
3592
3561
|
var isStaticPropertyMatch = (memberExpression, objectName, propertyName) => isIdentifierNamed(memberExpression.object, objectName) && getMemberPropertyName3(memberExpression) === propertyName;
|
|
3593
|
-
var
|
|
3562
|
+
var hasPatternProperty = (pattern, propertyName) => pattern.properties.some((propertyNode) => {
|
|
3594
3563
|
if (propertyNode.type !== import_utils39.AST_NODE_TYPES.Property) {
|
|
3595
3564
|
return false;
|
|
3596
3565
|
}
|
|
3597
3566
|
return getPropertyName(propertyNode) === propertyName;
|
|
3598
3567
|
});
|
|
3599
|
-
var
|
|
3568
|
+
var hasObjectDestructureFromIdentifier = (rootNode, sourceName, propertyName) => hasDescendantNode(rootNode, (node) => {
|
|
3600
3569
|
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) &&
|
|
3570
|
+
return node.id.type === import_utils39.AST_NODE_TYPES.ObjectPattern && node.init !== null && isIdentifierNamed(node.init, sourceName) && hasPatternProperty(node.id, propertyName);
|
|
3602
3571
|
}
|
|
3603
3572
|
if (node.type !== import_utils39.AST_NODE_TYPES.AssignmentExpression) {
|
|
3604
3573
|
return false;
|
|
3605
3574
|
}
|
|
3606
|
-
return node.left.type === import_utils39.AST_NODE_TYPES.ObjectPattern && isIdentifierNamed(node.right, sourceName) &&
|
|
3575
|
+
return node.left.type === import_utils39.AST_NODE_TYPES.ObjectPattern && isIdentifierNamed(node.right, sourceName) && hasPatternProperty(node.left, propertyName);
|
|
3607
3576
|
});
|
|
3608
|
-
var
|
|
3577
|
+
var hasMemberPropertyAccess = (rootNode, objectName, propertyName) => hasDescendantNode(rootNode, (node) => node.type === import_utils39.AST_NODE_TYPES.MemberExpression ? isStaticPropertyMatch(node, objectName, propertyName) : false);
|
|
3609
3578
|
var hasObjectPatternProperty = (objectPattern, propertyName) => objectPattern.properties.some((propertyNode) => {
|
|
3610
3579
|
if (propertyNode.type !== import_utils39.AST_NODE_TYPES.Property) {
|
|
3611
3580
|
return false;
|
|
3612
3581
|
}
|
|
3613
3582
|
return getPropertyName(propertyNode) === propertyName;
|
|
3614
3583
|
});
|
|
3615
|
-
var
|
|
3616
|
-
var
|
|
3584
|
+
var hasCallbackMessageDataUsage = (callbackNode, eventParameterName) => hasMemberPropertyAccess(callbackNode.body, eventParameterName, "data") || hasObjectDestructureFromIdentifier(callbackNode.body, eventParameterName, "data");
|
|
3585
|
+
var hasCallbackOriginValidation = (callbackNode, context, eventParameterName) => {
|
|
3617
3586
|
const callbackSourceText = context.sourceCode.getText(callbackNode);
|
|
3618
|
-
return
|
|
3587
|
+
return hasMemberPropertyAccess(callbackNode.body, eventParameterName, "origin") || hasObjectDestructureFromIdentifier(callbackNode.body, eventParameterName, "origin") || hasMessageEventGuardKeywords(callbackSourceText);
|
|
3619
3588
|
};
|
|
3620
|
-
var
|
|
3621
|
-
var
|
|
3589
|
+
var shouldReportIdentifierCallback = (callbackNode, context, eventParameter) => hasCallbackMessageDataUsage(callbackNode, eventParameter.name) && !hasCallbackOriginValidation(callbackNode, context, eventParameter.name);
|
|
3590
|
+
var shouldReportObjectPatternCallback = (callbackNode, context, eventParameter) => {
|
|
3622
3591
|
if (!hasObjectPatternProperty(eventParameter, "data")) {
|
|
3623
3592
|
return false;
|
|
3624
3593
|
}
|
|
@@ -3633,10 +3602,10 @@ var shouldReportMessageEventCallback = (callbackNode, context) => {
|
|
|
3633
3602
|
return false;
|
|
3634
3603
|
}
|
|
3635
3604
|
if (firstParameter.type === import_utils39.AST_NODE_TYPES.Identifier) {
|
|
3636
|
-
return
|
|
3605
|
+
return shouldReportIdentifierCallback(callbackNode, context, firstParameter);
|
|
3637
3606
|
}
|
|
3638
3607
|
if (firstParameter.type === import_utils39.AST_NODE_TYPES.ObjectPattern) {
|
|
3639
|
-
return
|
|
3608
|
+
return shouldReportObjectPatternCallback(callbackNode, context, firstParameter);
|
|
3640
3609
|
}
|
|
3641
3610
|
return false;
|
|
3642
3611
|
};
|
|
@@ -3710,16 +3679,14 @@ var no_message_event_without_origin_check_default = rule47;
|
|
|
3710
3679
|
|
|
3711
3680
|
// dist/rules/no-msapp-exec-unsafe.js
|
|
3712
3681
|
var rule48 = createRule({
|
|
3713
|
-
create(context) {
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
};
|
|
3722
|
-
},
|
|
3682
|
+
create: (context) => ({
|
|
3683
|
+
"CallExpression[arguments.length=1][callee.object.name='MSApp'][callee.property.name='execUnsafeLocalFunction']"(node) {
|
|
3684
|
+
context.report({
|
|
3685
|
+
messageId: "default",
|
|
3686
|
+
node
|
|
3687
|
+
});
|
|
3688
|
+
}
|
|
3689
|
+
}),
|
|
3723
3690
|
meta: {
|
|
3724
3691
|
deprecated: false,
|
|
3725
3692
|
docs: {
|
|
@@ -3740,11 +3707,11 @@ var no_msapp_exec_unsafe_default = rule48;
|
|
|
3740
3707
|
|
|
3741
3708
|
// dist/rules/no-node-tls-check-server-identity-bypass.js
|
|
3742
3709
|
var import_utils41 = require("@typescript-eslint/utils");
|
|
3743
|
-
var
|
|
3710
|
+
var import_ts_extras26 = require("ts-extras");
|
|
3744
3711
|
|
|
3745
3712
|
// dist/_internal/node-tls-config.js
|
|
3746
3713
|
var import_utils40 = require("@typescript-eslint/utils");
|
|
3747
|
-
var
|
|
3714
|
+
var import_ts_extras25 = require("ts-extras");
|
|
3748
3715
|
var NODE_TLS_OBJECT_NAMES = /* @__PURE__ */ new Set([
|
|
3749
3716
|
"http2",
|
|
3750
3717
|
"https",
|
|
@@ -3760,13 +3727,13 @@ var NODE_TLS_CALL_METHOD_NAMES = /* @__PURE__ */ new Set([
|
|
|
3760
3727
|
]);
|
|
3761
3728
|
var isNodeTlsObjectExpression = (expression) => {
|
|
3762
3729
|
if (expression.type === import_utils40.AST_NODE_TYPES.Identifier) {
|
|
3763
|
-
return (0,
|
|
3730
|
+
return (0, import_ts_extras25.setHas)(NODE_TLS_OBJECT_NAMES, expression.name);
|
|
3764
3731
|
}
|
|
3765
3732
|
if (expression.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
3766
3733
|
return false;
|
|
3767
3734
|
}
|
|
3768
3735
|
const propertyName = getMemberPropertyName3(expression);
|
|
3769
|
-
return (0,
|
|
3736
|
+
return (0, import_ts_extras25.isDefined)(propertyName) && (0, import_ts_extras25.setHas)(NODE_TLS_OBJECT_NAMES, propertyName);
|
|
3770
3737
|
};
|
|
3771
3738
|
var isRelevantNodeTlsCall = (callee) => {
|
|
3772
3739
|
if (callee.type === import_utils40.AST_NODE_TYPES.Identifier) {
|
|
@@ -3776,7 +3743,7 @@ var isRelevantNodeTlsCall = (callee) => {
|
|
|
3776
3743
|
return false;
|
|
3777
3744
|
}
|
|
3778
3745
|
const methodName = getMemberPropertyName3(callee);
|
|
3779
|
-
return (0,
|
|
3746
|
+
return (0, import_ts_extras25.isDefined)(methodName) && (0, import_ts_extras25.setHas)(NODE_TLS_CALL_METHOD_NAMES, methodName) && isNodeTlsObjectExpression(callee.object);
|
|
3780
3747
|
};
|
|
3781
3748
|
var isRelevantNodeTlsConstructor = (callee) => {
|
|
3782
3749
|
if (callee.type !== import_utils40.AST_NODE_TYPES.MemberExpression) {
|
|
@@ -3799,7 +3766,7 @@ var isNodeTlsStaticMember = (node, propertyNames) => {
|
|
|
3799
3766
|
return false;
|
|
3800
3767
|
}
|
|
3801
3768
|
const propertyName = getMemberPropertyName3(node);
|
|
3802
|
-
return (0,
|
|
3769
|
+
return (0, import_ts_extras25.isDefined)(propertyName) && (0, import_ts_extras25.setHas)(propertyNames, propertyName) && isNodeTlsObjectExpression(node.object);
|
|
3803
3770
|
};
|
|
3804
3771
|
|
|
3805
3772
|
// dist/rules/no-node-tls-check-server-identity-bypass.js
|
|
@@ -3825,40 +3792,38 @@ var isAlwaysSuccessfulCheckServerIdentity = (callbackNode) => {
|
|
|
3825
3792
|
if (callbackNode.body.body.length !== 1) {
|
|
3826
3793
|
return false;
|
|
3827
3794
|
}
|
|
3828
|
-
const onlyStatement = (0,
|
|
3795
|
+
const onlyStatement = (0, import_ts_extras26.arrayFirst)(callbackNode.body.body);
|
|
3829
3796
|
if (onlyStatement?.type !== import_utils41.AST_NODE_TYPES.ReturnStatement) {
|
|
3830
3797
|
return false;
|
|
3831
3798
|
}
|
|
3832
3799
|
return onlyStatement.argument === null || isAlwaysSuccessfulReturnExpression(onlyStatement.argument);
|
|
3833
3800
|
};
|
|
3834
3801
|
var rule49 = createRule({
|
|
3835
|
-
create(context) {
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3802
|
+
create: (context) => ({
|
|
3803
|
+
AssignmentExpression(node) {
|
|
3804
|
+
if (node.operator !== "=" || !isNodeTlsStaticMember(node.left, CHECK_SERVER_IDENTITY_PROPERTY_NAMES) || !isFunctionExpression7(node.right) || !isAlwaysSuccessfulCheckServerIdentity(node.right)) {
|
|
3805
|
+
return;
|
|
3806
|
+
}
|
|
3807
|
+
context.report({
|
|
3808
|
+
messageId: "default",
|
|
3809
|
+
node: node.right
|
|
3810
|
+
});
|
|
3811
|
+
},
|
|
3812
|
+
ObjectExpression(node) {
|
|
3813
|
+
if (!isRelevantNodeTlsOptionsObject(node)) {
|
|
3814
|
+
return;
|
|
3815
|
+
}
|
|
3816
|
+
for (const propertyNode of node.properties) {
|
|
3817
|
+
if (propertyNode.type !== import_utils41.AST_NODE_TYPES.Property || propertyNode.kind !== "init" || getPropertyName(propertyNode) !== "checkServerIdentity" || !isExpressionNode2(propertyNode.value) || !isFunctionExpression7(propertyNode.value) || !isAlwaysSuccessfulCheckServerIdentity(propertyNode.value)) {
|
|
3818
|
+
continue;
|
|
3840
3819
|
}
|
|
3841
3820
|
context.report({
|
|
3842
3821
|
messageId: "default",
|
|
3843
|
-
node:
|
|
3822
|
+
node: propertyNode.value
|
|
3844
3823
|
});
|
|
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
3824
|
}
|
|
3860
|
-
}
|
|
3861
|
-
},
|
|
3825
|
+
}
|
|
3826
|
+
}),
|
|
3862
3827
|
meta: {
|
|
3863
3828
|
deprecated: false,
|
|
3864
3829
|
docs: {
|
|
@@ -3879,7 +3844,12 @@ var no_node_tls_check_server_identity_bypass_default = rule49;
|
|
|
3879
3844
|
|
|
3880
3845
|
// dist/rules/no-node-tls-legacy-protocol.js
|
|
3881
3846
|
var import_utils42 = require("@typescript-eslint/utils");
|
|
3882
|
-
var
|
|
3847
|
+
var import_ts_extras27 = require("ts-extras");
|
|
3848
|
+
var LEGACY_TLS_PROPERTY_NAMES = [
|
|
3849
|
+
"maxVersion",
|
|
3850
|
+
"minVersion",
|
|
3851
|
+
"secureProtocol"
|
|
3852
|
+
];
|
|
3883
3853
|
var LEGACY_TLS_VERSION_VALUES = /* @__PURE__ */ new Set([
|
|
3884
3854
|
"TLSv1",
|
|
3885
3855
|
"TLSv1.0",
|
|
@@ -3891,67 +3861,65 @@ var isLegacyTlsPropertyValue = (propertyName, configuredValue) => {
|
|
|
3891
3861
|
if (propertyName === "secureProtocol") {
|
|
3892
3862
|
return isLegacySecureProtocolValue(configuredValue);
|
|
3893
3863
|
}
|
|
3894
|
-
return (0,
|
|
3864
|
+
return (0, import_ts_extras27.setHas)(LEGACY_TLS_VERSION_VALUES, configuredValue);
|
|
3895
3865
|
};
|
|
3896
3866
|
var getLegacyTlsPropertyName = (propertyNode) => {
|
|
3897
3867
|
const propertyName = getPropertyName(propertyNode);
|
|
3898
|
-
if (
|
|
3868
|
+
if ((0, import_ts_extras27.arrayIncludes)(LEGACY_TLS_PROPERTY_NAMES, propertyName)) {
|
|
3899
3869
|
return propertyName;
|
|
3900
3870
|
}
|
|
3901
3871
|
return void 0;
|
|
3902
3872
|
};
|
|
3903
3873
|
var isTlsDefaultVersionMember = (node) => isNodeTlsStaticMember(node, /* @__PURE__ */ new Set(["DEFAULT_MAX_VERSION", "DEFAULT_MIN_VERSION"]));
|
|
3904
3874
|
var rule50 = createRule({
|
|
3905
|
-
create(context) {
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3875
|
+
create: (context) => ({
|
|
3876
|
+
AssignmentExpression(node) {
|
|
3877
|
+
if (node.operator !== "=" || !isTlsDefaultVersionMember(node.left)) {
|
|
3878
|
+
return;
|
|
3879
|
+
}
|
|
3880
|
+
const configuredValue = getStaticStringValue(node.right);
|
|
3881
|
+
if (typeof configuredValue !== "string" || !(0, import_ts_extras27.setHas)(LEGACY_TLS_VERSION_VALUES, configuredValue)) {
|
|
3882
|
+
return;
|
|
3883
|
+
}
|
|
3884
|
+
context.report({
|
|
3885
|
+
data: {
|
|
3886
|
+
configuredValue,
|
|
3887
|
+
propertyName: getMemberPropertyName3(node.left) ?? "DEFAULT_MIN_VERSION"
|
|
3888
|
+
},
|
|
3889
|
+
messageId: "default",
|
|
3890
|
+
node: node.right
|
|
3891
|
+
});
|
|
3892
|
+
},
|
|
3893
|
+
ObjectExpression(node) {
|
|
3894
|
+
if (!isRelevantNodeTlsOptionsObject(node)) {
|
|
3895
|
+
return;
|
|
3896
|
+
}
|
|
3897
|
+
for (const propertyNode of node.properties) {
|
|
3898
|
+
if (propertyNode.type !== import_utils42.AST_NODE_TYPES.Property || propertyNode.kind !== "init") {
|
|
3899
|
+
continue;
|
|
3910
3900
|
}
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3901
|
+
if (!isExpressionNode3(propertyNode.value)) {
|
|
3902
|
+
continue;
|
|
3903
|
+
}
|
|
3904
|
+
const propertyName = getLegacyTlsPropertyName(propertyNode);
|
|
3905
|
+
if (!(0, import_ts_extras27.isDefined)(propertyName)) {
|
|
3906
|
+
continue;
|
|
3907
|
+
}
|
|
3908
|
+
const configuredValue = getStaticStringValue(propertyNode.value);
|
|
3909
|
+
if (typeof configuredValue !== "string" || !isLegacyTlsPropertyValue(propertyName, configuredValue)) {
|
|
3910
|
+
continue;
|
|
3914
3911
|
}
|
|
3915
3912
|
context.report({
|
|
3916
3913
|
data: {
|
|
3917
3914
|
configuredValue,
|
|
3918
|
-
propertyName
|
|
3915
|
+
propertyName
|
|
3919
3916
|
},
|
|
3920
3917
|
messageId: "default",
|
|
3921
|
-
node:
|
|
3918
|
+
node: propertyNode.value
|
|
3922
3919
|
});
|
|
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
3920
|
}
|
|
3953
|
-
}
|
|
3954
|
-
},
|
|
3921
|
+
}
|
|
3922
|
+
}),
|
|
3955
3923
|
meta: {
|
|
3956
3924
|
deprecated: false,
|
|
3957
3925
|
docs: {
|
|
@@ -3972,7 +3940,7 @@ var no_node_tls_legacy_protocol_default = rule50;
|
|
|
3972
3940
|
|
|
3973
3941
|
// dist/rules/no-node-tls-reject-unauthorized-zero.js
|
|
3974
3942
|
var import_utils43 = require("@typescript-eslint/utils");
|
|
3975
|
-
var
|
|
3943
|
+
var import_ts_extras28 = require("ts-extras");
|
|
3976
3944
|
var getMemberPropertyName13 = (memberExpression) => {
|
|
3977
3945
|
if (!memberExpression.computed && memberExpression.property.type === import_utils43.AST_NODE_TYPES.Identifier) {
|
|
3978
3946
|
return memberExpression.property.name;
|
|
@@ -4004,37 +3972,35 @@ var isUnsafeOverrideValue = (node) => {
|
|
|
4004
3972
|
if (node.type === import_utils43.AST_NODE_TYPES.Literal) {
|
|
4005
3973
|
return node.value === 0 || node.value === "0";
|
|
4006
3974
|
}
|
|
4007
|
-
return node.type === import_utils43.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0 && (0,
|
|
3975
|
+
return node.type === import_utils43.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0 && (0, import_ts_extras28.arrayFirst)(node.quasis)?.value.cooked === "0";
|
|
4008
3976
|
};
|
|
4009
3977
|
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
|
-
});
|
|
3978
|
+
create: (context) => ({
|
|
3979
|
+
AssignmentExpression(node) {
|
|
3980
|
+
if (node.operator !== "=") {
|
|
3981
|
+
return;
|
|
4035
3982
|
}
|
|
4036
|
-
|
|
4037
|
-
|
|
3983
|
+
if (!isTlsRejectUnauthorizedMember(node.left)) {
|
|
3984
|
+
return;
|
|
3985
|
+
}
|
|
3986
|
+
if (!isUnsafeOverrideValue(node.right)) {
|
|
3987
|
+
return;
|
|
3988
|
+
}
|
|
3989
|
+
context.report({
|
|
3990
|
+
messageId: "default",
|
|
3991
|
+
node,
|
|
3992
|
+
suggest: [
|
|
3993
|
+
{
|
|
3994
|
+
fix(fixer) {
|
|
3995
|
+
const replacementValue = node.right.type === import_utils43.AST_NODE_TYPES.TemplateLiteral ? "`1`" : "'1'";
|
|
3996
|
+
return fixer.replaceText(node.right, replacementValue);
|
|
3997
|
+
},
|
|
3998
|
+
messageId: "replaceWithTlsRejectUnauthorizedOne"
|
|
3999
|
+
}
|
|
4000
|
+
]
|
|
4001
|
+
});
|
|
4002
|
+
}
|
|
4003
|
+
}),
|
|
4038
4004
|
meta: {
|
|
4039
4005
|
deprecated: false,
|
|
4040
4006
|
docs: {
|
|
@@ -4062,49 +4028,47 @@ var TLS_SECURITY_LEVEL_ZERO_PATTERN = /@seclevel\s*=\s*0\b/iv;
|
|
|
4062
4028
|
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
4029
|
var isSecurityLevelZeroCipherString = (value) => TLS_SECURITY_LEVEL_ZERO_PATTERN.test(value);
|
|
4064
4030
|
var rule52 = createRule({
|
|
4065
|
-
create(context) {
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4031
|
+
create: (context) => ({
|
|
4032
|
+
AssignmentExpression(node) {
|
|
4033
|
+
if (node.operator !== "=" || !isNodeTlsStaticMember(node.left, TLS_DEFAULT_CIPHERS_PROPERTY_NAMES)) {
|
|
4034
|
+
return;
|
|
4035
|
+
}
|
|
4036
|
+
const configuredValue = getStaticStringValue(node.right);
|
|
4037
|
+
if (typeof configuredValue !== "string" || !isSecurityLevelZeroCipherString(configuredValue)) {
|
|
4038
|
+
return;
|
|
4039
|
+
}
|
|
4040
|
+
context.report({
|
|
4041
|
+
data: {
|
|
4042
|
+
configuredValue,
|
|
4043
|
+
propertyName: "DEFAULT_CIPHERS"
|
|
4044
|
+
},
|
|
4045
|
+
messageId: "default",
|
|
4046
|
+
node: node.right
|
|
4047
|
+
});
|
|
4048
|
+
},
|
|
4049
|
+
ObjectExpression(node) {
|
|
4050
|
+
if (!isRelevantNodeTlsOptionsObject(node)) {
|
|
4051
|
+
return;
|
|
4052
|
+
}
|
|
4053
|
+
for (const propertyNode of node.properties) {
|
|
4054
|
+
if (propertyNode.type !== import_utils44.AST_NODE_TYPES.Property || propertyNode.kind !== "init" || getPropertyName(propertyNode) !== "ciphers" || !isExpressionNode4(propertyNode.value)) {
|
|
4055
|
+
continue;
|
|
4070
4056
|
}
|
|
4071
|
-
const configuredValue = getStaticStringValue(
|
|
4057
|
+
const configuredValue = getStaticStringValue(propertyNode.value);
|
|
4072
4058
|
if (typeof configuredValue !== "string" || !isSecurityLevelZeroCipherString(configuredValue)) {
|
|
4073
|
-
|
|
4059
|
+
continue;
|
|
4074
4060
|
}
|
|
4075
4061
|
context.report({
|
|
4076
4062
|
data: {
|
|
4077
4063
|
configuredValue,
|
|
4078
|
-
propertyName: "
|
|
4064
|
+
propertyName: "ciphers"
|
|
4079
4065
|
},
|
|
4080
4066
|
messageId: "default",
|
|
4081
|
-
node:
|
|
4067
|
+
node: propertyNode.value
|
|
4082
4068
|
});
|
|
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
4069
|
}
|
|
4106
|
-
}
|
|
4107
|
-
},
|
|
4070
|
+
}
|
|
4071
|
+
}),
|
|
4108
4072
|
meta: {
|
|
4109
4073
|
deprecated: false,
|
|
4110
4074
|
docs: {
|
|
@@ -4125,7 +4089,7 @@ var no_node_tls_security_level_zero_default = rule52;
|
|
|
4125
4089
|
|
|
4126
4090
|
// dist/rules/no-node-vm-run-in-context.js
|
|
4127
4091
|
var import_utils45 = require("@typescript-eslint/utils");
|
|
4128
|
-
var
|
|
4092
|
+
var import_ts_extras29 = require("ts-extras");
|
|
4129
4093
|
var VM_MODULE_NAMES = /* @__PURE__ */ new Set(["node:vm", "vm"]);
|
|
4130
4094
|
var DISALLOWED_VM_CALL_NAMES = /* @__PURE__ */ new Set([
|
|
4131
4095
|
"compileFunction",
|
|
@@ -4134,9 +4098,9 @@ var DISALLOWED_VM_CALL_NAMES = /* @__PURE__ */ new Set([
|
|
|
4134
4098
|
"runInThisContext"
|
|
4135
4099
|
]);
|
|
4136
4100
|
var DISALLOWED_VM_CONSTRUCTOR_NAMES = /* @__PURE__ */ new Set(["Script"]);
|
|
4137
|
-
var isVmModuleSource = (value) => (0,
|
|
4138
|
-
var isDisallowedVmCallName = (value) => (0,
|
|
4139
|
-
var isDisallowedVmConstructorName = (value) => (0,
|
|
4101
|
+
var isVmModuleSource = (value) => (0, import_ts_extras29.setHas)(VM_MODULE_NAMES, value);
|
|
4102
|
+
var isDisallowedVmCallName = (value) => (0, import_ts_extras29.isDefined)(value) && (0, import_ts_extras29.setHas)(DISALLOWED_VM_CALL_NAMES, value);
|
|
4103
|
+
var isDisallowedVmConstructorName = (value) => (0, import_ts_extras29.isDefined)(value) && (0, import_ts_extras29.setHas)(DISALLOWED_VM_CONSTRUCTOR_NAMES, value);
|
|
4140
4104
|
var isRequireCallFromVmModule = (expression) => {
|
|
4141
4105
|
if (expression?.type !== import_utils45.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils45.AST_NODE_TYPES.Identifier || expression.callee.name !== "require") {
|
|
4142
4106
|
return false;
|
|
@@ -4161,7 +4125,7 @@ var rule53 = createRule({
|
|
|
4161
4125
|
return {
|
|
4162
4126
|
CallExpression(node) {
|
|
4163
4127
|
if (node.callee.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4164
|
-
if (!(0,
|
|
4128
|
+
if (!(0, import_ts_extras29.setHas)(vmCallBindingNames, node.callee.name)) {
|
|
4165
4129
|
return;
|
|
4166
4130
|
}
|
|
4167
4131
|
context.report({
|
|
@@ -4177,7 +4141,7 @@ var rule53 = createRule({
|
|
|
4177
4141
|
if (!isDisallowedVmCallName(methodName)) {
|
|
4178
4142
|
return;
|
|
4179
4143
|
}
|
|
4180
|
-
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.Identifier && (0,
|
|
4144
|
+
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.Identifier && (0, import_ts_extras29.setHas)(vmNamespaceBindingNames, node.callee.object.name)) {
|
|
4181
4145
|
context.report({
|
|
4182
4146
|
messageId: "default",
|
|
4183
4147
|
node: node.callee
|
|
@@ -4212,7 +4176,7 @@ var rule53 = createRule({
|
|
|
4212
4176
|
},
|
|
4213
4177
|
NewExpression(node) {
|
|
4214
4178
|
if (node.callee.type === import_utils45.AST_NODE_TYPES.Identifier) {
|
|
4215
|
-
if (!(0,
|
|
4179
|
+
if (!(0, import_ts_extras29.setHas)(vmConstructorBindingNames, node.callee.name)) {
|
|
4216
4180
|
return;
|
|
4217
4181
|
}
|
|
4218
4182
|
context.report({
|
|
@@ -4228,7 +4192,7 @@ var rule53 = createRule({
|
|
|
4228
4192
|
if (!isDisallowedVmConstructorName(constructorName)) {
|
|
4229
4193
|
return;
|
|
4230
4194
|
}
|
|
4231
|
-
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.Identifier && (0,
|
|
4195
|
+
if (node.callee.object.type === import_utils45.AST_NODE_TYPES.Identifier && (0, import_ts_extras29.setHas)(vmNamespaceBindingNames, node.callee.object.name)) {
|
|
4232
4196
|
context.report({
|
|
4233
4197
|
messageId: "default",
|
|
4234
4198
|
node: node.callee
|
|
@@ -4293,10 +4257,10 @@ var no_node_vm_run_in_context_default = rule53;
|
|
|
4293
4257
|
|
|
4294
4258
|
// dist/rules/no-node-vm-source-text-module.js
|
|
4295
4259
|
var import_utils46 = require("@typescript-eslint/utils");
|
|
4296
|
-
var
|
|
4260
|
+
var import_ts_extras30 = require("ts-extras");
|
|
4297
4261
|
var VM_MODULE_NAMES2 = /* @__PURE__ */ new Set(["node:vm", "vm"]);
|
|
4298
4262
|
var SOURCE_TEXT_MODULE_NAME = "SourceTextModule";
|
|
4299
|
-
var isVmModuleSource2 = (value) => (0,
|
|
4263
|
+
var isVmModuleSource2 = (value) => (0, import_ts_extras30.setHas)(VM_MODULE_NAMES2, value);
|
|
4300
4264
|
var isRequireCallFromVmModule2 = (expression) => {
|
|
4301
4265
|
if (expression?.type !== import_utils46.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils46.AST_NODE_TYPES.Identifier || expression.callee.name !== "require") {
|
|
4302
4266
|
return false;
|
|
@@ -4315,7 +4279,7 @@ var getPatternIdentifier3 = (pattern) => {
|
|
|
4315
4279
|
};
|
|
4316
4280
|
var isSourceTextModuleConstructor = (callee, sourceTextModuleBindingNames, vmNamespaceBindingNames) => {
|
|
4317
4281
|
if (callee.type === import_utils46.AST_NODE_TYPES.Identifier) {
|
|
4318
|
-
return (0,
|
|
4282
|
+
return (0, import_ts_extras30.setHas)(sourceTextModuleBindingNames, callee.name);
|
|
4319
4283
|
}
|
|
4320
4284
|
if (callee.type !== import_utils46.AST_NODE_TYPES.MemberExpression) {
|
|
4321
4285
|
return false;
|
|
@@ -4323,7 +4287,7 @@ var isSourceTextModuleConstructor = (callee, sourceTextModuleBindingNames, vmNam
|
|
|
4323
4287
|
if (getMemberPropertyName3(callee) !== SOURCE_TEXT_MODULE_NAME) {
|
|
4324
4288
|
return false;
|
|
4325
4289
|
}
|
|
4326
|
-
return callee.object.type === import_utils46.AST_NODE_TYPES.Identifier && (0,
|
|
4290
|
+
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
4291
|
};
|
|
4328
4292
|
var rule54 = createRule({
|
|
4329
4293
|
create(context) {
|
|
@@ -4401,12 +4365,12 @@ var no_node_vm_source_text_module_default = rule54;
|
|
|
4401
4365
|
|
|
4402
4366
|
// dist/rules/no-node-worker-threads-eval.js
|
|
4403
4367
|
var import_utils47 = require("@typescript-eslint/utils");
|
|
4404
|
-
var
|
|
4368
|
+
var import_ts_extras31 = require("ts-extras");
|
|
4405
4369
|
var WORKER_THREADS_MODULE_NAMES = /* @__PURE__ */ new Set([
|
|
4406
4370
|
"node:worker_threads",
|
|
4407
4371
|
"worker_threads"
|
|
4408
4372
|
]);
|
|
4409
|
-
var isWorkerThreadsModuleSource = (value) => (0,
|
|
4373
|
+
var isWorkerThreadsModuleSource = (value) => (0, import_ts_extras31.setHas)(WORKER_THREADS_MODULE_NAMES, value);
|
|
4410
4374
|
var isRequireCallFromWorkerThreads = (expression) => {
|
|
4411
4375
|
if (expression?.type !== import_utils47.AST_NODE_TYPES.CallExpression || expression.callee.type !== import_utils47.AST_NODE_TYPES.Identifier || expression.callee.name !== "require") {
|
|
4412
4376
|
return false;
|
|
@@ -4442,7 +4406,7 @@ var hasEvalTrueOption = (optionsNode) => {
|
|
|
4442
4406
|
};
|
|
4443
4407
|
var isWorkerThreadsWorkerConstructor = (callee, workerBindingNames, workerThreadsNamespaceBindingNames) => {
|
|
4444
4408
|
if (callee.type === import_utils47.AST_NODE_TYPES.Identifier) {
|
|
4445
|
-
return (0,
|
|
4409
|
+
return (0, import_ts_extras31.setHas)(workerBindingNames, callee.name);
|
|
4446
4410
|
}
|
|
4447
4411
|
if (callee.type !== import_utils47.AST_NODE_TYPES.MemberExpression) {
|
|
4448
4412
|
return false;
|
|
@@ -4450,7 +4414,7 @@ var isWorkerThreadsWorkerConstructor = (callee, workerBindingNames, workerThread
|
|
|
4450
4414
|
if (getMemberPropertyName3(callee) !== "Worker") {
|
|
4451
4415
|
return false;
|
|
4452
4416
|
}
|
|
4453
|
-
return callee.object.type === import_utils47.AST_NODE_TYPES.Identifier && (0,
|
|
4417
|
+
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
4418
|
};
|
|
4455
4419
|
var rule55 = createRule({
|
|
4456
4420
|
create(context) {
|
|
@@ -4543,19 +4507,17 @@ var isSecuritySensitiveExpression = (expression) => {
|
|
|
4543
4507
|
return false;
|
|
4544
4508
|
};
|
|
4545
4509
|
var rule56 = createRule({
|
|
4546
|
-
create(context) {
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
return;
|
|
4551
|
-
}
|
|
4552
|
-
context.report({
|
|
4553
|
-
messageId: "default",
|
|
4554
|
-
node
|
|
4555
|
-
});
|
|
4510
|
+
create: (context) => ({
|
|
4511
|
+
TSNonNullExpression(node) {
|
|
4512
|
+
if (!isSecuritySensitiveExpression(node.expression)) {
|
|
4513
|
+
return;
|
|
4556
4514
|
}
|
|
4557
|
-
|
|
4558
|
-
|
|
4515
|
+
context.report({
|
|
4516
|
+
messageId: "default",
|
|
4517
|
+
node
|
|
4518
|
+
});
|
|
4519
|
+
}
|
|
4520
|
+
}),
|
|
4559
4521
|
meta: {
|
|
4560
4522
|
deprecated: false,
|
|
4561
4523
|
docs: {
|
|
@@ -4576,19 +4538,19 @@ var no_nonnull_assertion_on_security_input_default = rule56;
|
|
|
4576
4538
|
|
|
4577
4539
|
// dist/rules/no-postmessage-star-origin.js
|
|
4578
4540
|
var import_utils49 = require("@typescript-eslint/utils");
|
|
4579
|
-
var
|
|
4541
|
+
var import_ts_extras32 = require("ts-extras");
|
|
4580
4542
|
var rule57 = createRule({
|
|
4581
4543
|
create(context) {
|
|
4582
4544
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
4583
4545
|
return {
|
|
4584
4546
|
"CallExpression[arguments.length>=2][arguments.length<=3][callee.property.name='postMessage']"(node) {
|
|
4585
4547
|
const [, targetOrigin] = node.arguments;
|
|
4586
|
-
if (!(0,
|
|
4548
|
+
if (!(0, import_ts_extras32.isDefined)(targetOrigin) || targetOrigin.type !== import_utils49.AST_NODE_TYPES.Literal || targetOrigin.value !== "*") {
|
|
4587
4549
|
return;
|
|
4588
4550
|
}
|
|
4589
|
-
if ((0,
|
|
4551
|
+
if ((0, import_ts_extras32.isDefined)(fullTypeChecker) && node.callee.type === import_utils49.AST_NODE_TYPES.MemberExpression) {
|
|
4590
4552
|
const calleeObjectType = getNodeTypeAsString(fullTypeChecker, node.callee.object, context);
|
|
4591
|
-
if (!(0,
|
|
4553
|
+
if (!(0, import_ts_extras32.arrayIncludes)(["any", "Window"], calleeObjectType)) {
|
|
4592
4554
|
return;
|
|
4593
4555
|
}
|
|
4594
4556
|
}
|
|
@@ -4597,9 +4559,7 @@ var rule57 = createRule({
|
|
|
4597
4559
|
node: targetOrigin,
|
|
4598
4560
|
suggest: [
|
|
4599
4561
|
{
|
|
4600
|
-
fix(fixer)
|
|
4601
|
-
return fixer.replaceText(targetOrigin, "location.origin");
|
|
4602
|
-
},
|
|
4562
|
+
fix: (fixer) => fixer.replaceText(targetOrigin, "location.origin"),
|
|
4603
4563
|
messageId: "replaceWithExplicitOrigin"
|
|
4604
4564
|
}
|
|
4605
4565
|
]
|
|
@@ -4629,7 +4589,7 @@ var no_postmessage_star_origin_default = rule57;
|
|
|
4629
4589
|
|
|
4630
4590
|
// dist/rules/no-postmessage-without-origin-allowlist.js
|
|
4631
4591
|
var import_utils50 = require("@typescript-eslint/utils");
|
|
4632
|
-
var
|
|
4592
|
+
var import_ts_extras33 = require("ts-extras");
|
|
4633
4593
|
var getMemberPropertyName14 = (memberExpression) => {
|
|
4634
4594
|
if (!memberExpression.computed && memberExpression.property.type === import_utils50.AST_NODE_TYPES.Identifier) {
|
|
4635
4595
|
return memberExpression.property.name;
|
|
@@ -4644,7 +4604,7 @@ var getStaticStringValue6 = (node) => {
|
|
|
4644
4604
|
return node.value;
|
|
4645
4605
|
}
|
|
4646
4606
|
if (node.type === import_utils50.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
4647
|
-
return (0,
|
|
4607
|
+
return (0, import_ts_extras33.arrayFirst)(node.quasis)?.value.cooked ?? void 0;
|
|
4648
4608
|
}
|
|
4649
4609
|
return void 0;
|
|
4650
4610
|
};
|
|
@@ -4887,7 +4847,12 @@ var no_script_src_data_url_default = rule60;
|
|
|
4887
4847
|
|
|
4888
4848
|
// dist/rules/no-script-text.js
|
|
4889
4849
|
var import_utils54 = require("@typescript-eslint/utils");
|
|
4890
|
-
var
|
|
4850
|
+
var import_ts_extras34 = require("ts-extras");
|
|
4851
|
+
var isScriptTextPropertyName = (propertyName) => (0, import_ts_extras34.arrayIncludes)([
|
|
4852
|
+
"innerText",
|
|
4853
|
+
"text",
|
|
4854
|
+
"textContent"
|
|
4855
|
+
], propertyName ?? "");
|
|
4891
4856
|
var rule61 = createRule({
|
|
4892
4857
|
create(context) {
|
|
4893
4858
|
const fullTypeChecker = getFullTypeChecker(context);
|
|
@@ -5019,7 +4984,7 @@ var no_set_html_unsafe_default = rule63;
|
|
|
5019
4984
|
|
|
5020
4985
|
// dist/rules/no-trusted-types-policy-pass-through.js
|
|
5021
4986
|
var import_utils57 = require("@typescript-eslint/utils");
|
|
5022
|
-
var
|
|
4987
|
+
var import_ts_extras35 = require("ts-extras");
|
|
5023
4988
|
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
4989
|
var POLICY_FACTORY_NAMES = /* @__PURE__ */ new Set([
|
|
5025
4990
|
"createHTML",
|
|
@@ -5045,7 +5010,7 @@ var isPassThroughFactory = (factoryNode) => {
|
|
|
5045
5010
|
if (factoryNode.body.body.length !== 1) {
|
|
5046
5011
|
return false;
|
|
5047
5012
|
}
|
|
5048
|
-
const onlyStatement = (0,
|
|
5013
|
+
const onlyStatement = (0, import_ts_extras35.arrayFirst)(factoryNode.body.body);
|
|
5049
5014
|
if (onlyStatement?.type !== import_utils57.AST_NODE_TYPES.ReturnStatement || onlyStatement.argument === null) {
|
|
5050
5015
|
return false;
|
|
5051
5016
|
}
|
|
@@ -5083,7 +5048,7 @@ var rule64 = createRule({
|
|
|
5083
5048
|
continue;
|
|
5084
5049
|
}
|
|
5085
5050
|
const propertyName = getPropertyName(propertyNode);
|
|
5086
|
-
if (!(0,
|
|
5051
|
+
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
5052
|
continue;
|
|
5088
5053
|
}
|
|
5089
5054
|
context.report({
|
|
@@ -5162,7 +5127,7 @@ var no_unsafe_alloc_default = rule65;
|
|
|
5162
5127
|
|
|
5163
5128
|
// dist/rules/no-unsafe-cast-to-trusted-types.js
|
|
5164
5129
|
var import_utils59 = require("@typescript-eslint/utils");
|
|
5165
|
-
var
|
|
5130
|
+
var import_ts_extras36 = require("ts-extras");
|
|
5166
5131
|
var TRUSTED_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
5167
5132
|
"TrustedHTML",
|
|
5168
5133
|
"TrustedScript",
|
|
@@ -5176,7 +5141,7 @@ var getTypeName = (node) => {
|
|
|
5176
5141
|
};
|
|
5177
5142
|
var isTrustedTypeNode = (node) => {
|
|
5178
5143
|
const typeName = getTypeName(node);
|
|
5179
|
-
return (0,
|
|
5144
|
+
return (0, import_ts_extras36.isDefined)(typeName) && (0, import_ts_extras36.setHas)(TRUSTED_TYPE_NAMES, typeName);
|
|
5180
5145
|
};
|
|
5181
5146
|
var getExpressionCalleeName = (expression) => {
|
|
5182
5147
|
if (expression.type !== import_utils59.AST_NODE_TYPES.CallExpression) {
|
|
@@ -5192,40 +5157,38 @@ var getExpressionCalleeName = (expression) => {
|
|
|
5192
5157
|
};
|
|
5193
5158
|
var isKnownTrustedFactoryCall = (expression) => {
|
|
5194
5159
|
const calleeName = getExpressionCalleeName(expression);
|
|
5195
|
-
if (!(0,
|
|
5160
|
+
if (!(0, import_ts_extras36.isDefined)(calleeName)) {
|
|
5196
5161
|
return false;
|
|
5197
5162
|
}
|
|
5198
5163
|
return /sanitize|createhtml|createscripturl|createscript|trusted/v.test(calleeName.toLowerCase());
|
|
5199
5164
|
};
|
|
5200
5165
|
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
|
-
});
|
|
5166
|
+
create: (context) => ({
|
|
5167
|
+
TSAsExpression(node) {
|
|
5168
|
+
if (!isTrustedTypeNode(node.typeAnnotation)) {
|
|
5169
|
+
return;
|
|
5226
5170
|
}
|
|
5227
|
-
|
|
5228
|
-
|
|
5171
|
+
if (isKnownTrustedFactoryCall(node.expression)) {
|
|
5172
|
+
return;
|
|
5173
|
+
}
|
|
5174
|
+
context.report({
|
|
5175
|
+
messageId: "default",
|
|
5176
|
+
node
|
|
5177
|
+
});
|
|
5178
|
+
},
|
|
5179
|
+
TSTypeAssertion(node) {
|
|
5180
|
+
if (!isTrustedTypeNode(node.typeAnnotation)) {
|
|
5181
|
+
return;
|
|
5182
|
+
}
|
|
5183
|
+
if (isKnownTrustedFactoryCall(node.expression)) {
|
|
5184
|
+
return;
|
|
5185
|
+
}
|
|
5186
|
+
context.report({
|
|
5187
|
+
messageId: "default",
|
|
5188
|
+
node
|
|
5189
|
+
});
|
|
5190
|
+
}
|
|
5191
|
+
}),
|
|
5229
5192
|
meta: {
|
|
5230
5193
|
deprecated: false,
|
|
5231
5194
|
docs: {
|
|
@@ -5246,14 +5209,14 @@ var no_unsafe_cast_to_trusted_types_default = rule66;
|
|
|
5246
5209
|
|
|
5247
5210
|
// dist/rules/no-window-open-without-noopener.js
|
|
5248
5211
|
var import_utils60 = require("@typescript-eslint/utils");
|
|
5249
|
-
var
|
|
5212
|
+
var import_ts_extras37 = require("ts-extras");
|
|
5250
5213
|
var getStaticStringValue7 = (node) => {
|
|
5251
5214
|
if (node.type === import_utils60.AST_NODE_TYPES.Literal && typeof node.value === "string") {
|
|
5252
5215
|
return node.value;
|
|
5253
5216
|
}
|
|
5254
5217
|
if (node.type === import_utils60.AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) {
|
|
5255
|
-
const firstQuasi = (0,
|
|
5256
|
-
if (!(0,
|
|
5218
|
+
const firstQuasi = (0, import_ts_extras37.arrayFirst)(node.quasis);
|
|
5219
|
+
if (!(0, import_ts_extras37.isDefined)(firstQuasi) || typeof firstQuasi.value.cooked !== "string") {
|
|
5257
5220
|
return void 0;
|
|
5258
5221
|
}
|
|
5259
5222
|
return firstQuasi.value.cooked;
|
|
@@ -5266,7 +5229,7 @@ var isWindowOpenCallee = (callee) => {
|
|
|
5266
5229
|
}
|
|
5267
5230
|
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
5231
|
};
|
|
5269
|
-
var hasNoopenerToken = (features) => (0,
|
|
5232
|
+
var hasNoopenerToken = (features) => (0, import_ts_extras37.stringSplit)(features.toLowerCase(), ",").map((token) => token.trim()).some((token) => token === "noopener" || token.startsWith("noopener="));
|
|
5270
5233
|
var rule67 = createRule({
|
|
5271
5234
|
create(context) {
|
|
5272
5235
|
return {
|
|
@@ -5319,16 +5282,14 @@ var no_window_open_without_noopener_default = rule67;
|
|
|
5319
5282
|
|
|
5320
5283
|
// dist/rules/no-winjs-html-unsafe.js
|
|
5321
5284
|
var rule68 = createRule({
|
|
5322
|
-
create(context) {
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
};
|
|
5331
|
-
},
|
|
5285
|
+
create: (context) => ({
|
|
5286
|
+
"CallExpression[callee.object.object.name='WinJS'][callee.object.property.name='Utilities'][callee.property.name=/^(?:insertAdjacent|setInner|setOuter)HTMLUnsafe$/]"(node) {
|
|
5287
|
+
context.report({
|
|
5288
|
+
messageId: "default",
|
|
5289
|
+
node
|
|
5290
|
+
});
|
|
5291
|
+
}
|
|
5292
|
+
}),
|
|
5332
5293
|
meta: {
|
|
5333
5294
|
deprecated: false,
|
|
5334
5295
|
docs: {
|
|
@@ -5563,7 +5524,7 @@ var createNamedConfig = (name, config = {}) => ({
|
|
|
5563
5524
|
name
|
|
5564
5525
|
});
|
|
5565
5526
|
var createAngularConfig = (plugin) => [
|
|
5566
|
-
createNamedConfig("SDL Angular Security", {
|
|
5527
|
+
createNamedConfig("\u{1F510} SDL: Angular Security", {
|
|
5567
5528
|
plugins: {
|
|
5568
5529
|
sdl: plugin
|
|
5569
5530
|
},
|
|
@@ -5576,7 +5537,7 @@ var createAngularConfig = (plugin) => [
|
|
|
5576
5537
|
})
|
|
5577
5538
|
];
|
|
5578
5539
|
var createAngularJsConfig = (plugin) => [
|
|
5579
|
-
createNamedConfig("SDL AngularJS Security", {
|
|
5540
|
+
createNamedConfig("\u{1F510} SDL: AngularJS Security", {
|
|
5580
5541
|
plugins: {
|
|
5581
5542
|
sdl: plugin
|
|
5582
5543
|
},
|
|
@@ -5590,7 +5551,7 @@ var createAngularJsConfig = (plugin) => [
|
|
|
5590
5551
|
})
|
|
5591
5552
|
];
|
|
5592
5553
|
var createCommonConfig = (plugin) => [
|
|
5593
|
-
createNamedConfig("SDL Common Web Security", {
|
|
5554
|
+
createNamedConfig("\u{1F510} SDL: Common Web Security", {
|
|
5594
5555
|
plugins: {
|
|
5595
5556
|
sdl: plugin
|
|
5596
5557
|
},
|
|
@@ -5631,7 +5592,7 @@ var createCommonConfig = (plugin) => [
|
|
|
5631
5592
|
})
|
|
5632
5593
|
];
|
|
5633
5594
|
var createElectronConfig = (plugin) => [
|
|
5634
|
-
createNamedConfig("SDL Electron Security", {
|
|
5595
|
+
createNamedConfig("\u{1F510} SDL: Electron Security", {
|
|
5635
5596
|
plugins: {
|
|
5636
5597
|
sdl: plugin
|
|
5637
5598
|
},
|
|
@@ -5660,7 +5621,7 @@ var createElectronConfig = (plugin) => [
|
|
|
5660
5621
|
})
|
|
5661
5622
|
];
|
|
5662
5623
|
var createNodeConfig = (plugin) => [
|
|
5663
|
-
createNamedConfig("SDL Node.js Runtime Safety", {
|
|
5624
|
+
createNamedConfig("\u{1F510} SDL: Node.js Runtime Safety", {
|
|
5664
5625
|
plugins: {
|
|
5665
5626
|
n: nodeEslintPlugin
|
|
5666
5627
|
},
|
|
@@ -5668,7 +5629,7 @@ var createNodeConfig = (plugin) => [
|
|
|
5668
5629
|
"n/no-deprecated-api": "error"
|
|
5669
5630
|
}
|
|
5670
5631
|
}),
|
|
5671
|
-
createNamedConfig("SDL Node.js Security", {
|
|
5632
|
+
createNamedConfig("\u{1F510} SDL: Node.js Security", {
|
|
5672
5633
|
plugins: {
|
|
5673
5634
|
sdl: plugin
|
|
5674
5635
|
},
|
|
@@ -5689,7 +5650,7 @@ var createNodeConfig = (plugin) => [
|
|
|
5689
5650
|
})
|
|
5690
5651
|
];
|
|
5691
5652
|
var createReactConfig = (plugin) => [
|
|
5692
|
-
createNamedConfig("SDL React JSX Support", {
|
|
5653
|
+
createNamedConfig("\u{1F510} SDL: React JSX Support", {
|
|
5693
5654
|
languageOptions: {
|
|
5694
5655
|
parserOptions: {
|
|
5695
5656
|
ecmaFeatures: {
|
|
@@ -5698,14 +5659,14 @@ var createReactConfig = (plugin) => [
|
|
|
5698
5659
|
}
|
|
5699
5660
|
}
|
|
5700
5661
|
}),
|
|
5701
|
-
createNamedConfig("SDL React Security", {
|
|
5662
|
+
createNamedConfig("\u{1F510} SDL: React Security", {
|
|
5702
5663
|
plugins: {
|
|
5703
5664
|
sdl: plugin
|
|
5704
5665
|
}
|
|
5705
5666
|
})
|
|
5706
5667
|
];
|
|
5707
5668
|
var createTypeScriptConfig = (plugin) => [
|
|
5708
|
-
createNamedConfig("SDL TypeScript Parser Support", {
|
|
5669
|
+
createNamedConfig("\u{1F510} SDL: TypeScript Parser Support", {
|
|
5709
5670
|
languageOptions: {
|
|
5710
5671
|
parserOptions: {
|
|
5711
5672
|
ecmaVersion: "latest",
|
|
@@ -5713,7 +5674,7 @@ var createTypeScriptConfig = (plugin) => [
|
|
|
5713
5674
|
}
|
|
5714
5675
|
}
|
|
5715
5676
|
}),
|
|
5716
|
-
createNamedConfig("SDL TypeScript Security", {
|
|
5677
|
+
createNamedConfig("\u{1F510} SDL: TypeScript Security", {
|
|
5717
5678
|
files: [...typeScriptFiles],
|
|
5718
5679
|
languageOptions: {
|
|
5719
5680
|
parser: import_parser.default,
|
|
@@ -5739,7 +5700,7 @@ var createTypeScriptConfig = (plugin) => [
|
|
|
5739
5700
|
})
|
|
5740
5701
|
];
|
|
5741
5702
|
var createRequiredConfig = (configs2) => [
|
|
5742
|
-
createNamedConfig("SDL Required Security Baseline"),
|
|
5703
|
+
createNamedConfig("\u{1F510} SDL: Required Security Baseline"),
|
|
5743
5704
|
...configs2.angular,
|
|
5744
5705
|
...configs2.angularjs,
|
|
5745
5706
|
...configs2.common,
|
|
@@ -5748,10 +5709,10 @@ var createRequiredConfig = (configs2) => [
|
|
|
5748
5709
|
...configs2.react
|
|
5749
5710
|
];
|
|
5750
5711
|
var createRecommendedConfig = (configs2) => [
|
|
5751
|
-
createNamedConfig("SDL Recommended Security Baseline"),
|
|
5712
|
+
createNamedConfig("\u{1F510} SDL: Recommended Security Baseline"),
|
|
5752
5713
|
...configs2.required,
|
|
5753
5714
|
...configs2.typescript,
|
|
5754
|
-
createNamedConfig("SDL Recommended Security Plugins", {
|
|
5715
|
+
createNamedConfig("\u{1F510} SDL: Recommended Security Plugins", {
|
|
5755
5716
|
plugins: {
|
|
5756
5717
|
security: securityEslintPlugin
|
|
5757
5718
|
}
|