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,59 @@
|
|
|
1
|
+
# no-postmessage-star-origin
|
|
2
|
+
|
|
3
|
+
Disallow wildcard target origins in `postMessage` calls.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets `window.postMessage(...)` style calls where the target origin
|
|
8
|
+
argument is `"*"`.
|
|
9
|
+
|
|
10
|
+
## What this rule reports
|
|
11
|
+
|
|
12
|
+
This rule reports message sends that do not restrict target origin to a known
|
|
13
|
+
trusted origin.
|
|
14
|
+
|
|
15
|
+
## Why this rule exists
|
|
16
|
+
|
|
17
|
+
Using `"*"` can expose sensitive messages to unintended or attacker-controlled
|
|
18
|
+
origins.
|
|
19
|
+
|
|
20
|
+
## ❌ Incorrect
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
otherWindow.postMessage({ token }, "*");
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## ✅ Correct
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
otherWindow.postMessage({ token }, "https://example.com");
|
|
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-postmessage-star-origin": "error",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## When not to use it
|
|
48
|
+
|
|
49
|
+
Disable only in controlled test harnesses where wildcard messaging is required.
|
|
50
|
+
|
|
51
|
+
## Package documentation
|
|
52
|
+
|
|
53
|
+
- [Rule source](../../src/rules/no-postmessage-star-origin.ts)
|
|
54
|
+
|
|
55
|
+
## Further reading
|
|
56
|
+
|
|
57
|
+
> **Rule catalog ID:** R024
|
|
58
|
+
|
|
59
|
+
- [MDN: `Window.postMessage` security concerns](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#security_concerns)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# no-postmessage-without-origin-allowlist
|
|
2
|
+
|
|
3
|
+
Require explicit allowlisted origins for `postMessage` targetOrigin values.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
`postMessage` calls without strict explicit target-origin allowlists.
|
|
8
|
+
|
|
9
|
+
## What this rule reports
|
|
10
|
+
|
|
11
|
+
`postMessage` targetOrigin values that are wildcard or non-literal/dynamic.
|
|
12
|
+
|
|
13
|
+
## Why this rule exists
|
|
14
|
+
|
|
15
|
+
Weak targetOrigin control can expose cross-origin data or command channels to malicious frames.
|
|
16
|
+
|
|
17
|
+
## ❌ Incorrect
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
target.postMessage(data, "*");
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## ✅ Correct
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
target.postMessage(data, "https://example.com");
|
|
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-postmessage-without-origin-allowlist": "error",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## When not to use it
|
|
46
|
+
|
|
47
|
+
Disable only if the target origin is validated by a reviewed helper abstraction or a controlled embedding environment.
|
|
48
|
+
|
|
49
|
+
## Package documentation
|
|
50
|
+
|
|
51
|
+
- [Rule source](../../src/rules/no-postmessage-without-origin-allowlist.ts)
|
|
52
|
+
|
|
53
|
+
## Further reading
|
|
54
|
+
|
|
55
|
+
> **Rule catalog ID:** R044
|
|
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,64 @@
|
|
|
1
|
+
# no-range-create-contextual-fragment
|
|
2
|
+
|
|
3
|
+
Disallow `Range.createContextualFragment(...)` on unsanitized HTML input.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets `range.createContextualFragment(html)` calls when the HTML
|
|
8
|
+
argument is not sanitized first.
|
|
9
|
+
|
|
10
|
+
## What this rule reports
|
|
11
|
+
|
|
12
|
+
This rule reports `Range.createContextualFragment(...)` calls whose first
|
|
13
|
+
argument is raw HTML instead of the output of a reviewed sanitizer or Trusted
|
|
14
|
+
Types-producing helper.
|
|
15
|
+
|
|
16
|
+
## Why this rule exists
|
|
17
|
+
|
|
18
|
+
`Range.createContextualFragment(...)` parses HTML strings into live DOM
|
|
19
|
+
fragments. Passing unsanitized markup into that parser recreates the same XSS
|
|
20
|
+
and DOM injection problems that appear with other HTML sink APIs.
|
|
21
|
+
|
|
22
|
+
## ❌ Incorrect
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
range.createContextualFragment(userHtml);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## ✅ Correct
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
range.createContextualFragment(sanitize(userHtml));
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## ESLint flat config example
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
38
|
+
|
|
39
|
+
export default [
|
|
40
|
+
{
|
|
41
|
+
plugins: { sdl },
|
|
42
|
+
rules: {
|
|
43
|
+
"sdl/no-range-create-contextual-fragment": "error",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## When not to use it
|
|
50
|
+
|
|
51
|
+
Disable only if your HTML input has already passed through a reviewed sanitizer
|
|
52
|
+
or Trusted Types pipeline that this rule cannot recognize.
|
|
53
|
+
|
|
54
|
+
## Package documentation
|
|
55
|
+
|
|
56
|
+
- [Rule source](../../src/rules/no-range-create-contextual-fragment.ts)
|
|
57
|
+
|
|
58
|
+
## Further reading
|
|
59
|
+
|
|
60
|
+
> **Rule catalog ID:** R054
|
|
61
|
+
|
|
62
|
+
- [MDN: `Range.createContextualFragment()`](https://developer.mozilla.org/en-US/docs/Web/API/Range/createContextualFragment)
|
|
63
|
+
- [Trusted Types](https://web.dev/trusted-types/)
|
|
64
|
+
- [OWASP Cross Site Scripting Prevention Cheat Sheet](https://owasp.org/www-community/xss-prevention)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: no-script-src-data-url
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# no-script-src-data-url
|
|
6
|
+
|
|
7
|
+
Disallow `HTMLScriptElement.src` values that use `data:` URLs.
|
|
8
|
+
|
|
9
|
+
## Targeted pattern scope
|
|
10
|
+
|
|
11
|
+
This rule targets static `data:` URLs assigned to script `src` sinks such as
|
|
12
|
+
`script.src = ...`, `script.setAttribute("src", ...)`, and JSX
|
|
13
|
+
`<script src=...>`.
|
|
14
|
+
|
|
15
|
+
## What this rule reports
|
|
16
|
+
|
|
17
|
+
This rule reports `data:` URLs only when they are written into script-loading
|
|
18
|
+
sinks. It does not report non-script uses such as `img.src = "data:..."`.
|
|
19
|
+
|
|
20
|
+
## Why this rule exists
|
|
21
|
+
|
|
22
|
+
A `data:` URL in a script-loading sink embeds executable code directly in the
|
|
23
|
+
URL itself. That bypasses the usual reviewed external-script loading path and
|
|
24
|
+
makes it easier to smuggle code through values that look like plain strings.
|
|
25
|
+
|
|
26
|
+
## ❌ Incorrect
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
const script = document.createElement("script");
|
|
30
|
+
script.src = "data:text/javascript,alert('owned')";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
const loader = <script src="data:text/javascript,bootstrap()" />;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## ✅ Correct
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
const script = document.createElement("script");
|
|
41
|
+
script.src = "https://cdn.example.com/app.js";
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
const image = new Image();
|
|
46
|
+
image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA";
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Behavior and migration notes
|
|
50
|
+
|
|
51
|
+
This rule intentionally focuses on script `src` sinks and does not attempt to
|
|
52
|
+
analyze other executable loading surfaces such as workers.
|
|
53
|
+
|
|
54
|
+
## ESLint flat config example
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
58
|
+
|
|
59
|
+
export default [
|
|
60
|
+
{
|
|
61
|
+
plugins: { sdl },
|
|
62
|
+
rules: {
|
|
63
|
+
"sdl/no-script-src-data-url": "error",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## When not to use it
|
|
70
|
+
|
|
71
|
+
If your codebase intentionally relies on `data:` script URLs and that behavior
|
|
72
|
+
is acceptable in your threat model, this rule may be too strict.
|
|
73
|
+
|
|
74
|
+
## Package documentation
|
|
75
|
+
|
|
76
|
+
- [Rule source](../../src/rules/no-script-src-data-url.ts)
|
|
77
|
+
|
|
78
|
+
## Further reading
|
|
79
|
+
|
|
80
|
+
> **Rule catalog ID:** R063
|
|
81
|
+
|
|
82
|
+
- [MDN: `HTMLScriptElement.src`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/src)
|
|
83
|
+
- [MDN: `data:` URLs](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# no-script-text
|
|
2
|
+
|
|
3
|
+
Disallow assigning executable code through `<script>` text sinks.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets assignments to the following `HTMLScriptElement` properties:
|
|
8
|
+
|
|
9
|
+
- `script.text = ...`
|
|
10
|
+
- `script.textContent = ...`
|
|
11
|
+
- `script.innerText = ...`
|
|
12
|
+
|
|
13
|
+
The rule uses type information when available and otherwise falls back to narrow
|
|
14
|
+
syntax heuristics such as `document.createElement("script")` or identifiers like
|
|
15
|
+
`scriptElement`.
|
|
16
|
+
|
|
17
|
+
## What this rule reports
|
|
18
|
+
|
|
19
|
+
This rule reports non-empty assignments that inject code directly into script
|
|
20
|
+
text sinks.
|
|
21
|
+
|
|
22
|
+
## Why this rule exists
|
|
23
|
+
|
|
24
|
+
Writing source code directly into a `<script>` element turns data flow into code
|
|
25
|
+
execution. That creates an obvious XSS/code-injection sink and bypasses safer
|
|
26
|
+
patterns such as loading reviewed static modules or script URLs.
|
|
27
|
+
|
|
28
|
+
## ❌ Incorrect
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
const scriptElement = document.createElement("script");
|
|
32
|
+
scriptElement.textContent = userCode;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## ✅ Correct
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
const scriptElement = document.createElement("script");
|
|
39
|
+
scriptElement.src = "/assets/app.js";
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Behavior and migration notes
|
|
43
|
+
|
|
44
|
+
This rule allows empty-string resets such as `script.text = ""`.
|
|
45
|
+
|
|
46
|
+
It intentionally does not autofix because there is no universally safe rewrite
|
|
47
|
+
for executable inline script injection.
|
|
48
|
+
|
|
49
|
+
## ESLint flat config example
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
53
|
+
|
|
54
|
+
export default [
|
|
55
|
+
{
|
|
56
|
+
plugins: { sdl },
|
|
57
|
+
rules: {
|
|
58
|
+
"sdl/no-script-text": "error",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## When not to use it
|
|
65
|
+
|
|
66
|
+
Disable only if your application intentionally emits inline script bodies,
|
|
67
|
+
those script bodies are tightly controlled, and the surrounding trust boundary
|
|
68
|
+
is reviewed outside this rule.
|
|
69
|
+
|
|
70
|
+
## Package documentation
|
|
71
|
+
|
|
72
|
+
- [Rule source](../../src/rules/no-script-text.ts)
|
|
73
|
+
|
|
74
|
+
## Further reading
|
|
75
|
+
|
|
76
|
+
> **Rule catalog ID:** R057
|
|
77
|
+
|
|
78
|
+
- [MDN: `HTMLScriptElement.textContent`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/textContent)
|
|
79
|
+
- [MDN: `HTMLScriptElement.text`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/text)
|
|
80
|
+
- [Trusted Types API](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: no-service-worker-unsafe-script-url
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# no-service-worker-unsafe-script-url
|
|
6
|
+
|
|
7
|
+
Disallow unsafe service worker script URLs such as `data:`, `blob:`, `javascript:`, and direct `URL.createObjectURL(...)` registrations.
|
|
8
|
+
|
|
9
|
+
## Targeted pattern scope
|
|
10
|
+
|
|
11
|
+
This rule targets `navigator.serviceWorker.register(...)` when the script URL is
|
|
12
|
+
one of the following direct expressions:
|
|
13
|
+
|
|
14
|
+
- a static `data:` URL
|
|
15
|
+
- a static `blob:` URL
|
|
16
|
+
- a static `javascript:` URL
|
|
17
|
+
- a direct `URL.createObjectURL(...)` call
|
|
18
|
+
|
|
19
|
+
The rule also covers `window.navigator`, `self.navigator`, and
|
|
20
|
+
`globalThis.navigator` access forms.
|
|
21
|
+
|
|
22
|
+
## What this rule reports
|
|
23
|
+
|
|
24
|
+
This rule reports direct unsafe service worker registration URLs only. Indirect
|
|
25
|
+
variables and broader registration policies are out of scope.
|
|
26
|
+
|
|
27
|
+
## Why this rule exists
|
|
28
|
+
|
|
29
|
+
`ServiceWorkerContainer.register()` is an executable script-loading sink. Using
|
|
30
|
+
non-reviewable or dynamically generated script URLs for service workers makes
|
|
31
|
+
registration paths harder to audit and can undermine SDL expectations around
|
|
32
|
+
trusted worker code.
|
|
33
|
+
|
|
34
|
+
## ❌ Incorrect
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
navigator.serviceWorker.register("data:text/javascript,bootstrap()");
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
globalThis.navigator.serviceWorker.register(URL.createObjectURL(workerBlob));
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## ✅ Correct
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
navigator.serviceWorker.register("/sw.js");
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Behavior and migration notes
|
|
51
|
+
|
|
52
|
+
This rule intentionally focuses on direct unsafe script URL expressions. Dynamic
|
|
53
|
+
variables, Trusted Types policies, and broader origin-validation strategies are
|
|
54
|
+
out of scope.
|
|
55
|
+
|
|
56
|
+
## ESLint flat config example
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
60
|
+
|
|
61
|
+
export default [
|
|
62
|
+
{
|
|
63
|
+
plugins: { sdl },
|
|
64
|
+
rules: {
|
|
65
|
+
"sdl/no-service-worker-unsafe-script-url": "error",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## When not to use it
|
|
72
|
+
|
|
73
|
+
Disable this rule only if your project intentionally relies on these service
|
|
74
|
+
worker registration forms and that design has been reviewed and approved.
|
|
75
|
+
|
|
76
|
+
## Package documentation
|
|
77
|
+
|
|
78
|
+
- [Rule source](../../src/rules/no-service-worker-unsafe-script-url.ts)
|
|
79
|
+
|
|
80
|
+
## Further reading
|
|
81
|
+
|
|
82
|
+
> **Rule catalog ID:** R069
|
|
83
|
+
|
|
84
|
+
- [MDN: `ServiceWorkerContainer.register()`](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register)
|
|
85
|
+
- [Trusted Types: injection sinks](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# no-set-html-unsafe
|
|
2
|
+
|
|
3
|
+
Disallow `setHTMLUnsafe()` calls that bypass the safer HTML Sanitizer API path.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets direct `.setHTMLUnsafe(...)` calls.
|
|
8
|
+
|
|
9
|
+
## What this rule reports
|
|
10
|
+
|
|
11
|
+
This rule reports calls to `setHTMLUnsafe()` because that API is the explicit
|
|
12
|
+
unsafe escape hatch for injecting HTML content.
|
|
13
|
+
|
|
14
|
+
## Why this rule exists
|
|
15
|
+
|
|
16
|
+
`setHTMLUnsafe()` makes dangerous HTML parsing look deceptively close to the
|
|
17
|
+
safer `setHTML()` API. Standardizing on the safe API path reduces accidental use
|
|
18
|
+
of the unsafe variant and keeps security review focused on fewer HTML sink
|
|
19
|
+
surfaces.
|
|
20
|
+
|
|
21
|
+
## ❌ Incorrect
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
element.setHTMLUnsafe(userHtml);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## ✅ Correct
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
element.setHTML(userHtml);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## ESLint flat config example
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
37
|
+
|
|
38
|
+
export default [
|
|
39
|
+
{
|
|
40
|
+
plugins: { sdl },
|
|
41
|
+
rules: {
|
|
42
|
+
"sdl/no-set-html-unsafe": "error",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## When not to use it
|
|
49
|
+
|
|
50
|
+
Disable only if you have an explicit requirement to use the unsafe HTML setter,
|
|
51
|
+
its inputs are tightly controlled, and the surrounding review process documents
|
|
52
|
+
why the safe `setHTML()` path is not sufficient.
|
|
53
|
+
|
|
54
|
+
## Package documentation
|
|
55
|
+
|
|
56
|
+
- [Rule source](../../src/rules/no-set-html-unsafe.ts)
|
|
57
|
+
|
|
58
|
+
## Further reading
|
|
59
|
+
|
|
60
|
+
> **Rule catalog ID:** R055
|
|
61
|
+
|
|
62
|
+
- [MDN: `Element.setHTMLUnsafe()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setHTMLUnsafe)
|
|
63
|
+
- [MDN: `Element.setHTML()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setHTML)
|
|
64
|
+
- [HTML Sanitizer API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_Sanitizer_API)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# no-trusted-types-policy-pass-through
|
|
2
|
+
|
|
3
|
+
Disallow Trusted Types policies that return unvalidated input unchanged.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets `trustedTypes.createPolicy(...)` calls whose `createHTML`,
|
|
8
|
+
`createScript`, or `createScriptURL` callbacks simply return the first input
|
|
9
|
+
parameter unchanged.
|
|
10
|
+
|
|
11
|
+
## What this rule reports
|
|
12
|
+
|
|
13
|
+
This rule reports pass-through Trusted Types policy factories such as
|
|
14
|
+
`createHTML: (value) => value`.
|
|
15
|
+
|
|
16
|
+
## Why this rule exists
|
|
17
|
+
|
|
18
|
+
Trusted Types policies are supposed to narrow unsafe string flows. Pass-through
|
|
19
|
+
policies defeat that goal by rebranding untrusted input as trusted output
|
|
20
|
+
without any sanitization or validation.
|
|
21
|
+
|
|
22
|
+
## ❌ Incorrect
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
trustedTypes.createPolicy("default", {
|
|
26
|
+
createHTML: (value) => value,
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## ✅ Correct
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
trustedTypes.createPolicy("default", {
|
|
34
|
+
createHTML: (value) => sanitize(value),
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## ESLint flat config example
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
42
|
+
|
|
43
|
+
export default [
|
|
44
|
+
{
|
|
45
|
+
plugins: { sdl },
|
|
46
|
+
|
|
47
|
+
rules: {
|
|
48
|
+
"sdl/no-trusted-types-policy-pass-through": "error",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## When not to use it
|
|
55
|
+
|
|
56
|
+
Disable only if your Trusted Types policy wraps a reviewed validation layer that
|
|
57
|
+
this rule cannot observe and the pass-through shape is intentional.
|
|
58
|
+
|
|
59
|
+
## Package documentation
|
|
60
|
+
|
|
61
|
+
- [Rule source](../../src/rules/no-trusted-types-policy-pass-through.ts)
|
|
62
|
+
|
|
63
|
+
## Further reading
|
|
64
|
+
|
|
65
|
+
> **Rule catalog ID:** R052
|
|
66
|
+
|
|
67
|
+
- [Trusted Types](https://web.dev/trusted-types/)
|
|
68
|
+
- [MDN: Trusted Types API](https://developer.mozilla.org/docs/Web/API/Trusted_Types_API)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# no-unsafe-alloc
|
|
2
|
+
|
|
3
|
+
Disallow unsafe uninitialized buffer allocation APIs in Node.js.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
This rule targets:
|
|
8
|
+
|
|
9
|
+
- `Buffer.allocUnsafe(...)`
|
|
10
|
+
- `Buffer.allocUnsafeSlow(...)`.
|
|
11
|
+
|
|
12
|
+
## What this rule reports
|
|
13
|
+
|
|
14
|
+
This rule reports calls to unsafe buffer constructors that may expose stale
|
|
15
|
+
memory data.
|
|
16
|
+
|
|
17
|
+
## Why this rule exists
|
|
18
|
+
|
|
19
|
+
Unsafe buffer allocation can leak sensitive process memory contents if buffers
|
|
20
|
+
are consumed before full initialization.
|
|
21
|
+
|
|
22
|
+
## ❌ Incorrect
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
const payload = Buffer.allocUnsafe(64);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## ✅ Correct
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
const payload = Buffer.alloc(64);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## ESLint flat config example
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import sdl from "eslint-plugin-sdl-2";
|
|
38
|
+
|
|
39
|
+
export default [
|
|
40
|
+
{
|
|
41
|
+
plugins: { sdl },
|
|
42
|
+
rules: {
|
|
43
|
+
"sdl/no-unsafe-alloc": "error",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## When not to use it
|
|
50
|
+
|
|
51
|
+
Disable only for profiled performance hotspots that guarantee complete buffer
|
|
52
|
+
initialization before use.
|
|
53
|
+
|
|
54
|
+
## Package documentation
|
|
55
|
+
|
|
56
|
+
- [Rule source](../../src/rules/no-unsafe-alloc.ts)
|
|
57
|
+
|
|
58
|
+
## Further reading
|
|
59
|
+
|
|
60
|
+
> **Rule catalog ID:** R025
|
|
61
|
+
|
|
62
|
+
- [Node.js buffer security note](https://nodejs.org/api/buffer.html#what-makes-bufferallocunsafe-and-bufferallocunsafeslow-unsafe)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# no-unsafe-cast-to-trusted-types
|
|
2
|
+
|
|
3
|
+
Disallow unsafe casts to Trusted Types without using trusted factory creation.
|
|
4
|
+
|
|
5
|
+
## Targeted pattern scope
|
|
6
|
+
|
|
7
|
+
Type assertions/casts to Trusted Types without trusted factory creation.
|
|
8
|
+
|
|
9
|
+
## What this rule reports
|
|
10
|
+
|
|
11
|
+
Unsafe casts/as-assertions to `TrustedHTML`/`TrustedScript`/`TrustedScriptURL`.
|
|
12
|
+
|
|
13
|
+
## Why this rule exists
|
|
14
|
+
|
|
15
|
+
Type-only casts do not sanitize data and can bypass Trusted Types enforcement intent.
|
|
16
|
+
|
|
17
|
+
## ❌ Incorrect
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
const trusted = userHtml as TrustedHTML;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## ✅ Correct
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const trusted = policy.createHTML(userHtml) as TrustedHTML;
|
|
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-unsafe-cast-to-trusted-types": "error",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## When not to use it
|
|
46
|
+
|
|
47
|
+
Disable only if Trusted Type objects are guaranteed by a reviewed factory or policy wrapper that this rule cannot observe.
|
|
48
|
+
|
|
49
|
+
## Package documentation
|
|
50
|
+
|
|
51
|
+
- [Rule source](../../src/rules/no-unsafe-cast-to-trusted-types.ts)
|
|
52
|
+
|
|
53
|
+
## Further reading
|
|
54
|
+
|
|
55
|
+
> **Rule catalog ID:** R045
|
|
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/)
|