eslint-plugin-sdl-2 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5316 -0
- package/LICENSE +21 -0
- package/README.md +133 -0
- package/dist/_internal/ast-utils.d.ts +17 -0
- package/dist/_internal/ast-utils.d.ts.map +1 -0
- package/dist/_internal/ast-utils.js +93 -0
- package/dist/_internal/ast-utils.js.map +1 -0
- package/dist/_internal/config-references.d.ts +5 -0
- package/dist/_internal/config-references.d.ts.map +1 -0
- package/dist/_internal/config-references.js +13 -0
- package/dist/_internal/config-references.js.map +1 -0
- package/dist/_internal/create-rule.d.ts +9 -0
- package/dist/_internal/create-rule.d.ts.map +1 -0
- package/dist/_internal/create-rule.js +6 -0
- package/dist/_internal/create-rule.js.map +1 -0
- package/dist/_internal/domparser.d.ts +19 -0
- package/dist/_internal/domparser.d.ts.map +1 -0
- package/dist/_internal/domparser.js +45 -0
- package/dist/_internal/domparser.js.map +1 -0
- package/dist/_internal/electron-web-preferences.d.ts +14 -0
- package/dist/_internal/electron-web-preferences.d.ts.map +1 -0
- package/dist/_internal/electron-web-preferences.js +63 -0
- package/dist/_internal/electron-web-preferences.js.map +1 -0
- package/dist/_internal/estree-utils.d.ts +51 -0
- package/dist/_internal/estree-utils.d.ts.map +1 -0
- package/dist/_internal/estree-utils.js +112 -0
- package/dist/_internal/estree-utils.js.map +1 -0
- package/dist/_internal/node-tls-config.d.ts +44 -0
- package/dist/_internal/node-tls-config.d.ts.map +1 -0
- package/dist/_internal/node-tls-config.js +101 -0
- package/dist/_internal/node-tls-config.js.map +1 -0
- package/dist/_internal/rules-registry.d.ts +10 -0
- package/dist/_internal/rules-registry.d.ts.map +1 -0
- package/dist/_internal/rules-registry.js +148 -0
- package/dist/_internal/rules-registry.js.map +1 -0
- package/dist/_internal/script-element.d.ts +7 -0
- package/dist/_internal/script-element.d.ts.map +1 -0
- package/dist/_internal/script-element.js +46 -0
- package/dist/_internal/script-element.js.map +1 -0
- package/dist/_internal/worker-code-loading.d.ts +69 -0
- package/dist/_internal/worker-code-loading.d.ts.map +1 -0
- package/dist/_internal/worker-code-loading.js +134 -0
- package/dist/_internal/worker-code-loading.js.map +1 -0
- package/dist/plugin.cjs +6036 -0
- package/dist/plugin.cjs.map +7 -0
- package/dist/plugin.d.cts +11 -0
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +235 -0
- package/dist/plugin.js.map +1 -0
- package/dist/rules/no-angular-bypass-sanitizer.d.ts +5 -0
- package/dist/rules/no-angular-bypass-sanitizer.d.ts.map +1 -0
- package/dist/rules/no-angular-bypass-sanitizer.js +32 -0
- package/dist/rules/no-angular-bypass-sanitizer.js.map +1 -0
- package/dist/rules/no-angular-bypass-security-trust-html.d.ts +5 -0
- package/dist/rules/no-angular-bypass-security-trust-html.d.ts.map +1 -0
- package/dist/rules/no-angular-bypass-security-trust-html.js +51 -0
- package/dist/rules/no-angular-bypass-security-trust-html.js.map +1 -0
- package/dist/rules/no-angular-innerhtml-binding.d.ts +5 -0
- package/dist/rules/no-angular-innerhtml-binding.d.ts.map +1 -0
- package/dist/rules/no-angular-innerhtml-binding.js +57 -0
- package/dist/rules/no-angular-innerhtml-binding.js.map +1 -0
- package/dist/rules/no-angular-sanitization-trusted-urls.d.ts +5 -0
- package/dist/rules/no-angular-sanitization-trusted-urls.d.ts.map +1 -0
- package/dist/rules/no-angular-sanitization-trusted-urls.js +32 -0
- package/dist/rules/no-angular-sanitization-trusted-urls.js.map +1 -0
- package/dist/rules/no-angularjs-bypass-sce.d.ts +5 -0
- package/dist/rules/no-angularjs-bypass-sce.d.ts.map +1 -0
- package/dist/rules/no-angularjs-bypass-sce.js +80 -0
- package/dist/rules/no-angularjs-bypass-sce.js.map +1 -0
- package/dist/rules/no-angularjs-enable-svg.d.ts +5 -0
- package/dist/rules/no-angularjs-enable-svg.d.ts.map +1 -0
- package/dist/rules/no-angularjs-enable-svg.js +48 -0
- package/dist/rules/no-angularjs-enable-svg.js.map +1 -0
- package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.d.ts +5 -0
- package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.d.ts.map +1 -0
- package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.js +64 -0
- package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.js.map +1 -0
- package/dist/rules/no-angularjs-sanitization-whitelist.d.ts +5 -0
- package/dist/rules/no-angularjs-sanitization-whitelist.d.ts.map +1 -0
- package/dist/rules/no-angularjs-sanitization-whitelist.js +32 -0
- package/dist/rules/no-angularjs-sanitization-whitelist.js.map +1 -0
- package/dist/rules/no-angularjs-sce-resource-url-wildcard.d.ts +5 -0
- package/dist/rules/no-angularjs-sce-resource-url-wildcard.d.ts.map +1 -0
- package/dist/rules/no-angularjs-sce-resource-url-wildcard.js +69 -0
- package/dist/rules/no-angularjs-sce-resource-url-wildcard.js.map +1 -0
- package/dist/rules/no-child-process-exec.d.ts +5 -0
- package/dist/rules/no-child-process-exec.d.ts.map +1 -0
- package/dist/rules/no-child-process-exec.js +141 -0
- package/dist/rules/no-child-process-exec.js.map +1 -0
- package/dist/rules/no-child-process-shell-true.d.ts +5 -0
- package/dist/rules/no-child-process-shell-true.d.ts.map +1 -0
- package/dist/rules/no-child-process-shell-true.js +89 -0
- package/dist/rules/no-child-process-shell-true.js.map +1 -0
- package/dist/rules/no-cookies.d.ts +5 -0
- package/dist/rules/no-cookies.d.ts.map +1 -0
- package/dist/rules/no-cookies.js +38 -0
- package/dist/rules/no-cookies.js.map +1 -0
- package/dist/rules/no-document-domain.d.ts +5 -0
- package/dist/rules/no-document-domain.d.ts.map +1 -0
- package/dist/rules/no-document-domain.js +41 -0
- package/dist/rules/no-document-domain.js.map +1 -0
- package/dist/rules/no-document-execcommand-insert-html.d.ts +5 -0
- package/dist/rules/no-document-execcommand-insert-html.d.ts.map +1 -0
- package/dist/rules/no-document-execcommand-insert-html.js +57 -0
- package/dist/rules/no-document-execcommand-insert-html.js.map +1 -0
- package/dist/rules/no-document-parse-html-unsafe.d.ts +5 -0
- package/dist/rules/no-document-parse-html-unsafe.d.ts.map +1 -0
- package/dist/rules/no-document-parse-html-unsafe.js +67 -0
- package/dist/rules/no-document-parse-html-unsafe.js.map +1 -0
- package/dist/rules/no-document-write.d.ts +5 -0
- package/dist/rules/no-document-write.d.ts.map +1 -0
- package/dist/rules/no-document-write.js +40 -0
- package/dist/rules/no-document-write.js.map +1 -0
- package/dist/rules/no-domparser-html-without-sanitization.d.ts +5 -0
- package/dist/rules/no-domparser-html-without-sanitization.d.ts.map +1 -0
- package/dist/rules/no-domparser-html-without-sanitization.js +56 -0
- package/dist/rules/no-domparser-html-without-sanitization.js.map +1 -0
- package/dist/rules/no-domparser-svg-without-sanitization.d.ts +5 -0
- package/dist/rules/no-domparser-svg-without-sanitization.d.ts.map +1 -0
- package/dist/rules/no-domparser-svg-without-sanitization.js +56 -0
- package/dist/rules/no-domparser-svg-without-sanitization.js.map +1 -0
- package/dist/rules/no-dynamic-import-unsafe-url.d.ts +5 -0
- package/dist/rules/no-dynamic-import-unsafe-url.d.ts.map +1 -0
- package/dist/rules/no-dynamic-import-unsafe-url.js +47 -0
- package/dist/rules/no-dynamic-import-unsafe-url.js.map +1 -0
- package/dist/rules/no-electron-allow-running-insecure-content.d.ts +5 -0
- package/dist/rules/no-electron-allow-running-insecure-content.d.ts.map +1 -0
- package/dist/rules/no-electron-allow-running-insecure-content.js +30 -0
- package/dist/rules/no-electron-allow-running-insecure-content.js.map +1 -0
- package/dist/rules/no-electron-dangerous-blink-features.d.ts +5 -0
- package/dist/rules/no-electron-dangerous-blink-features.d.ts.map +1 -0
- package/dist/rules/no-electron-dangerous-blink-features.js +89 -0
- package/dist/rules/no-electron-dangerous-blink-features.js.map +1 -0
- package/dist/rules/no-electron-disable-context-isolation.d.ts +5 -0
- package/dist/rules/no-electron-disable-context-isolation.d.ts.map +1 -0
- package/dist/rules/no-electron-disable-context-isolation.js +30 -0
- package/dist/rules/no-electron-disable-context-isolation.js.map +1 -0
- package/dist/rules/no-electron-disable-sandbox.d.ts +5 -0
- package/dist/rules/no-electron-disable-sandbox.d.ts.map +1 -0
- package/dist/rules/no-electron-disable-sandbox.js +30 -0
- package/dist/rules/no-electron-disable-sandbox.js.map +1 -0
- package/dist/rules/no-electron-disable-web-security.d.ts +5 -0
- package/dist/rules/no-electron-disable-web-security.d.ts.map +1 -0
- package/dist/rules/no-electron-disable-web-security.js +30 -0
- package/dist/rules/no-electron-disable-web-security.js.map +1 -0
- package/dist/rules/no-electron-enable-remote-module.d.ts +5 -0
- package/dist/rules/no-electron-enable-remote-module.d.ts.map +1 -0
- package/dist/rules/no-electron-enable-remote-module.js +30 -0
- package/dist/rules/no-electron-enable-remote-module.js.map +1 -0
- package/dist/rules/no-electron-enable-webview-tag.d.ts +5 -0
- package/dist/rules/no-electron-enable-webview-tag.d.ts.map +1 -0
- package/dist/rules/no-electron-enable-webview-tag.js +30 -0
- package/dist/rules/no-electron-enable-webview-tag.js.map +1 -0
- package/dist/rules/no-electron-experimental-features.d.ts +5 -0
- package/dist/rules/no-electron-experimental-features.d.ts.map +1 -0
- package/dist/rules/no-electron-experimental-features.js +30 -0
- package/dist/rules/no-electron-experimental-features.js.map +1 -0
- package/dist/rules/no-electron-expose-raw-ipc-renderer.d.ts +5 -0
- package/dist/rules/no-electron-expose-raw-ipc-renderer.d.ts.map +1 -0
- package/dist/rules/no-electron-expose-raw-ipc-renderer.js +108 -0
- package/dist/rules/no-electron-expose-raw-ipc-renderer.js.map +1 -0
- package/dist/rules/no-electron-insecure-certificate-error-handler.d.ts +5 -0
- package/dist/rules/no-electron-insecure-certificate-error-handler.d.ts.map +1 -0
- package/dist/rules/no-electron-insecure-certificate-error-handler.js +91 -0
- package/dist/rules/no-electron-insecure-certificate-error-handler.js.map +1 -0
- package/dist/rules/no-electron-insecure-certificate-verify-proc.d.ts +5 -0
- package/dist/rules/no-electron-insecure-certificate-verify-proc.d.ts.map +1 -0
- package/dist/rules/no-electron-insecure-certificate-verify-proc.js +75 -0
- package/dist/rules/no-electron-insecure-certificate-verify-proc.js.map +1 -0
- package/dist/rules/no-electron-insecure-permission-request-handler.d.ts +5 -0
- package/dist/rules/no-electron-insecure-permission-request-handler.d.ts.map +1 -0
- package/dist/rules/no-electron-insecure-permission-request-handler.js +75 -0
- package/dist/rules/no-electron-insecure-permission-request-handler.js.map +1 -0
- package/dist/rules/no-electron-node-integration.d.ts +5 -0
- package/dist/rules/no-electron-node-integration.d.ts.map +1 -0
- package/dist/rules/no-electron-node-integration.js +52 -0
- package/dist/rules/no-electron-node-integration.js.map +1 -0
- package/dist/rules/no-electron-permission-check-handler-allow-all.d.ts +5 -0
- package/dist/rules/no-electron-permission-check-handler-allow-all.d.ts.map +1 -0
- package/dist/rules/no-electron-permission-check-handler-allow-all.js +63 -0
- package/dist/rules/no-electron-permission-check-handler-allow-all.js.map +1 -0
- package/dist/rules/no-electron-unchecked-ipc-sender.d.ts +5 -0
- package/dist/rules/no-electron-unchecked-ipc-sender.d.ts.map +1 -0
- package/dist/rules/no-electron-unchecked-ipc-sender.js +90 -0
- package/dist/rules/no-electron-unchecked-ipc-sender.js.map +1 -0
- package/dist/rules/no-electron-unrestricted-navigation.d.ts +5 -0
- package/dist/rules/no-electron-unrestricted-navigation.d.ts.map +1 -0
- package/dist/rules/no-electron-unrestricted-navigation.js +100 -0
- package/dist/rules/no-electron-unrestricted-navigation.js.map +1 -0
- package/dist/rules/no-electron-untrusted-open-external.d.ts +5 -0
- package/dist/rules/no-electron-untrusted-open-external.d.ts.map +1 -0
- package/dist/rules/no-electron-untrusted-open-external.js +92 -0
- package/dist/rules/no-electron-untrusted-open-external.js.map +1 -0
- package/dist/rules/no-electron-webview-allowpopups.d.ts +5 -0
- package/dist/rules/no-electron-webview-allowpopups.d.ts.map +1 -0
- package/dist/rules/no-electron-webview-allowpopups.js +85 -0
- package/dist/rules/no-electron-webview-allowpopups.js.map +1 -0
- package/dist/rules/no-electron-webview-insecure-webpreferences.d.ts +5 -0
- package/dist/rules/no-electron-webview-insecure-webpreferences.d.ts.map +1 -0
- package/dist/rules/no-electron-webview-insecure-webpreferences.js +88 -0
- package/dist/rules/no-electron-webview-insecure-webpreferences.js.map +1 -0
- package/dist/rules/no-electron-webview-node-integration.d.ts +5 -0
- package/dist/rules/no-electron-webview-node-integration.d.ts.map +1 -0
- package/dist/rules/no-electron-webview-node-integration.js +107 -0
- package/dist/rules/no-electron-webview-node-integration.js.map +1 -0
- package/dist/rules/no-html-method.d.ts +5 -0
- package/dist/rules/no-html-method.d.ts.map +1 -0
- package/dist/rules/no-html-method.js +42 -0
- package/dist/rules/no-html-method.js.map +1 -0
- package/dist/rules/no-http-request-to-insecure-protocol.d.ts +5 -0
- package/dist/rules/no-http-request-to-insecure-protocol.d.ts.map +1 -0
- package/dist/rules/no-http-request-to-insecure-protocol.js +94 -0
- package/dist/rules/no-http-request-to-insecure-protocol.js.map +1 -0
- package/dist/rules/no-iframe-srcdoc.d.ts +5 -0
- package/dist/rules/no-iframe-srcdoc.d.ts.map +1 -0
- package/dist/rules/no-iframe-srcdoc.js +144 -0
- package/dist/rules/no-iframe-srcdoc.js.map +1 -0
- package/dist/rules/no-inner-html.d.ts +5 -0
- package/dist/rules/no-inner-html.d.ts.map +1 -0
- package/dist/rules/no-inner-html.js +67 -0
- package/dist/rules/no-inner-html.js.map +1 -0
- package/dist/rules/no-insecure-random.d.ts +5 -0
- package/dist/rules/no-insecure-random.d.ts.map +1 -0
- package/dist/rules/no-insecure-random.js +95 -0
- package/dist/rules/no-insecure-random.js.map +1 -0
- package/dist/rules/no-insecure-tls-agent-options.d.ts +5 -0
- package/dist/rules/no-insecure-tls-agent-options.d.ts.map +1 -0
- package/dist/rules/no-insecure-tls-agent-options.js +73 -0
- package/dist/rules/no-insecure-tls-agent-options.js.map +1 -0
- package/dist/rules/no-insecure-url.d.ts +12 -0
- package/dist/rules/no-insecure-url.d.ts.map +1 -0
- package/dist/rules/no-insecure-url.js +142 -0
- package/dist/rules/no-insecure-url.js.map +1 -0
- package/dist/rules/no-location-javascript-url.d.ts +5 -0
- package/dist/rules/no-location-javascript-url.d.ts.map +1 -0
- package/dist/rules/no-location-javascript-url.js +98 -0
- package/dist/rules/no-location-javascript-url.js.map +1 -0
- package/dist/rules/no-message-event-without-origin-check.d.ts +5 -0
- package/dist/rules/no-message-event-without-origin-check.d.ts.map +1 -0
- package/dist/rules/no-message-event-without-origin-check.js +183 -0
- package/dist/rules/no-message-event-without-origin-check.js.map +1 -0
- package/dist/rules/no-msapp-exec-unsafe.d.ts +5 -0
- package/dist/rules/no-msapp-exec-unsafe.d.ts.map +1 -0
- package/dist/rules/no-msapp-exec-unsafe.js +32 -0
- package/dist/rules/no-msapp-exec-unsafe.js.map +1 -0
- package/dist/rules/no-node-tls-check-server-identity-bypass.d.ts +5 -0
- package/dist/rules/no-node-tls-check-server-identity-bypass.d.ts.map +1 -0
- package/dist/rules/no-node-tls-check-server-identity-bypass.js +95 -0
- package/dist/rules/no-node-tls-check-server-identity-bypass.js.map +1 -0
- package/dist/rules/no-node-tls-legacy-protocol.d.ts +5 -0
- package/dist/rules/no-node-tls-legacy-protocol.d.ts.map +1 -0
- package/dist/rules/no-node-tls-legacy-protocol.js +106 -0
- package/dist/rules/no-node-tls-legacy-protocol.js.map +1 -0
- package/dist/rules/no-node-tls-reject-unauthorized-zero.d.ts +5 -0
- package/dist/rules/no-node-tls-reject-unauthorized-zero.d.ts.map +1 -0
- package/dist/rules/no-node-tls-reject-unauthorized-zero.js +93 -0
- package/dist/rules/no-node-tls-reject-unauthorized-zero.js.map +1 -0
- package/dist/rules/no-node-tls-security-level-zero.d.ts +5 -0
- package/dist/rules/no-node-tls-security-level-zero.d.ts.map +1 -0
- package/dist/rules/no-node-tls-security-level-zero.js +80 -0
- package/dist/rules/no-node-tls-security-level-zero.js.map +1 -0
- package/dist/rules/no-node-vm-run-in-context.d.ts +5 -0
- package/dist/rules/no-node-vm-run-in-context.d.ts.map +1 -0
- package/dist/rules/no-node-vm-run-in-context.js +186 -0
- package/dist/rules/no-node-vm-run-in-context.js.map +1 -0
- package/dist/rules/no-node-vm-source-text-module.d.ts +5 -0
- package/dist/rules/no-node-vm-source-text-module.d.ts.map +1 -0
- package/dist/rules/no-node-vm-source-text-module.js +126 -0
- package/dist/rules/no-node-vm-source-text-module.js.map +1 -0
- package/dist/rules/no-node-worker-threads-eval.d.ts +5 -0
- package/dist/rules/no-node-worker-threads-eval.d.ts.map +1 -0
- package/dist/rules/no-node-worker-threads-eval.js +151 -0
- package/dist/rules/no-node-worker-threads-eval.js.map +1 -0
- package/dist/rules/no-nonnull-assertion-on-security-input.d.ts +5 -0
- package/dist/rules/no-nonnull-assertion-on-security-input.d.ts.map +1 -0
- package/dist/rules/no-nonnull-assertion-on-security-input.js +48 -0
- package/dist/rules/no-nonnull-assertion-on-security-input.js.map +1 -0
- package/dist/rules/no-postmessage-star-origin.d.ts +5 -0
- package/dist/rules/no-postmessage-star-origin.d.ts.map +1 -0
- package/dist/rules/no-postmessage-star-origin.js +58 -0
- package/dist/rules/no-postmessage-star-origin.js.map +1 -0
- package/dist/rules/no-postmessage-without-origin-allowlist.d.ts +5 -0
- package/dist/rules/no-postmessage-without-origin-allowlist.d.ts.map +1 -0
- package/dist/rules/no-postmessage-without-origin-allowlist.js +80 -0
- package/dist/rules/no-postmessage-without-origin-allowlist.js.map +1 -0
- package/dist/rules/no-range-create-contextual-fragment.d.ts +5 -0
- package/dist/rules/no-range-create-contextual-fragment.d.ts.map +1 -0
- package/dist/rules/no-range-create-contextual-fragment.js +64 -0
- package/dist/rules/no-range-create-contextual-fragment.js.map +1 -0
- package/dist/rules/no-script-src-data-url.d.ts +5 -0
- package/dist/rules/no-script-src-data-url.d.ts.map +1 -0
- package/dist/rules/no-script-src-data-url.js +108 -0
- package/dist/rules/no-script-src-data-url.js.map +1 -0
- package/dist/rules/no-script-text.d.ts +5 -0
- package/dist/rules/no-script-text.d.ts.map +1 -0
- package/dist/rules/no-script-text.js +52 -0
- package/dist/rules/no-script-text.js.map +1 -0
- package/dist/rules/no-service-worker-unsafe-script-url.d.ts +5 -0
- package/dist/rules/no-service-worker-unsafe-script-url.d.ts.map +1 -0
- package/dist/rules/no-service-worker-unsafe-script-url.js +52 -0
- package/dist/rules/no-service-worker-unsafe-script-url.js.map +1 -0
- package/dist/rules/no-set-html-unsafe.d.ts +5 -0
- package/dist/rules/no-set-html-unsafe.d.ts.map +1 -0
- package/dist/rules/no-set-html-unsafe.js +48 -0
- package/dist/rules/no-set-html-unsafe.js.map +1 -0
- package/dist/rules/no-trusted-types-policy-pass-through.d.ts +5 -0
- package/dist/rules/no-trusted-types-policy-pass-through.d.ts.map +1 -0
- package/dist/rules/no-trusted-types-policy-pass-through.js +115 -0
- package/dist/rules/no-trusted-types-policy-pass-through.js.map +1 -0
- package/dist/rules/no-unsafe-alloc.d.ts +5 -0
- package/dist/rules/no-unsafe-alloc.d.ts.map +1 -0
- package/dist/rules/no-unsafe-alloc.js +51 -0
- package/dist/rules/no-unsafe-alloc.js.map +1 -0
- package/dist/rules/no-unsafe-cast-to-trusted-types.d.ts +5 -0
- package/dist/rules/no-unsafe-cast-to-trusted-types.d.ts.map +1 -0
- package/dist/rules/no-unsafe-cast-to-trusted-types.js +89 -0
- package/dist/rules/no-unsafe-cast-to-trusted-types.js.map +1 -0
- package/dist/rules/no-window-open-without-noopener.d.ts +5 -0
- package/dist/rules/no-window-open-without-noopener.d.ts.map +1 -0
- package/dist/rules/no-window-open-without-noopener.js +84 -0
- package/dist/rules/no-window-open-without-noopener.js.map +1 -0
- package/dist/rules/no-winjs-html-unsafe.d.ts +5 -0
- package/dist/rules/no-winjs-html-unsafe.d.ts.map +1 -0
- package/dist/rules/no-winjs-html-unsafe.js +32 -0
- package/dist/rules/no-winjs-html-unsafe.js.map +1 -0
- package/dist/rules/no-worker-blob-url.d.ts +5 -0
- package/dist/rules/no-worker-blob-url.d.ts.map +1 -0
- package/dist/rules/no-worker-blob-url.js +64 -0
- package/dist/rules/no-worker-blob-url.js.map +1 -0
- package/dist/rules/no-worker-data-url.d.ts +5 -0
- package/dist/rules/no-worker-data-url.d.ts.map +1 -0
- package/dist/rules/no-worker-data-url.js +67 -0
- package/dist/rules/no-worker-data-url.js.map +1 -0
- package/docs/rules/getting-started.md +70 -0
- package/docs/rules/no-angular-bypass-sanitizer.md +69 -0
- package/docs/rules/no-angular-bypass-security-trust-html.md +59 -0
- package/docs/rules/no-angular-innerhtml-binding.md +59 -0
- package/docs/rules/no-angular-sanitization-trusted-urls.md +64 -0
- package/docs/rules/no-angularjs-bypass-sce.md +64 -0
- package/docs/rules/no-angularjs-enable-svg.md +59 -0
- package/docs/rules/no-angularjs-ng-bind-html-without-sanitize.md +59 -0
- package/docs/rules/no-angularjs-sanitization-whitelist.md +63 -0
- package/docs/rules/no-angularjs-sce-resource-url-wildcard.md +62 -0
- package/docs/rules/no-child-process-exec.md +101 -0
- package/docs/rules/no-child-process-shell-true.md +59 -0
- package/docs/rules/no-cookies.md +61 -0
- package/docs/rules/no-document-domain.md +59 -0
- package/docs/rules/no-document-execcommand-insert-html.md +69 -0
- package/docs/rules/no-document-parse-html-unsafe.md +72 -0
- package/docs/rules/no-document-write.md +64 -0
- package/docs/rules/no-domparser-html-without-sanitization.md +59 -0
- package/docs/rules/no-domparser-svg-without-sanitization.md +71 -0
- package/docs/rules/no-dynamic-import-unsafe-url.md +81 -0
- package/docs/rules/no-electron-allow-running-insecure-content.md +69 -0
- package/docs/rules/no-electron-dangerous-blink-features.md +77 -0
- package/docs/rules/no-electron-disable-context-isolation.md +69 -0
- package/docs/rules/no-electron-disable-sandbox.md +69 -0
- package/docs/rules/no-electron-disable-web-security.md +69 -0
- package/docs/rules/no-electron-enable-remote-module.md +69 -0
- package/docs/rules/no-electron-enable-webview-tag.md +77 -0
- package/docs/rules/no-electron-experimental-features.md +77 -0
- package/docs/rules/no-electron-expose-raw-ipc-renderer.md +79 -0
- package/docs/rules/no-electron-insecure-certificate-error-handler.md +72 -0
- package/docs/rules/no-electron-insecure-certificate-verify-proc.md +63 -0
- package/docs/rules/no-electron-insecure-permission-request-handler.md +67 -0
- package/docs/rules/no-electron-node-integration.md +70 -0
- package/docs/rules/no-electron-permission-check-handler-allow-all.md +66 -0
- package/docs/rules/no-electron-unchecked-ipc-sender.md +62 -0
- package/docs/rules/no-electron-unrestricted-navigation.md +64 -0
- package/docs/rules/no-electron-untrusted-open-external.md +65 -0
- package/docs/rules/no-electron-webview-allowpopups.md +59 -0
- package/docs/rules/no-electron-webview-insecure-webpreferences.md +84 -0
- package/docs/rules/no-electron-webview-node-integration.md +59 -0
- package/docs/rules/no-html-method.md +58 -0
- package/docs/rules/no-http-request-to-insecure-protocol.md +59 -0
- package/docs/rules/no-iframe-srcdoc.md +76 -0
- package/docs/rules/no-inner-html.md +65 -0
- package/docs/rules/no-insecure-random.md +66 -0
- package/docs/rules/no-insecure-tls-agent-options.md +59 -0
- package/docs/rules/no-insecure-url.md +72 -0
- package/docs/rules/no-location-javascript-url.md +59 -0
- package/docs/rules/no-message-event-without-origin-check.md +82 -0
- package/docs/rules/no-msapp-exec-unsafe.md +59 -0
- package/docs/rules/no-node-tls-check-server-identity-bypass.md +88 -0
- package/docs/rules/no-node-tls-legacy-protocol.md +80 -0
- package/docs/rules/no-node-tls-reject-unauthorized-zero.md +61 -0
- package/docs/rules/no-node-tls-security-level-zero.md +77 -0
- package/docs/rules/no-node-vm-run-in-context.md +89 -0
- package/docs/rules/no-node-vm-source-text-module.md +79 -0
- package/docs/rules/no-node-worker-threads-eval.md +82 -0
- package/docs/rules/no-nonnull-assertion-on-security-input.md +59 -0
- package/docs/rules/no-postmessage-star-origin.md +59 -0
- package/docs/rules/no-postmessage-without-origin-allowlist.md +59 -0
- package/docs/rules/no-range-create-contextual-fragment.md +64 -0
- package/docs/rules/no-script-src-data-url.md +83 -0
- package/docs/rules/no-script-text.md +80 -0
- package/docs/rules/no-service-worker-unsafe-script-url.md +85 -0
- package/docs/rules/no-set-html-unsafe.md +64 -0
- package/docs/rules/no-trusted-types-policy-pass-through.md +68 -0
- package/docs/rules/no-unsafe-alloc.md +62 -0
- package/docs/rules/no-unsafe-cast-to-trusted-types.md +59 -0
- package/docs/rules/no-window-open-without-noopener.md +63 -0
- package/docs/rules/no-winjs-html-unsafe.md +60 -0
- package/docs/rules/no-worker-blob-url.md +86 -0
- package/docs/rules/no-worker-data-url.md +85 -0
- package/docs/rules/overview.md +111 -0
- package/docs/rules/presets/angular.md +35 -0
- package/docs/rules/presets/angularjs.md +36 -0
- package/docs/rules/presets/common.md +59 -0
- package/docs/rules/presets/electron.md +51 -0
- package/docs/rules/presets/index.md +26 -0
- package/docs/rules/presets/node.md +43 -0
- package/docs/rules/presets/react.md +33 -0
- package/docs/rules/presets/recommended.md +104 -0
- package/docs/rules/presets/required.md +99 -0
- package/docs/rules/presets/typescript.md +34 -0
- package/package.json +583 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: no-child-process-exec
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# no-child-process-exec
|
|
6
|
+
|
|
7
|
+
Disallow `child_process.exec()` and `child_process.execSync()` shell-backed execution APIs.
|
|
8
|
+
|
|
9
|
+
## Targeted pattern scope
|
|
10
|
+
|
|
11
|
+
This rule targets `exec()` and `execSync()` when they are imported from
|
|
12
|
+
`child_process` or `node:child_process`, destructured from `require(...)`, or
|
|
13
|
+
called through a namespace binding created from those modules.
|
|
14
|
+
|
|
15
|
+
## What this rule reports
|
|
16
|
+
|
|
17
|
+
This rule reports direct use of `child_process.exec()` and
|
|
18
|
+
`child_process.execSync()` because both APIs execute a command string through a
|
|
19
|
+
shell.
|
|
20
|
+
|
|
21
|
+
## Why this rule exists
|
|
22
|
+
|
|
23
|
+
Shell-backed command execution is harder to review safely than argv-separated
|
|
24
|
+
process launches. When user-controlled data is concatenated into a command
|
|
25
|
+
string, it can become command injection.
|
|
26
|
+
|
|
27
|
+
For SDL-oriented code review, `spawn()` and `execFile()` are generally easier
|
|
28
|
+
to reason about because they keep the executable path and the arguments
|
|
29
|
+
separate.
|
|
30
|
+
|
|
31
|
+
## ❌ Incorrect
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { exec } from "node:child_process";
|
|
35
|
+
|
|
36
|
+
exec(`git show ${userSuppliedRef}`);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
const { execSync } = require("child_process");
|
|
41
|
+
|
|
42
|
+
execSync("tar -xf " + archivePath);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import * as childProcess from "node:child_process";
|
|
47
|
+
|
|
48
|
+
childProcess.exec("convert " + inputPath);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## ✅ Correct
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { execFile } from "node:child_process";
|
|
55
|
+
|
|
56
|
+
execFile("git", ["show", userSuppliedRef]);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
const { spawn } = require("child_process");
|
|
61
|
+
|
|
62
|
+
spawn("tar", ["-xf", archivePath], { shell: false });
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Behavior and migration notes
|
|
66
|
+
|
|
67
|
+
This rule intentionally focuses on direct `child_process` bindings and does not
|
|
68
|
+
attempt to reason about custom wrapper utilities that may call `exec()`
|
|
69
|
+
internally.
|
|
70
|
+
|
|
71
|
+
## ESLint flat config example
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
75
|
+
|
|
76
|
+
export default [
|
|
77
|
+
{
|
|
78
|
+
plugins: { sdl },
|
|
79
|
+
rules: {
|
|
80
|
+
"sdl/no-child-process-exec": "error",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## When not to use it
|
|
87
|
+
|
|
88
|
+
If your project intentionally permits shell-backed command execution and you
|
|
89
|
+
already review all command construction paths carefully, this rule may be too
|
|
90
|
+
strict.
|
|
91
|
+
|
|
92
|
+
## Package documentation
|
|
93
|
+
|
|
94
|
+
- [Rule source](../../src/rules/no-child-process-exec.ts)
|
|
95
|
+
|
|
96
|
+
## Further reading
|
|
97
|
+
|
|
98
|
+
> **Rule catalog ID:** R062
|
|
99
|
+
|
|
100
|
+
- [Node.js child\_process documentation](https://nodejs.org/api/child_process.html)
|
|
101
|
+
- [OWASP Command Injection](https://owasp.org/www-community/attacks/Command_Injection)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# no-child-process-shell-true
|
|
2
|
+
|
|
3
|
+
Disallow Node child process options that enable `shell: true`.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
Node child\_process execution options that enable `shell: true`.
|
|
8
|
+
|
|
9
|
+
## What this rule reports
|
|
10
|
+
|
|
11
|
+
`spawn(...)` / `execFile(...)` options objects with `shell: true`.
|
|
12
|
+
|
|
13
|
+
## Why this rule exists
|
|
14
|
+
|
|
15
|
+
Shell execution expands injection risk when command fragments include user-influenced input.
|
|
16
|
+
|
|
17
|
+
## ❌ Incorrect
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
spawn("cmd", ["/c", command], { shell: true });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## ✅ Correct
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
spawn("node", ["script.js"], { shell: false });
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## ESLint flat config example
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
33
|
+
|
|
34
|
+
export default [
|
|
35
|
+
{
|
|
36
|
+
plugins: { sdl },
|
|
37
|
+
|
|
38
|
+
rules: {
|
|
39
|
+
"sdl/no-child-process-shell-true": "error",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## When not to use it
|
|
46
|
+
|
|
47
|
+
Disable only when shell execution is unavoidable and all command fragments are strictly controlled and validated.
|
|
48
|
+
|
|
49
|
+
## Package documentation
|
|
50
|
+
|
|
51
|
+
- [Rule source](../../src/rules/no-child-process-shell-true.ts)
|
|
52
|
+
|
|
53
|
+
## Further reading
|
|
54
|
+
|
|
55
|
+
> **Rule catalog ID:** R032
|
|
56
|
+
|
|
57
|
+
- [OWASP Top 10: Injection](https://owasp.org/www-project-top-ten/)
|
|
58
|
+
|
|
59
|
+
- [OWASP Top 10: Security Misconfiguration](https://owasp.org/www-project-top-ten/)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# no-cookies
|
|
2
|
+
|
|
3
|
+
Disallow client-side cookie usage patterns that increase session and data risk.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets browser cookie read and write patterns, including direct
|
|
8
|
+
access to `document.cookie`.
|
|
9
|
+
|
|
10
|
+
## What this rule reports
|
|
11
|
+
|
|
12
|
+
This rule reports cookie usage in client code where safer or less exposed
|
|
13
|
+
storage patterns are preferred.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
Cookies are frequently sent over network requests and can expand leakage and
|
|
18
|
+
tampering risk when misconfigured.
|
|
19
|
+
|
|
20
|
+
## ❌ Incorrect
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
document.cookie = `sessionToken=${token}; path=/`;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## ✅ Correct
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
localStorage.setItem("sessionToken", token);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## ESLint flat config example
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
36
|
+
|
|
37
|
+
export default [
|
|
38
|
+
{
|
|
39
|
+
plugins: { sdl },
|
|
40
|
+
rules: {
|
|
41
|
+
"sdl/no-cookies": "error",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## When not to use it
|
|
48
|
+
|
|
49
|
+
Disable this rule when application requirements mandate cookie-backed sessions
|
|
50
|
+
with hardened attributes and server controls.
|
|
51
|
+
|
|
52
|
+
## Package documentation
|
|
53
|
+
|
|
54
|
+
- [Rule source](../../src/rules/no-cookies.ts)
|
|
55
|
+
|
|
56
|
+
## Further reading
|
|
57
|
+
|
|
58
|
+
> **Rule catalog ID:** R006
|
|
59
|
+
|
|
60
|
+
- [MDN: Using HTTP cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies)
|
|
61
|
+
- [Legacy rule inspiration](https://github.com/microsoft/tslint-microsoft-contrib/blob/master/src/noCookiesRule.ts)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# no-document-domain
|
|
2
|
+
|
|
3
|
+
Disallow writes to `document.domain` that weaken same-origin boundaries.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets assignments that modify `document.domain`.
|
|
8
|
+
|
|
9
|
+
## What this rule reports
|
|
10
|
+
|
|
11
|
+
This rule reports any direct write to `document.domain`.
|
|
12
|
+
|
|
13
|
+
## Why this rule exists
|
|
14
|
+
|
|
15
|
+
Changing `document.domain` can relax origin checks and create cross-origin trust
|
|
16
|
+
relationships that were not intended.
|
|
17
|
+
|
|
18
|
+
## ❌ Incorrect
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
document.domain = "example.com";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## ✅ Correct
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
// Keep default browser origin boundaries.
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## ESLint flat config example
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
34
|
+
|
|
35
|
+
export default [
|
|
36
|
+
{
|
|
37
|
+
plugins: { sdl },
|
|
38
|
+
rules: {
|
|
39
|
+
"sdl/no-document-domain": "error",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## When not to use it
|
|
46
|
+
|
|
47
|
+
Disable only for vetted legacy integrations that cannot be migrated away from
|
|
48
|
+
`document.domain`.
|
|
49
|
+
|
|
50
|
+
## Package documentation
|
|
51
|
+
|
|
52
|
+
- [Rule source](../../src/rules/no-document-domain.ts)
|
|
53
|
+
|
|
54
|
+
## Further reading
|
|
55
|
+
|
|
56
|
+
> **Rule catalog ID:** R007
|
|
57
|
+
|
|
58
|
+
- [MDN: `document.domain`](https://developer.mozilla.org/en-US/docs/Web/API/Document/domain)
|
|
59
|
+
- [MDN: Same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#changing_origin)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# no-document-execcommand-insert-html
|
|
2
|
+
|
|
3
|
+
Disallow `document.execCommand("insertHTML", ...)` HTML insertion sinks.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets `Document.execCommand(...)` calls when the command name is the
|
|
8
|
+
static string `insertHTML` and the inserted value is non-empty.
|
|
9
|
+
|
|
10
|
+
## What this rule reports
|
|
11
|
+
|
|
12
|
+
This rule reports `document.execCommand("insertHTML", false, html)` style calls
|
|
13
|
+
because that command inserts markup into the current selection or editing host.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
`execCommand("insertHTML", ...)` is an HTML sink. When the inserted markup comes
|
|
18
|
+
from untrusted or weakly reviewed input, it can create XSS exposure in rich-text
|
|
19
|
+
editors and other editable surfaces.
|
|
20
|
+
|
|
21
|
+
## ❌ Incorrect
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
document.execCommand("insertHTML", false, userHtml);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## ✅ Correct
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
document.execCommand("insertText", false, userText);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Behavior and migration notes
|
|
34
|
+
|
|
35
|
+
This rule intentionally focuses only on the `insertHTML` command and ignores
|
|
36
|
+
other `execCommand(...)` usages such as `copy` or `bold`. Empty string
|
|
37
|
+
insertions are also ignored to keep the rule narrow and low-noise.
|
|
38
|
+
|
|
39
|
+
## ESLint flat config example
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
43
|
+
|
|
44
|
+
export default [
|
|
45
|
+
{
|
|
46
|
+
plugins: { sdl },
|
|
47
|
+
rules: {
|
|
48
|
+
"sdl/no-document-execcommand-insert-html": "error",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## When not to use it
|
|
55
|
+
|
|
56
|
+
Disable this rule only if your editor pipeline has a reviewed requirement to
|
|
57
|
+
insert trusted HTML through `execCommand("insertHTML", ...)` and that trust
|
|
58
|
+
boundary is documented.
|
|
59
|
+
|
|
60
|
+
## Package documentation
|
|
61
|
+
|
|
62
|
+
- [Rule source](../../src/rules/no-document-execcommand-insert-html.ts)
|
|
63
|
+
|
|
64
|
+
## Further reading
|
|
65
|
+
|
|
66
|
+
> **Rule catalog ID:** R060
|
|
67
|
+
|
|
68
|
+
- [MDN: `Document.execCommand()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand)
|
|
69
|
+
- [OWASP Cross Site Scripting Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# no-document-parse-html-unsafe
|
|
2
|
+
|
|
3
|
+
Disallow `Document.parseHTMLUnsafe()` calls that parse HTML through the unsafe document-construction path.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets direct `Document.parseHTMLUnsafe(...)` calls, including
|
|
8
|
+
`window.Document.parseHTMLUnsafe(...)` and `globalThis.Document.parseHTMLUnsafe(...)`.
|
|
9
|
+
|
|
10
|
+
## What this rule reports
|
|
11
|
+
|
|
12
|
+
This rule reports `Document.parseHTMLUnsafe(...)` because that API name is the
|
|
13
|
+
explicit unsafe parsing path for creating a new `Document` from HTML.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
`Document.parseHTMLUnsafe()` does not guarantee that XSS-unsafe markup will be
|
|
18
|
+
removed. That makes it a poor default for application code that handles HTML
|
|
19
|
+
input, especially when a safer `Document.parseHTML()` path or a reviewed
|
|
20
|
+
sanitization pipeline is available.
|
|
21
|
+
|
|
22
|
+
## ❌ Incorrect
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
const parsed = Document.parseHTMLUnsafe(userHtml);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## ✅ Correct
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
const parsed = Document.parseHTML(userHtml);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Behavior and migration notes
|
|
35
|
+
|
|
36
|
+
This rule intentionally reports the unsafe API itself instead of trying to infer
|
|
37
|
+
whether an optional sanitizer argument is strong enough. If you truly need the
|
|
38
|
+
unsafe API for a reviewed edge case, disable the rule locally and document that
|
|
39
|
+
trust boundary.
|
|
40
|
+
|
|
41
|
+
## ESLint flat config example
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
45
|
+
|
|
46
|
+
export default [
|
|
47
|
+
{
|
|
48
|
+
plugins: { sdl },
|
|
49
|
+
rules: {
|
|
50
|
+
"sdl/no-document-parse-html-unsafe": "error",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## When not to use it
|
|
57
|
+
|
|
58
|
+
Disable only if your codebase has a reviewed requirement to use
|
|
59
|
+
`Document.parseHTMLUnsafe()` and that call site is already protected by a
|
|
60
|
+
sanitization policy this rule cannot verify.
|
|
61
|
+
|
|
62
|
+
## Package documentation
|
|
63
|
+
|
|
64
|
+
- [Rule source](../../src/rules/no-document-parse-html-unsafe.ts)
|
|
65
|
+
|
|
66
|
+
## Further reading
|
|
67
|
+
|
|
68
|
+
> **Rule catalog ID:** R056
|
|
69
|
+
|
|
70
|
+
- [MDN: `Document.parseHTMLUnsafe()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/parseHTMLUnsafe_static)
|
|
71
|
+
- [MDN: `Document.parseHTML()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/parseHTML_static)
|
|
72
|
+
- [Trusted Types API](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# no-document-write
|
|
2
|
+
|
|
3
|
+
Disallow direct DOM writes through `document.write` and `document.writeln`.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets:
|
|
8
|
+
|
|
9
|
+
- `document.write(...)`
|
|
10
|
+
- `document.writeln(...)`.
|
|
11
|
+
|
|
12
|
+
## What this rule reports
|
|
13
|
+
|
|
14
|
+
This rule reports direct document stream writes that inject HTML into the page.
|
|
15
|
+
|
|
16
|
+
## Why this rule exists
|
|
17
|
+
|
|
18
|
+
`document.write` APIs are prone to injection and can overwrite document state in
|
|
19
|
+
unpredictable ways.
|
|
20
|
+
|
|
21
|
+
## ❌ Incorrect
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
document.write(`<div>${userInput}</div>`);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## ✅ Correct
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
const node = document.createElement("div");
|
|
31
|
+
node.textContent = userInput;
|
|
32
|
+
document.body.append(node);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## ESLint flat config example
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
39
|
+
|
|
40
|
+
export default [
|
|
41
|
+
{
|
|
42
|
+
plugins: { sdl },
|
|
43
|
+
rules: {
|
|
44
|
+
"sdl/no-document-write": "error",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## When not to use it
|
|
51
|
+
|
|
52
|
+
Disable only in controlled legacy rendering flows that cannot migrate from
|
|
53
|
+
document stream writes.
|
|
54
|
+
|
|
55
|
+
## Package documentation
|
|
56
|
+
|
|
57
|
+
- [Rule source](../../src/rules/no-document-write.ts)
|
|
58
|
+
|
|
59
|
+
## Further reading
|
|
60
|
+
|
|
61
|
+
> **Rule catalog ID:** R008
|
|
62
|
+
|
|
63
|
+
- [MDN: `document.write`](https://developer.mozilla.org/en-US/docs/Web/API/Document/write)
|
|
64
|
+
- [Legacy rule inspiration](https://github.com/microsoft/tslint-microsoft-contrib/blob/master/src/noDocumentWriteRule.ts)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# no-domparser-html-without-sanitization
|
|
2
|
+
|
|
3
|
+
Disallow `DOMParser.parseFromString(..., "text/html")` on unsanitized input.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
`DOMParser.parseFromString(..., "text/html")` on unsanitized input.
|
|
8
|
+
|
|
9
|
+
## What this rule reports
|
|
10
|
+
|
|
11
|
+
HTML parsing calls where the source value is not sanitized by an explicit policy function.
|
|
12
|
+
|
|
13
|
+
## Why this rule exists
|
|
14
|
+
|
|
15
|
+
Parsing unsanitized HTML creates unsafe document fragments and XSS surfaces.
|
|
16
|
+
|
|
17
|
+
## ❌ Incorrect
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
new DOMParser().parseFromString(userHtml, "text/html");
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## ✅ Correct
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
new DOMParser().parseFromString(sanitize(userHtml), "text/html");
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## ESLint flat config example
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
33
|
+
|
|
34
|
+
export default [
|
|
35
|
+
{
|
|
36
|
+
plugins: { sdl },
|
|
37
|
+
|
|
38
|
+
rules: {
|
|
39
|
+
"sdl/no-domparser-html-without-sanitization": "error",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## When not to use it
|
|
46
|
+
|
|
47
|
+
Disable only if the parsed HTML is produced by a reviewed sanitizer or a fully trusted template source.
|
|
48
|
+
|
|
49
|
+
## Package documentation
|
|
50
|
+
|
|
51
|
+
- [Rule source](../../src/rules/no-domparser-html-without-sanitization.ts)
|
|
52
|
+
|
|
53
|
+
## Further reading
|
|
54
|
+
|
|
55
|
+
> **Rule catalog ID:** R033
|
|
56
|
+
|
|
57
|
+
- [OWASP Top 10: Injection](https://owasp.org/www-project-top-ten/)
|
|
58
|
+
|
|
59
|
+
- [OWASP Top 10: Security Misconfiguration](https://owasp.org/www-project-top-ten/)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: no-domparser-svg-without-sanitization
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# no-domparser-svg-without-sanitization
|
|
6
|
+
|
|
7
|
+
Disallow `DOMParser.parseFromString(..., "image/svg+xml")` on unsanitized input.
|
|
8
|
+
|
|
9
|
+
## Targeted pattern scope
|
|
10
|
+
|
|
11
|
+
This rule targets `DOMParser.parseFromString(...)` when the MIME type is the
|
|
12
|
+
static string `"image/svg+xml"` and the source value is not passed through an
|
|
13
|
+
explicit sanitizer or trusted-policy helper.
|
|
14
|
+
|
|
15
|
+
## What this rule reports
|
|
16
|
+
|
|
17
|
+
This rule reports SVG parsing calls where the input is not sanitized first.
|
|
18
|
+
|
|
19
|
+
## Why this rule exists
|
|
20
|
+
|
|
21
|
+
SVG content can carry active content such as event handlers, script-adjacent
|
|
22
|
+
behavior, and external references. Parsing unsanitized SVG into a document can
|
|
23
|
+
create risky DOM fragments that are difficult to review safely.
|
|
24
|
+
|
|
25
|
+
## ❌ Incorrect
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
new DOMParser().parseFromString(userSvg, "image/svg+xml");
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## ✅ Correct
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
new DOMParser().parseFromString(sanitize(userSvg), "image/svg+xml");
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Behavior and migration notes
|
|
38
|
+
|
|
39
|
+
This rule intentionally focuses on the explicit SVG parsing sink. It does not
|
|
40
|
+
attempt to prove whether a non-matching helper name is actually safe.
|
|
41
|
+
|
|
42
|
+
## ESLint flat config example
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
46
|
+
|
|
47
|
+
export default [
|
|
48
|
+
{
|
|
49
|
+
plugins: { sdl },
|
|
50
|
+
rules: {
|
|
51
|
+
"sdl/no-domparser-svg-without-sanitization": "error",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## When not to use it
|
|
58
|
+
|
|
59
|
+
Disable this rule only if the parsed SVG always comes from a reviewed sanitizer
|
|
60
|
+
or a fully trusted source and that guarantee is documented.
|
|
61
|
+
|
|
62
|
+
## Package documentation
|
|
63
|
+
|
|
64
|
+
- [Rule source](../../src/rules/no-domparser-svg-without-sanitization.ts)
|
|
65
|
+
|
|
66
|
+
## Further reading
|
|
67
|
+
|
|
68
|
+
> **Rule catalog ID:** R066
|
|
69
|
+
|
|
70
|
+
- [MDN: `DOMParser.parseFromString()`](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString)
|
|
71
|
+
- [OWASP SVG Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/SVG_Security_Cheat_Sheet.html)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: no-dynamic-import-unsafe-url
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# no-dynamic-import-unsafe-url
|
|
6
|
+
|
|
7
|
+
Disallow dynamic `import()` calls that load code from `data:`, `blob:`, `javascript:`, and direct `URL.createObjectURL(...)` URLs.
|
|
8
|
+
|
|
9
|
+
## Targeted pattern scope
|
|
10
|
+
|
|
11
|
+
This rule targets direct `import(...)` expressions when the module specifier is
|
|
12
|
+
one of the following executable URL forms:
|
|
13
|
+
|
|
14
|
+
- a static `data:` URL
|
|
15
|
+
- a static `blob:` URL
|
|
16
|
+
- a static `javascript:` URL
|
|
17
|
+
- a direct `URL.createObjectURL(...)` call
|
|
18
|
+
|
|
19
|
+
## What this rule reports
|
|
20
|
+
|
|
21
|
+
This rule reports only direct unsafe dynamic-import specifiers. Indirect
|
|
22
|
+
variables and broader module-resolution policies are out of scope.
|
|
23
|
+
|
|
24
|
+
## Why this rule exists
|
|
25
|
+
|
|
26
|
+
Dynamic `import()` is an executable module-loading sink. Loading modules from
|
|
27
|
+
inline, generated, or review-hostile URLs makes trusted code boundaries harder
|
|
28
|
+
to audit and can undermine SDL expectations around reviewed module sources.
|
|
29
|
+
|
|
30
|
+
## ❌ Incorrect
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
await import("data:text/javascript,export default run()");
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
await import(URL.createObjectURL(workerBlob));
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## ✅ Correct
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
await import("./feature-module.js");
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Behavior and migration notes
|
|
47
|
+
|
|
48
|
+
This rule intentionally focuses on direct unsafe script URL expressions in
|
|
49
|
+
`import(...)`. Indirect variables, import maps, and broader policy enforcement
|
|
50
|
+
are out of scope.
|
|
51
|
+
|
|
52
|
+
## ESLint flat config example
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
56
|
+
|
|
57
|
+
export default [
|
|
58
|
+
{
|
|
59
|
+
plugins: { sdl },
|
|
60
|
+
rules: {
|
|
61
|
+
"sdl/no-dynamic-import-unsafe-url": "error",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## When not to use it
|
|
68
|
+
|
|
69
|
+
Disable this rule only if your project intentionally relies on these dynamic
|
|
70
|
+
module-loading patterns and that design has been reviewed and approved.
|
|
71
|
+
|
|
72
|
+
## Package documentation
|
|
73
|
+
|
|
74
|
+
- [Rule source](../../src/rules/no-dynamic-import-unsafe-url.ts)
|
|
75
|
+
|
|
76
|
+
## Further reading
|
|
77
|
+
|
|
78
|
+
> **Rule catalog ID:** R070
|
|
79
|
+
|
|
80
|
+
- [MDN: `import()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import)
|
|
81
|
+
- [Trusted Types: injection sinks](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API)
|