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.
Files changed (418) hide show
  1. package/CHANGELOG.md +5316 -0
  2. package/LICENSE +21 -0
  3. package/README.md +133 -0
  4. package/dist/_internal/ast-utils.d.ts +17 -0
  5. package/dist/_internal/ast-utils.d.ts.map +1 -0
  6. package/dist/_internal/ast-utils.js +93 -0
  7. package/dist/_internal/ast-utils.js.map +1 -0
  8. package/dist/_internal/config-references.d.ts +5 -0
  9. package/dist/_internal/config-references.d.ts.map +1 -0
  10. package/dist/_internal/config-references.js +13 -0
  11. package/dist/_internal/config-references.js.map +1 -0
  12. package/dist/_internal/create-rule.d.ts +9 -0
  13. package/dist/_internal/create-rule.d.ts.map +1 -0
  14. package/dist/_internal/create-rule.js +6 -0
  15. package/dist/_internal/create-rule.js.map +1 -0
  16. package/dist/_internal/domparser.d.ts +19 -0
  17. package/dist/_internal/domparser.d.ts.map +1 -0
  18. package/dist/_internal/domparser.js +45 -0
  19. package/dist/_internal/domparser.js.map +1 -0
  20. package/dist/_internal/electron-web-preferences.d.ts +14 -0
  21. package/dist/_internal/electron-web-preferences.d.ts.map +1 -0
  22. package/dist/_internal/electron-web-preferences.js +63 -0
  23. package/dist/_internal/electron-web-preferences.js.map +1 -0
  24. package/dist/_internal/estree-utils.d.ts +51 -0
  25. package/dist/_internal/estree-utils.d.ts.map +1 -0
  26. package/dist/_internal/estree-utils.js +112 -0
  27. package/dist/_internal/estree-utils.js.map +1 -0
  28. package/dist/_internal/node-tls-config.d.ts +44 -0
  29. package/dist/_internal/node-tls-config.d.ts.map +1 -0
  30. package/dist/_internal/node-tls-config.js +101 -0
  31. package/dist/_internal/node-tls-config.js.map +1 -0
  32. package/dist/_internal/rules-registry.d.ts +10 -0
  33. package/dist/_internal/rules-registry.d.ts.map +1 -0
  34. package/dist/_internal/rules-registry.js +148 -0
  35. package/dist/_internal/rules-registry.js.map +1 -0
  36. package/dist/_internal/script-element.d.ts +7 -0
  37. package/dist/_internal/script-element.d.ts.map +1 -0
  38. package/dist/_internal/script-element.js +46 -0
  39. package/dist/_internal/script-element.js.map +1 -0
  40. package/dist/_internal/worker-code-loading.d.ts +69 -0
  41. package/dist/_internal/worker-code-loading.d.ts.map +1 -0
  42. package/dist/_internal/worker-code-loading.js +134 -0
  43. package/dist/_internal/worker-code-loading.js.map +1 -0
  44. package/dist/plugin.cjs +6036 -0
  45. package/dist/plugin.cjs.map +7 -0
  46. package/dist/plugin.d.cts +11 -0
  47. package/dist/plugin.d.ts +11 -0
  48. package/dist/plugin.d.ts.map +1 -0
  49. package/dist/plugin.js +235 -0
  50. package/dist/plugin.js.map +1 -0
  51. package/dist/rules/no-angular-bypass-sanitizer.d.ts +5 -0
  52. package/dist/rules/no-angular-bypass-sanitizer.d.ts.map +1 -0
  53. package/dist/rules/no-angular-bypass-sanitizer.js +32 -0
  54. package/dist/rules/no-angular-bypass-sanitizer.js.map +1 -0
  55. package/dist/rules/no-angular-bypass-security-trust-html.d.ts +5 -0
  56. package/dist/rules/no-angular-bypass-security-trust-html.d.ts.map +1 -0
  57. package/dist/rules/no-angular-bypass-security-trust-html.js +51 -0
  58. package/dist/rules/no-angular-bypass-security-trust-html.js.map +1 -0
  59. package/dist/rules/no-angular-innerhtml-binding.d.ts +5 -0
  60. package/dist/rules/no-angular-innerhtml-binding.d.ts.map +1 -0
  61. package/dist/rules/no-angular-innerhtml-binding.js +57 -0
  62. package/dist/rules/no-angular-innerhtml-binding.js.map +1 -0
  63. package/dist/rules/no-angular-sanitization-trusted-urls.d.ts +5 -0
  64. package/dist/rules/no-angular-sanitization-trusted-urls.d.ts.map +1 -0
  65. package/dist/rules/no-angular-sanitization-trusted-urls.js +32 -0
  66. package/dist/rules/no-angular-sanitization-trusted-urls.js.map +1 -0
  67. package/dist/rules/no-angularjs-bypass-sce.d.ts +5 -0
  68. package/dist/rules/no-angularjs-bypass-sce.d.ts.map +1 -0
  69. package/dist/rules/no-angularjs-bypass-sce.js +80 -0
  70. package/dist/rules/no-angularjs-bypass-sce.js.map +1 -0
  71. package/dist/rules/no-angularjs-enable-svg.d.ts +5 -0
  72. package/dist/rules/no-angularjs-enable-svg.d.ts.map +1 -0
  73. package/dist/rules/no-angularjs-enable-svg.js +48 -0
  74. package/dist/rules/no-angularjs-enable-svg.js.map +1 -0
  75. package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.d.ts +5 -0
  76. package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.d.ts.map +1 -0
  77. package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.js +64 -0
  78. package/dist/rules/no-angularjs-ng-bind-html-without-sanitize.js.map +1 -0
  79. package/dist/rules/no-angularjs-sanitization-whitelist.d.ts +5 -0
  80. package/dist/rules/no-angularjs-sanitization-whitelist.d.ts.map +1 -0
  81. package/dist/rules/no-angularjs-sanitization-whitelist.js +32 -0
  82. package/dist/rules/no-angularjs-sanitization-whitelist.js.map +1 -0
  83. package/dist/rules/no-angularjs-sce-resource-url-wildcard.d.ts +5 -0
  84. package/dist/rules/no-angularjs-sce-resource-url-wildcard.d.ts.map +1 -0
  85. package/dist/rules/no-angularjs-sce-resource-url-wildcard.js +69 -0
  86. package/dist/rules/no-angularjs-sce-resource-url-wildcard.js.map +1 -0
  87. package/dist/rules/no-child-process-exec.d.ts +5 -0
  88. package/dist/rules/no-child-process-exec.d.ts.map +1 -0
  89. package/dist/rules/no-child-process-exec.js +141 -0
  90. package/dist/rules/no-child-process-exec.js.map +1 -0
  91. package/dist/rules/no-child-process-shell-true.d.ts +5 -0
  92. package/dist/rules/no-child-process-shell-true.d.ts.map +1 -0
  93. package/dist/rules/no-child-process-shell-true.js +89 -0
  94. package/dist/rules/no-child-process-shell-true.js.map +1 -0
  95. package/dist/rules/no-cookies.d.ts +5 -0
  96. package/dist/rules/no-cookies.d.ts.map +1 -0
  97. package/dist/rules/no-cookies.js +38 -0
  98. package/dist/rules/no-cookies.js.map +1 -0
  99. package/dist/rules/no-document-domain.d.ts +5 -0
  100. package/dist/rules/no-document-domain.d.ts.map +1 -0
  101. package/dist/rules/no-document-domain.js +41 -0
  102. package/dist/rules/no-document-domain.js.map +1 -0
  103. package/dist/rules/no-document-execcommand-insert-html.d.ts +5 -0
  104. package/dist/rules/no-document-execcommand-insert-html.d.ts.map +1 -0
  105. package/dist/rules/no-document-execcommand-insert-html.js +57 -0
  106. package/dist/rules/no-document-execcommand-insert-html.js.map +1 -0
  107. package/dist/rules/no-document-parse-html-unsafe.d.ts +5 -0
  108. package/dist/rules/no-document-parse-html-unsafe.d.ts.map +1 -0
  109. package/dist/rules/no-document-parse-html-unsafe.js +67 -0
  110. package/dist/rules/no-document-parse-html-unsafe.js.map +1 -0
  111. package/dist/rules/no-document-write.d.ts +5 -0
  112. package/dist/rules/no-document-write.d.ts.map +1 -0
  113. package/dist/rules/no-document-write.js +40 -0
  114. package/dist/rules/no-document-write.js.map +1 -0
  115. package/dist/rules/no-domparser-html-without-sanitization.d.ts +5 -0
  116. package/dist/rules/no-domparser-html-without-sanitization.d.ts.map +1 -0
  117. package/dist/rules/no-domparser-html-without-sanitization.js +56 -0
  118. package/dist/rules/no-domparser-html-without-sanitization.js.map +1 -0
  119. package/dist/rules/no-domparser-svg-without-sanitization.d.ts +5 -0
  120. package/dist/rules/no-domparser-svg-without-sanitization.d.ts.map +1 -0
  121. package/dist/rules/no-domparser-svg-without-sanitization.js +56 -0
  122. package/dist/rules/no-domparser-svg-without-sanitization.js.map +1 -0
  123. package/dist/rules/no-dynamic-import-unsafe-url.d.ts +5 -0
  124. package/dist/rules/no-dynamic-import-unsafe-url.d.ts.map +1 -0
  125. package/dist/rules/no-dynamic-import-unsafe-url.js +47 -0
  126. package/dist/rules/no-dynamic-import-unsafe-url.js.map +1 -0
  127. package/dist/rules/no-electron-allow-running-insecure-content.d.ts +5 -0
  128. package/dist/rules/no-electron-allow-running-insecure-content.d.ts.map +1 -0
  129. package/dist/rules/no-electron-allow-running-insecure-content.js +30 -0
  130. package/dist/rules/no-electron-allow-running-insecure-content.js.map +1 -0
  131. package/dist/rules/no-electron-dangerous-blink-features.d.ts +5 -0
  132. package/dist/rules/no-electron-dangerous-blink-features.d.ts.map +1 -0
  133. package/dist/rules/no-electron-dangerous-blink-features.js +89 -0
  134. package/dist/rules/no-electron-dangerous-blink-features.js.map +1 -0
  135. package/dist/rules/no-electron-disable-context-isolation.d.ts +5 -0
  136. package/dist/rules/no-electron-disable-context-isolation.d.ts.map +1 -0
  137. package/dist/rules/no-electron-disable-context-isolation.js +30 -0
  138. package/dist/rules/no-electron-disable-context-isolation.js.map +1 -0
  139. package/dist/rules/no-electron-disable-sandbox.d.ts +5 -0
  140. package/dist/rules/no-electron-disable-sandbox.d.ts.map +1 -0
  141. package/dist/rules/no-electron-disable-sandbox.js +30 -0
  142. package/dist/rules/no-electron-disable-sandbox.js.map +1 -0
  143. package/dist/rules/no-electron-disable-web-security.d.ts +5 -0
  144. package/dist/rules/no-electron-disable-web-security.d.ts.map +1 -0
  145. package/dist/rules/no-electron-disable-web-security.js +30 -0
  146. package/dist/rules/no-electron-disable-web-security.js.map +1 -0
  147. package/dist/rules/no-electron-enable-remote-module.d.ts +5 -0
  148. package/dist/rules/no-electron-enable-remote-module.d.ts.map +1 -0
  149. package/dist/rules/no-electron-enable-remote-module.js +30 -0
  150. package/dist/rules/no-electron-enable-remote-module.js.map +1 -0
  151. package/dist/rules/no-electron-enable-webview-tag.d.ts +5 -0
  152. package/dist/rules/no-electron-enable-webview-tag.d.ts.map +1 -0
  153. package/dist/rules/no-electron-enable-webview-tag.js +30 -0
  154. package/dist/rules/no-electron-enable-webview-tag.js.map +1 -0
  155. package/dist/rules/no-electron-experimental-features.d.ts +5 -0
  156. package/dist/rules/no-electron-experimental-features.d.ts.map +1 -0
  157. package/dist/rules/no-electron-experimental-features.js +30 -0
  158. package/dist/rules/no-electron-experimental-features.js.map +1 -0
  159. package/dist/rules/no-electron-expose-raw-ipc-renderer.d.ts +5 -0
  160. package/dist/rules/no-electron-expose-raw-ipc-renderer.d.ts.map +1 -0
  161. package/dist/rules/no-electron-expose-raw-ipc-renderer.js +108 -0
  162. package/dist/rules/no-electron-expose-raw-ipc-renderer.js.map +1 -0
  163. package/dist/rules/no-electron-insecure-certificate-error-handler.d.ts +5 -0
  164. package/dist/rules/no-electron-insecure-certificate-error-handler.d.ts.map +1 -0
  165. package/dist/rules/no-electron-insecure-certificate-error-handler.js +91 -0
  166. package/dist/rules/no-electron-insecure-certificate-error-handler.js.map +1 -0
  167. package/dist/rules/no-electron-insecure-certificate-verify-proc.d.ts +5 -0
  168. package/dist/rules/no-electron-insecure-certificate-verify-proc.d.ts.map +1 -0
  169. package/dist/rules/no-electron-insecure-certificate-verify-proc.js +75 -0
  170. package/dist/rules/no-electron-insecure-certificate-verify-proc.js.map +1 -0
  171. package/dist/rules/no-electron-insecure-permission-request-handler.d.ts +5 -0
  172. package/dist/rules/no-electron-insecure-permission-request-handler.d.ts.map +1 -0
  173. package/dist/rules/no-electron-insecure-permission-request-handler.js +75 -0
  174. package/dist/rules/no-electron-insecure-permission-request-handler.js.map +1 -0
  175. package/dist/rules/no-electron-node-integration.d.ts +5 -0
  176. package/dist/rules/no-electron-node-integration.d.ts.map +1 -0
  177. package/dist/rules/no-electron-node-integration.js +52 -0
  178. package/dist/rules/no-electron-node-integration.js.map +1 -0
  179. package/dist/rules/no-electron-permission-check-handler-allow-all.d.ts +5 -0
  180. package/dist/rules/no-electron-permission-check-handler-allow-all.d.ts.map +1 -0
  181. package/dist/rules/no-electron-permission-check-handler-allow-all.js +63 -0
  182. package/dist/rules/no-electron-permission-check-handler-allow-all.js.map +1 -0
  183. package/dist/rules/no-electron-unchecked-ipc-sender.d.ts +5 -0
  184. package/dist/rules/no-electron-unchecked-ipc-sender.d.ts.map +1 -0
  185. package/dist/rules/no-electron-unchecked-ipc-sender.js +90 -0
  186. package/dist/rules/no-electron-unchecked-ipc-sender.js.map +1 -0
  187. package/dist/rules/no-electron-unrestricted-navigation.d.ts +5 -0
  188. package/dist/rules/no-electron-unrestricted-navigation.d.ts.map +1 -0
  189. package/dist/rules/no-electron-unrestricted-navigation.js +100 -0
  190. package/dist/rules/no-electron-unrestricted-navigation.js.map +1 -0
  191. package/dist/rules/no-electron-untrusted-open-external.d.ts +5 -0
  192. package/dist/rules/no-electron-untrusted-open-external.d.ts.map +1 -0
  193. package/dist/rules/no-electron-untrusted-open-external.js +92 -0
  194. package/dist/rules/no-electron-untrusted-open-external.js.map +1 -0
  195. package/dist/rules/no-electron-webview-allowpopups.d.ts +5 -0
  196. package/dist/rules/no-electron-webview-allowpopups.d.ts.map +1 -0
  197. package/dist/rules/no-electron-webview-allowpopups.js +85 -0
  198. package/dist/rules/no-electron-webview-allowpopups.js.map +1 -0
  199. package/dist/rules/no-electron-webview-insecure-webpreferences.d.ts +5 -0
  200. package/dist/rules/no-electron-webview-insecure-webpreferences.d.ts.map +1 -0
  201. package/dist/rules/no-electron-webview-insecure-webpreferences.js +88 -0
  202. package/dist/rules/no-electron-webview-insecure-webpreferences.js.map +1 -0
  203. package/dist/rules/no-electron-webview-node-integration.d.ts +5 -0
  204. package/dist/rules/no-electron-webview-node-integration.d.ts.map +1 -0
  205. package/dist/rules/no-electron-webview-node-integration.js +107 -0
  206. package/dist/rules/no-electron-webview-node-integration.js.map +1 -0
  207. package/dist/rules/no-html-method.d.ts +5 -0
  208. package/dist/rules/no-html-method.d.ts.map +1 -0
  209. package/dist/rules/no-html-method.js +42 -0
  210. package/dist/rules/no-html-method.js.map +1 -0
  211. package/dist/rules/no-http-request-to-insecure-protocol.d.ts +5 -0
  212. package/dist/rules/no-http-request-to-insecure-protocol.d.ts.map +1 -0
  213. package/dist/rules/no-http-request-to-insecure-protocol.js +94 -0
  214. package/dist/rules/no-http-request-to-insecure-protocol.js.map +1 -0
  215. package/dist/rules/no-iframe-srcdoc.d.ts +5 -0
  216. package/dist/rules/no-iframe-srcdoc.d.ts.map +1 -0
  217. package/dist/rules/no-iframe-srcdoc.js +144 -0
  218. package/dist/rules/no-iframe-srcdoc.js.map +1 -0
  219. package/dist/rules/no-inner-html.d.ts +5 -0
  220. package/dist/rules/no-inner-html.d.ts.map +1 -0
  221. package/dist/rules/no-inner-html.js +67 -0
  222. package/dist/rules/no-inner-html.js.map +1 -0
  223. package/dist/rules/no-insecure-random.d.ts +5 -0
  224. package/dist/rules/no-insecure-random.d.ts.map +1 -0
  225. package/dist/rules/no-insecure-random.js +95 -0
  226. package/dist/rules/no-insecure-random.js.map +1 -0
  227. package/dist/rules/no-insecure-tls-agent-options.d.ts +5 -0
  228. package/dist/rules/no-insecure-tls-agent-options.d.ts.map +1 -0
  229. package/dist/rules/no-insecure-tls-agent-options.js +73 -0
  230. package/dist/rules/no-insecure-tls-agent-options.js.map +1 -0
  231. package/dist/rules/no-insecure-url.d.ts +12 -0
  232. package/dist/rules/no-insecure-url.d.ts.map +1 -0
  233. package/dist/rules/no-insecure-url.js +142 -0
  234. package/dist/rules/no-insecure-url.js.map +1 -0
  235. package/dist/rules/no-location-javascript-url.d.ts +5 -0
  236. package/dist/rules/no-location-javascript-url.d.ts.map +1 -0
  237. package/dist/rules/no-location-javascript-url.js +98 -0
  238. package/dist/rules/no-location-javascript-url.js.map +1 -0
  239. package/dist/rules/no-message-event-without-origin-check.d.ts +5 -0
  240. package/dist/rules/no-message-event-without-origin-check.d.ts.map +1 -0
  241. package/dist/rules/no-message-event-without-origin-check.js +183 -0
  242. package/dist/rules/no-message-event-without-origin-check.js.map +1 -0
  243. package/dist/rules/no-msapp-exec-unsafe.d.ts +5 -0
  244. package/dist/rules/no-msapp-exec-unsafe.d.ts.map +1 -0
  245. package/dist/rules/no-msapp-exec-unsafe.js +32 -0
  246. package/dist/rules/no-msapp-exec-unsafe.js.map +1 -0
  247. package/dist/rules/no-node-tls-check-server-identity-bypass.d.ts +5 -0
  248. package/dist/rules/no-node-tls-check-server-identity-bypass.d.ts.map +1 -0
  249. package/dist/rules/no-node-tls-check-server-identity-bypass.js +95 -0
  250. package/dist/rules/no-node-tls-check-server-identity-bypass.js.map +1 -0
  251. package/dist/rules/no-node-tls-legacy-protocol.d.ts +5 -0
  252. package/dist/rules/no-node-tls-legacy-protocol.d.ts.map +1 -0
  253. package/dist/rules/no-node-tls-legacy-protocol.js +106 -0
  254. package/dist/rules/no-node-tls-legacy-protocol.js.map +1 -0
  255. package/dist/rules/no-node-tls-reject-unauthorized-zero.d.ts +5 -0
  256. package/dist/rules/no-node-tls-reject-unauthorized-zero.d.ts.map +1 -0
  257. package/dist/rules/no-node-tls-reject-unauthorized-zero.js +93 -0
  258. package/dist/rules/no-node-tls-reject-unauthorized-zero.js.map +1 -0
  259. package/dist/rules/no-node-tls-security-level-zero.d.ts +5 -0
  260. package/dist/rules/no-node-tls-security-level-zero.d.ts.map +1 -0
  261. package/dist/rules/no-node-tls-security-level-zero.js +80 -0
  262. package/dist/rules/no-node-tls-security-level-zero.js.map +1 -0
  263. package/dist/rules/no-node-vm-run-in-context.d.ts +5 -0
  264. package/dist/rules/no-node-vm-run-in-context.d.ts.map +1 -0
  265. package/dist/rules/no-node-vm-run-in-context.js +186 -0
  266. package/dist/rules/no-node-vm-run-in-context.js.map +1 -0
  267. package/dist/rules/no-node-vm-source-text-module.d.ts +5 -0
  268. package/dist/rules/no-node-vm-source-text-module.d.ts.map +1 -0
  269. package/dist/rules/no-node-vm-source-text-module.js +126 -0
  270. package/dist/rules/no-node-vm-source-text-module.js.map +1 -0
  271. package/dist/rules/no-node-worker-threads-eval.d.ts +5 -0
  272. package/dist/rules/no-node-worker-threads-eval.d.ts.map +1 -0
  273. package/dist/rules/no-node-worker-threads-eval.js +151 -0
  274. package/dist/rules/no-node-worker-threads-eval.js.map +1 -0
  275. package/dist/rules/no-nonnull-assertion-on-security-input.d.ts +5 -0
  276. package/dist/rules/no-nonnull-assertion-on-security-input.d.ts.map +1 -0
  277. package/dist/rules/no-nonnull-assertion-on-security-input.js +48 -0
  278. package/dist/rules/no-nonnull-assertion-on-security-input.js.map +1 -0
  279. package/dist/rules/no-postmessage-star-origin.d.ts +5 -0
  280. package/dist/rules/no-postmessage-star-origin.d.ts.map +1 -0
  281. package/dist/rules/no-postmessage-star-origin.js +58 -0
  282. package/dist/rules/no-postmessage-star-origin.js.map +1 -0
  283. package/dist/rules/no-postmessage-without-origin-allowlist.d.ts +5 -0
  284. package/dist/rules/no-postmessage-without-origin-allowlist.d.ts.map +1 -0
  285. package/dist/rules/no-postmessage-without-origin-allowlist.js +80 -0
  286. package/dist/rules/no-postmessage-without-origin-allowlist.js.map +1 -0
  287. package/dist/rules/no-range-create-contextual-fragment.d.ts +5 -0
  288. package/dist/rules/no-range-create-contextual-fragment.d.ts.map +1 -0
  289. package/dist/rules/no-range-create-contextual-fragment.js +64 -0
  290. package/dist/rules/no-range-create-contextual-fragment.js.map +1 -0
  291. package/dist/rules/no-script-src-data-url.d.ts +5 -0
  292. package/dist/rules/no-script-src-data-url.d.ts.map +1 -0
  293. package/dist/rules/no-script-src-data-url.js +108 -0
  294. package/dist/rules/no-script-src-data-url.js.map +1 -0
  295. package/dist/rules/no-script-text.d.ts +5 -0
  296. package/dist/rules/no-script-text.d.ts.map +1 -0
  297. package/dist/rules/no-script-text.js +52 -0
  298. package/dist/rules/no-script-text.js.map +1 -0
  299. package/dist/rules/no-service-worker-unsafe-script-url.d.ts +5 -0
  300. package/dist/rules/no-service-worker-unsafe-script-url.d.ts.map +1 -0
  301. package/dist/rules/no-service-worker-unsafe-script-url.js +52 -0
  302. package/dist/rules/no-service-worker-unsafe-script-url.js.map +1 -0
  303. package/dist/rules/no-set-html-unsafe.d.ts +5 -0
  304. package/dist/rules/no-set-html-unsafe.d.ts.map +1 -0
  305. package/dist/rules/no-set-html-unsafe.js +48 -0
  306. package/dist/rules/no-set-html-unsafe.js.map +1 -0
  307. package/dist/rules/no-trusted-types-policy-pass-through.d.ts +5 -0
  308. package/dist/rules/no-trusted-types-policy-pass-through.d.ts.map +1 -0
  309. package/dist/rules/no-trusted-types-policy-pass-through.js +115 -0
  310. package/dist/rules/no-trusted-types-policy-pass-through.js.map +1 -0
  311. package/dist/rules/no-unsafe-alloc.d.ts +5 -0
  312. package/dist/rules/no-unsafe-alloc.d.ts.map +1 -0
  313. package/dist/rules/no-unsafe-alloc.js +51 -0
  314. package/dist/rules/no-unsafe-alloc.js.map +1 -0
  315. package/dist/rules/no-unsafe-cast-to-trusted-types.d.ts +5 -0
  316. package/dist/rules/no-unsafe-cast-to-trusted-types.d.ts.map +1 -0
  317. package/dist/rules/no-unsafe-cast-to-trusted-types.js +89 -0
  318. package/dist/rules/no-unsafe-cast-to-trusted-types.js.map +1 -0
  319. package/dist/rules/no-window-open-without-noopener.d.ts +5 -0
  320. package/dist/rules/no-window-open-without-noopener.d.ts.map +1 -0
  321. package/dist/rules/no-window-open-without-noopener.js +84 -0
  322. package/dist/rules/no-window-open-without-noopener.js.map +1 -0
  323. package/dist/rules/no-winjs-html-unsafe.d.ts +5 -0
  324. package/dist/rules/no-winjs-html-unsafe.d.ts.map +1 -0
  325. package/dist/rules/no-winjs-html-unsafe.js +32 -0
  326. package/dist/rules/no-winjs-html-unsafe.js.map +1 -0
  327. package/dist/rules/no-worker-blob-url.d.ts +5 -0
  328. package/dist/rules/no-worker-blob-url.d.ts.map +1 -0
  329. package/dist/rules/no-worker-blob-url.js +64 -0
  330. package/dist/rules/no-worker-blob-url.js.map +1 -0
  331. package/dist/rules/no-worker-data-url.d.ts +5 -0
  332. package/dist/rules/no-worker-data-url.d.ts.map +1 -0
  333. package/dist/rules/no-worker-data-url.js +67 -0
  334. package/dist/rules/no-worker-data-url.js.map +1 -0
  335. package/docs/rules/getting-started.md +70 -0
  336. package/docs/rules/no-angular-bypass-sanitizer.md +69 -0
  337. package/docs/rules/no-angular-bypass-security-trust-html.md +59 -0
  338. package/docs/rules/no-angular-innerhtml-binding.md +59 -0
  339. package/docs/rules/no-angular-sanitization-trusted-urls.md +64 -0
  340. package/docs/rules/no-angularjs-bypass-sce.md +64 -0
  341. package/docs/rules/no-angularjs-enable-svg.md +59 -0
  342. package/docs/rules/no-angularjs-ng-bind-html-without-sanitize.md +59 -0
  343. package/docs/rules/no-angularjs-sanitization-whitelist.md +63 -0
  344. package/docs/rules/no-angularjs-sce-resource-url-wildcard.md +62 -0
  345. package/docs/rules/no-child-process-exec.md +101 -0
  346. package/docs/rules/no-child-process-shell-true.md +59 -0
  347. package/docs/rules/no-cookies.md +61 -0
  348. package/docs/rules/no-document-domain.md +59 -0
  349. package/docs/rules/no-document-execcommand-insert-html.md +69 -0
  350. package/docs/rules/no-document-parse-html-unsafe.md +72 -0
  351. package/docs/rules/no-document-write.md +64 -0
  352. package/docs/rules/no-domparser-html-without-sanitization.md +59 -0
  353. package/docs/rules/no-domparser-svg-without-sanitization.md +71 -0
  354. package/docs/rules/no-dynamic-import-unsafe-url.md +81 -0
  355. package/docs/rules/no-electron-allow-running-insecure-content.md +69 -0
  356. package/docs/rules/no-electron-dangerous-blink-features.md +77 -0
  357. package/docs/rules/no-electron-disable-context-isolation.md +69 -0
  358. package/docs/rules/no-electron-disable-sandbox.md +69 -0
  359. package/docs/rules/no-electron-disable-web-security.md +69 -0
  360. package/docs/rules/no-electron-enable-remote-module.md +69 -0
  361. package/docs/rules/no-electron-enable-webview-tag.md +77 -0
  362. package/docs/rules/no-electron-experimental-features.md +77 -0
  363. package/docs/rules/no-electron-expose-raw-ipc-renderer.md +79 -0
  364. package/docs/rules/no-electron-insecure-certificate-error-handler.md +72 -0
  365. package/docs/rules/no-electron-insecure-certificate-verify-proc.md +63 -0
  366. package/docs/rules/no-electron-insecure-permission-request-handler.md +67 -0
  367. package/docs/rules/no-electron-node-integration.md +70 -0
  368. package/docs/rules/no-electron-permission-check-handler-allow-all.md +66 -0
  369. package/docs/rules/no-electron-unchecked-ipc-sender.md +62 -0
  370. package/docs/rules/no-electron-unrestricted-navigation.md +64 -0
  371. package/docs/rules/no-electron-untrusted-open-external.md +65 -0
  372. package/docs/rules/no-electron-webview-allowpopups.md +59 -0
  373. package/docs/rules/no-electron-webview-insecure-webpreferences.md +84 -0
  374. package/docs/rules/no-electron-webview-node-integration.md +59 -0
  375. package/docs/rules/no-html-method.md +58 -0
  376. package/docs/rules/no-http-request-to-insecure-protocol.md +59 -0
  377. package/docs/rules/no-iframe-srcdoc.md +76 -0
  378. package/docs/rules/no-inner-html.md +65 -0
  379. package/docs/rules/no-insecure-random.md +66 -0
  380. package/docs/rules/no-insecure-tls-agent-options.md +59 -0
  381. package/docs/rules/no-insecure-url.md +72 -0
  382. package/docs/rules/no-location-javascript-url.md +59 -0
  383. package/docs/rules/no-message-event-without-origin-check.md +82 -0
  384. package/docs/rules/no-msapp-exec-unsafe.md +59 -0
  385. package/docs/rules/no-node-tls-check-server-identity-bypass.md +88 -0
  386. package/docs/rules/no-node-tls-legacy-protocol.md +80 -0
  387. package/docs/rules/no-node-tls-reject-unauthorized-zero.md +61 -0
  388. package/docs/rules/no-node-tls-security-level-zero.md +77 -0
  389. package/docs/rules/no-node-vm-run-in-context.md +89 -0
  390. package/docs/rules/no-node-vm-source-text-module.md +79 -0
  391. package/docs/rules/no-node-worker-threads-eval.md +82 -0
  392. package/docs/rules/no-nonnull-assertion-on-security-input.md +59 -0
  393. package/docs/rules/no-postmessage-star-origin.md +59 -0
  394. package/docs/rules/no-postmessage-without-origin-allowlist.md +59 -0
  395. package/docs/rules/no-range-create-contextual-fragment.md +64 -0
  396. package/docs/rules/no-script-src-data-url.md +83 -0
  397. package/docs/rules/no-script-text.md +80 -0
  398. package/docs/rules/no-service-worker-unsafe-script-url.md +85 -0
  399. package/docs/rules/no-set-html-unsafe.md +64 -0
  400. package/docs/rules/no-trusted-types-policy-pass-through.md +68 -0
  401. package/docs/rules/no-unsafe-alloc.md +62 -0
  402. package/docs/rules/no-unsafe-cast-to-trusted-types.md +59 -0
  403. package/docs/rules/no-window-open-without-noopener.md +63 -0
  404. package/docs/rules/no-winjs-html-unsafe.md +60 -0
  405. package/docs/rules/no-worker-blob-url.md +86 -0
  406. package/docs/rules/no-worker-data-url.md +85 -0
  407. package/docs/rules/overview.md +111 -0
  408. package/docs/rules/presets/angular.md +35 -0
  409. package/docs/rules/presets/angularjs.md +36 -0
  410. package/docs/rules/presets/common.md +59 -0
  411. package/docs/rules/presets/electron.md +51 -0
  412. package/docs/rules/presets/index.md +26 -0
  413. package/docs/rules/presets/node.md +43 -0
  414. package/docs/rules/presets/react.md +33 -0
  415. package/docs/rules/presets/recommended.md +104 -0
  416. package/docs/rules/presets/required.md +99 -0
  417. package/docs/rules/presets/typescript.md +34 -0
  418. package/package.json +583 -0
@@ -0,0 +1,5 @@
1
+ import { createRule } from "../_internal/create-rule.js";
2
+ /** Rule implementation. */
3
+ declare const rule: ReturnType<typeof createRule>;
4
+ export default rule;
5
+ //# sourceMappingURL=no-trusted-types-policy-pass-through.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-trusted-types-policy-pass-through.d.ts","sourceRoot":"","sources":["../../src/rules/no-trusted-types-policy-pass-through.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAuGzD,2BAA2B;AAC3B,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAmEtC,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { arrayFirst, isDefined, setHas } from "ts-extras";
2
+ import { createRule } from "../_internal/create-rule.js";
3
+ import { getMemberPropertyName, getPropertyName, } from "../_internal/estree-utils.js";
4
+ const isExpressionNode = (node) => node.type !== "ArrayPattern" &&
5
+ node.type !== "AssignmentPattern" &&
6
+ node.type !== "ObjectPattern";
7
+ const POLICY_FACTORY_NAMES = new Set([
8
+ "createHTML",
9
+ "createScript",
10
+ "createScriptURL",
11
+ ]);
12
+ const isFunctionExpression = (expression) => expression.type === "ArrowFunctionExpression" ||
13
+ expression.type === "FunctionExpression";
14
+ const unwrapTransparentExpression = (expression) => {
15
+ if (expression.type === "TSAsExpression" ||
16
+ expression.type === "TSTypeAssertion") {
17
+ return unwrapTransparentExpression(expression.expression);
18
+ }
19
+ return expression;
20
+ };
21
+ const isPassThroughFactory = (factoryNode) => {
22
+ const [firstParameter] = factoryNode.params;
23
+ if (firstParameter?.type !== "Identifier") {
24
+ return false;
25
+ }
26
+ if (factoryNode.body.type !== "BlockStatement") {
27
+ const expressionBody = unwrapTransparentExpression(factoryNode.body);
28
+ return (expressionBody.type === "Identifier" &&
29
+ expressionBody.name === firstParameter.name);
30
+ }
31
+ if (factoryNode.body.body.length !== 1) {
32
+ return false;
33
+ }
34
+ const onlyStatement = arrayFirst(factoryNode.body.body);
35
+ if (onlyStatement?.type !== "ReturnStatement" ||
36
+ onlyStatement.argument === null) {
37
+ return false;
38
+ }
39
+ const returnedExpression = unwrapTransparentExpression(onlyStatement.argument);
40
+ return (returnedExpression.type === "Identifier" &&
41
+ returnedExpression.name === firstParameter.name);
42
+ };
43
+ const isTrustedTypesCreatePolicyCall = (node) => {
44
+ if (node.callee.type !== "MemberExpression") {
45
+ return false;
46
+ }
47
+ if (getMemberPropertyName(node.callee) !== "createPolicy") {
48
+ return false;
49
+ }
50
+ if (node.callee.object.type === "Identifier") {
51
+ return node.callee.object.name === "trustedTypes";
52
+ }
53
+ if (node.callee.object.type !== "MemberExpression") {
54
+ return false;
55
+ }
56
+ return getMemberPropertyName(node.callee.object) === "trustedTypes";
57
+ };
58
+ /** Rule implementation. */
59
+ const rule = createRule({
60
+ create(context) {
61
+ return {
62
+ CallExpression(node) {
63
+ if (!isTrustedTypesCreatePolicyCall(node)) {
64
+ return;
65
+ }
66
+ const [, secondArgument] = node.arguments;
67
+ if (secondArgument === undefined ||
68
+ secondArgument.type === "SpreadElement" ||
69
+ secondArgument.type !== "ObjectExpression") {
70
+ return;
71
+ }
72
+ for (const propertyNode of secondArgument.properties) {
73
+ if (propertyNode.type !== "Property" ||
74
+ propertyNode.kind !== "init") {
75
+ continue;
76
+ }
77
+ const propertyName = getPropertyName(propertyNode);
78
+ if (!isDefined(propertyName) ||
79
+ !setHas(POLICY_FACTORY_NAMES, propertyName) ||
80
+ !isExpressionNode(propertyNode.value) ||
81
+ !isFunctionExpression(propertyNode.value) ||
82
+ !isPassThroughFactory(propertyNode.value)) {
83
+ continue;
84
+ }
85
+ context.report({
86
+ data: {
87
+ methodName: propertyName,
88
+ },
89
+ messageId: "default",
90
+ node: propertyNode,
91
+ });
92
+ }
93
+ },
94
+ };
95
+ },
96
+ defaultOptions: [],
97
+ meta: {
98
+ deprecated: false,
99
+ docs: {
100
+ description: "disallow pass-through Trusted Types policies that return unvalidated input unchanged.",
101
+ frozen: false,
102
+ recommended: false,
103
+ url: "https://nick2bad4u.github.io/eslint-plugin-SDL-2/docs/rules/no-trusted-types-policy-pass-through",
104
+ },
105
+ messages: {
106
+ default: "Do not implement {{methodName}} as a Trusted Types pass-through; sanitize or validate the input first.",
107
+ },
108
+ schema: [],
109
+ type: "problem",
110
+ },
111
+ name: "no-trusted-types-policy-pass-through",
112
+ });
113
+ export default rule;
114
+ /* eslint-enable @typescript-eslint/prefer-readonly-parameter-types -- Restore linting after rule implementation declarations. */
115
+ //# sourceMappingURL=no-trusted-types-policy-pass-through.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-trusted-types-policy-pass-through.js","sourceRoot":"","sources":["../../src/rules/no-trusted-types-policy-pass-through.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EACH,qBAAqB,EACrB,eAAe,GAClB,MAAM,8BAA8B,CAAC;AAQtC,MAAM,gBAAgB,GAAG,CAAC,IAAmB,EAA+B,EAAE,CAC1E,IAAI,CAAC,IAAI,KAAK,cAAc;IAC5B,IAAI,CAAC,IAAI,KAAK,mBAAmB;IACjC,IAAI,CAAC,IAAI,KAAK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const rule: ReturnType<typeof createRule>;
4
+ export default rule;
5
+ //# sourceMappingURL=no-unsafe-alloc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-unsafe-alloc.d.ts","sourceRoot":"","sources":["../../src/rules/no-unsafe-alloc.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,2BAA2B;AAC3B,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CA0DtC,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { createRule } from "../_internal/create-rule.js";
2
+ /** Rule implementation. */
3
+ const rule = createRule({
4
+ create(context) {
5
+ return {
6
+ "MemberExpression[object.name='Buffer'][property.name=/^(?:allocUnsafe|allocUnsafeSlow)$/]"(node) {
7
+ const parentNode = node.parent;
8
+ if (parentNode?.type === "CallExpression" &&
9
+ parentNode.arguments.length === 1) {
10
+ const [firstArgument] = parentNode.arguments;
11
+ if (firstArgument?.type === "Literal" &&
12
+ (firstArgument.value === 0 ||
13
+ firstArgument.value === "0")) {
14
+ return;
15
+ }
16
+ }
17
+ context.report({
18
+ fix(fixer) {
19
+ if (node.computed ||
20
+ node.property.type !== "Identifier") {
21
+ return null;
22
+ }
23
+ return fixer.replaceText(node.property, "alloc");
24
+ },
25
+ messageId: "default",
26
+ node,
27
+ });
28
+ },
29
+ };
30
+ },
31
+ defaultOptions: [],
32
+ meta: {
33
+ deprecated: false,
34
+ docs: {
35
+ description: "disallow Buffer.allocUnsafe/allocUnsafeSlow allocations that may expose uninitialized memory.",
36
+ frozen: false,
37
+ recommended: false,
38
+ url: "https://nick2bad4u.github.io/eslint-plugin-SDL-2/docs/rules/no-unsafe-alloc",
39
+ },
40
+ fixable: "code",
41
+ messages: {
42
+ default: "Do not allocate uninitialized buffers in Node.js.",
43
+ },
44
+ schema: [],
45
+ type: "problem",
46
+ },
47
+ name: "no-unsafe-alloc",
48
+ });
49
+ export default rule;
50
+ /* eslint-enable @typescript-eslint/prefer-readonly-parameter-types -- Restore linting after rule implementation declarations. */
51
+ //# sourceMappingURL=no-unsafe-alloc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-unsafe-alloc.js","sourceRoot":"","sources":["../../src/rules/no-unsafe-alloc.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,2BAA2B;AAC3B,MAAM,IAAI,GAAkC,UAAU,CAAC;IACnD,MAAM,CAAC,OAAO;QACV,OAAO;YACH,2FAA2F,CACvF,IAA+B;gBAE/B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;gBAE/B,IACI,UAAU,EAAE,IAAI,KAAK,gBAAgB;oBACrC,UAAU,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EACnC,CAAC;oBACC,MAAM,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC;oBAE7C,IACI,aAAa,EAAE,IAAI,KAAK,SAAS;wBACjC,CAAC,aAAa,CAAC,KAAK,KAAK,CAAC;4BACtB,aAAa,CAAC,KAAK,KAAK,GAAG,CAAC,EAClC,CAAC;wBACC,OAAO;oBACX,CAAC;gBACL,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACX,GAAG,CAAC,KAAK;wBACL,IACI,IAAI,CAAC,QAAQ;4BACb,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,EACrC,CAAC;4BACC,OAAO,IAAI,CAAC;wBAChB,CAAC;wBAED,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;oBACrD,CAAC;oBACD,SAAS,EAAE,SAAS;oBACpB,IAAI;iBACP,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACF,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE;YACF,WAAW,EACP,+FAA+F;YACnG,MAAM,EAAE,KAAK;YACb,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,6EAA6E;SACrF;QACD,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE;YACN,OAAO,EAAE,mDAAmD;SAC/D;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,IAAI,EAAE,iBAAiB;CAC1B,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC;AACpB,iIAAiI"}
@@ -0,0 +1,5 @@
1
+ import { createRule } from "../_internal/create-rule.js";
2
+ /** Rule implementation. */
3
+ declare const rule: ReturnType<typeof createRule>;
4
+ export default rule;
5
+ //# sourceMappingURL=no-unsafe-cast-to-trusted-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-unsafe-cast-to-trusted-types.d.ts","sourceRoot":"","sources":["../../src/rules/no-unsafe-cast-to-trusted-types.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AA+DzD,2BAA2B;AAC3B,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAkDtC,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { isDefined, setHas } from "ts-extras";
2
+ import { createRule } from "../_internal/create-rule.js";
3
+ const TRUSTED_TYPE_NAMES = new Set([
4
+ "TrustedHTML",
5
+ "TrustedScript",
6
+ "TrustedScriptURL",
7
+ ]);
8
+ const getTypeName = (node) => {
9
+ if (node.type === "TSTypeReference" &&
10
+ node.typeName.type === "Identifier") {
11
+ return node.typeName.name;
12
+ }
13
+ return undefined;
14
+ };
15
+ const isTrustedTypeNode = (node) => {
16
+ const typeName = getTypeName(node);
17
+ return isDefined(typeName) && setHas(TRUSTED_TYPE_NAMES, typeName);
18
+ };
19
+ const getExpressionCalleeName = (expression) => {
20
+ if (expression.type !== "CallExpression") {
21
+ return undefined;
22
+ }
23
+ if (expression.callee.type === "Identifier") {
24
+ return expression.callee.name;
25
+ }
26
+ if (expression.callee.type === "MemberExpression" &&
27
+ !expression.callee.computed &&
28
+ expression.callee.property.type === "Identifier") {
29
+ return expression.callee.property.name;
30
+ }
31
+ return undefined;
32
+ };
33
+ const isKnownTrustedFactoryCall = (expression) => {
34
+ const calleeName = getExpressionCalleeName(expression);
35
+ if (!isDefined(calleeName)) {
36
+ return false;
37
+ }
38
+ return /sanitize|createhtml|createscripturl|createscript|trusted/u.test(calleeName.toLowerCase());
39
+ };
40
+ /** Rule implementation. */
41
+ const rule = createRule({
42
+ create(context) {
43
+ return {
44
+ TSAsExpression(node) {
45
+ if (!isTrustedTypeNode(node.typeAnnotation)) {
46
+ return;
47
+ }
48
+ if (isKnownTrustedFactoryCall(node.expression)) {
49
+ return;
50
+ }
51
+ context.report({
52
+ messageId: "default",
53
+ node,
54
+ });
55
+ },
56
+ TSTypeAssertion(node) {
57
+ if (!isTrustedTypeNode(node.typeAnnotation)) {
58
+ return;
59
+ }
60
+ if (isKnownTrustedFactoryCall(node.expression)) {
61
+ return;
62
+ }
63
+ context.report({
64
+ messageId: "default",
65
+ node,
66
+ });
67
+ },
68
+ };
69
+ },
70
+ defaultOptions: [],
71
+ meta: {
72
+ deprecated: false,
73
+ docs: {
74
+ description: "disallow unsafe casts to Trusted Types without validated/trusted factory paths.",
75
+ frozen: false,
76
+ recommended: false,
77
+ url: "https://nick2bad4u.github.io/eslint-plugin-SDL-2/docs/rules/no-unsafe-cast-to-trusted-types",
78
+ },
79
+ messages: {
80
+ default: "Do not cast unvalidated values to Trusted Types.",
81
+ },
82
+ schema: [],
83
+ type: "problem",
84
+ },
85
+ name: "no-unsafe-cast-to-trusted-types",
86
+ });
87
+ export default rule;
88
+ /* eslint-enable @typescript-eslint/prefer-readonly-parameter-types -- Restore linting after rule implementation declarations. */
89
+ //# sourceMappingURL=no-unsafe-cast-to-trusted-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-unsafe-cast-to-trusted-types.js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AAW,EAAE,KAAK;YAClB,GAAG,EAAE,6FAA6F;SACrG;QACD,QAAQ,EAAE;YACN,OAAO,EAAE,kDAAkD;SAC9D;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,IAAI,EAAE,iCAAiC;CAC1C,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC;AACpB,iIAAiI"}
@@ -0,0 +1,5 @@
1
+ import { createRule } from "../_internal/create-rule.js";
2
+ /** Rule implementation. */
3
+ declare const rule: ReturnType<typeof createRule>;
4
+ export default rule;
5
+ //# sourceMappingURL=no-window-open-without-noopener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-window-open-without-noopener.d.ts","sourceRoot":"","sources":["../../src/rules/no-window-open-without-noopener.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AA+CzD,2BAA2B;AAC3B,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAuEtC,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { arrayFirst, isDefined, stringSplit } from "ts-extras";
2
+ import { createRule } from "../_internal/create-rule.js";
3
+ const getStaticStringValue = (node) => {
4
+ if (node.type === "Literal" && typeof node.value === "string") {
5
+ return node.value;
6
+ }
7
+ if (node.type === "TemplateLiteral" && node.expressions.length === 0) {
8
+ const firstQuasi = arrayFirst(node.quasis);
9
+ if (!isDefined(firstQuasi) ||
10
+ typeof firstQuasi.value.cooked !== "string") {
11
+ return undefined;
12
+ }
13
+ return firstQuasi.value.cooked;
14
+ }
15
+ return undefined;
16
+ };
17
+ const isWindowOpenCallee = (callee) => {
18
+ if (callee.type !== "MemberExpression" || callee.computed) {
19
+ return false;
20
+ }
21
+ return (callee.object.type === "Identifier" &&
22
+ callee.object.name === "window" &&
23
+ callee.property.type === "Identifier" &&
24
+ callee.property.name === "open");
25
+ };
26
+ const hasNoopenerToken = (features) => stringSplit(features.toLowerCase(), ",")
27
+ .map((token) => token.trim())
28
+ .some((token) => token === "noopener" || token.startsWith("noopener="));
29
+ /** Rule implementation. */
30
+ const rule = createRule({
31
+ create(context) {
32
+ return {
33
+ CallExpression(node) {
34
+ if (!isWindowOpenCallee(node.callee)) {
35
+ return;
36
+ }
37
+ const [, secondArgument, thirdArgument,] = node.arguments;
38
+ if (secondArgument === undefined ||
39
+ secondArgument.type === "SpreadElement") {
40
+ return;
41
+ }
42
+ const targetValue = getStaticStringValue(secondArgument);
43
+ if (targetValue !== "_blank") {
44
+ return;
45
+ }
46
+ if (thirdArgument === undefined ||
47
+ thirdArgument.type === "SpreadElement") {
48
+ context.report({
49
+ messageId: "default",
50
+ node,
51
+ });
52
+ return;
53
+ }
54
+ const featuresValue = getStaticStringValue(thirdArgument);
55
+ if (typeof featuresValue !== "string" ||
56
+ !hasNoopenerToken(featuresValue)) {
57
+ context.report({
58
+ messageId: "default",
59
+ node: thirdArgument,
60
+ });
61
+ }
62
+ },
63
+ };
64
+ },
65
+ defaultOptions: [],
66
+ meta: {
67
+ deprecated: false,
68
+ docs: {
69
+ description: "require noopener when using window.open with a _blank target.",
70
+ frozen: false,
71
+ recommended: false,
72
+ url: "https://nick2bad4u.github.io/eslint-plugin-SDL-2/docs/rules/no-window-open-without-noopener",
73
+ },
74
+ messages: {
75
+ default: "Include 'noopener' in window.open features when target is '_blank'.",
76
+ },
77
+ schema: [],
78
+ type: "problem",
79
+ },
80
+ name: "no-window-open-without-noopener",
81
+ });
82
+ export default rule;
83
+ /* eslint-enable @typescript-eslint/prefer-readonly-parameter-types -- Restore linting after rule implementation declarations. */
84
+ //# sourceMappingURL=no-window-open-without-noopener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-window-open-without-noopener.js","sourceRoot":"","sources":["../../src/rules/no-window-open-without-noopener.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE/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E;YACF,WAAW,EACP,+DAA+D;YACnE,MAAM,EAAE,KAAK;YACb,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,6FAA6F;SACrG;QACD,QAAQ,EAAE;YACN,OAAO,EACH,qEAAqE;SAC5E;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,IAAI,EAAE,iCAAiC;CAC1C,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC;AACpB,iIAAiI"}
@@ -0,0 +1,5 @@
1
+ import { createRule } from "../_internal/create-rule.js";
2
+ /** Rule implementation. */
3
+ declare const rule: ReturnType<typeof createRule>;
4
+ export default rule;
5
+ //# sourceMappingURL=no-winjs-html-unsafe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-winjs-html-unsafe.d.ts","sourceRoot":"","sources":["../../src/rules/no-winjs-html-unsafe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,2BAA2B;AAC3B,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CA+BtC,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { createRule } from "../_internal/create-rule.js";
2
+ /** Rule implementation. */
3
+ const rule = createRule({
4
+ create(context) {
5
+ return {
6
+ "CallExpression[callee.object.object.name='WinJS'][callee.object.property.name='Utilities'][callee.property.name=/^(?:insertAdjacent|setInner|setOuter)HTMLUnsafe$/]"(node) {
7
+ context.report({
8
+ messageId: "default",
9
+ node,
10
+ });
11
+ },
12
+ };
13
+ },
14
+ defaultOptions: [],
15
+ meta: {
16
+ deprecated: false,
17
+ docs: {
18
+ description: "disallow WinJS.Utilities unsafe HTML write APIs (setInnerHTMLUnsafe, setOuterHTMLUnsafe, insertAdjacentHTMLUnsafe).",
19
+ frozen: false,
20
+ recommended: false,
21
+ url: "https://nick2bad4u.github.io/eslint-plugin-SDL-2/docs/rules/no-winjs-html-unsafe",
22
+ },
23
+ messages: {
24
+ default: "Do not set HTML using unsafe methods from WinJS.Utilities.",
25
+ },
26
+ schema: [],
27
+ type: "problem",
28
+ },
29
+ name: "no-winjs-html-unsafe",
30
+ });
31
+ export default rule;
32
+ //# sourceMappingURL=no-winjs-html-unsafe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-winjs-html-unsafe.js","sourceRoot":"","sources":["../../src/rules/no-winjs-html-unsafe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,2BAA2B;AAC3B,MAAM,IAAI,GAAkC,UAAU,CAAC;IACnD,MAAM,CAAC,OAAO;QACV,OAAO;YACH,qKAAqK,CACjK,IAAI;gBAEJ,OAAO,CAAC,MAAM,CAAC;oBACX,SAAS,EAAE,SAAS;oBACpB,IAAI;iBACP,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACF,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE;YACF,WAAW,EACP,qHAAqH;YACzH,MAAM,EAAE,KAAK;YACb,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,kFAAkF;SAC1F;QACD,QAAQ,EAAE;YACN,OAAO,EACH,4DAA4D;SACnE;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,IAAI,EAAE,sBAAsB;CAC/B,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { createRule } from "../_internal/create-rule.js";
2
+ /** Rule implementation. */
3
+ declare const rule: ReturnType<typeof createRule>;
4
+ export default rule;
5
+ //# sourceMappingURL=no-worker-blob-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-worker-blob-url.d.ts","sourceRoot":"","sources":["../../src/rules/no-worker-blob-url.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAsBzD,2BAA2B;AAC3B,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CA8DtC,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { createRule } from "../_internal/create-rule.js";
2
+ import { getStaticStringValue } from "../_internal/estree-utils.js";
3
+ import { isBlobUrl, isImportScriptsCall, isUrlCreateObjectUrlCall, isWorkerConstructor, } from "../_internal/worker-code-loading.js";
4
+ const isBlobBackedWorkerCodeExpression = (expression) => {
5
+ const configuredValue = getStaticStringValue(expression);
6
+ return ((typeof configuredValue === "string" && isBlobUrl(configuredValue)) ||
7
+ isUrlCreateObjectUrlCall(expression));
8
+ };
9
+ /** Rule implementation. */
10
+ const rule = createRule({
11
+ create(context) {
12
+ return {
13
+ CallExpression(node) {
14
+ if (!isImportScriptsCall(node.callee)) {
15
+ return;
16
+ }
17
+ for (const argumentNode of node.arguments) {
18
+ if (argumentNode.type === "SpreadElement" ||
19
+ !isBlobBackedWorkerCodeExpression(argumentNode)) {
20
+ continue;
21
+ }
22
+ context.report({
23
+ messageId: "default",
24
+ node: argumentNode,
25
+ });
26
+ }
27
+ },
28
+ NewExpression(node) {
29
+ if (!isWorkerConstructor(node.callee)) {
30
+ return;
31
+ }
32
+ const [firstArgument] = node.arguments;
33
+ if (firstArgument === undefined ||
34
+ firstArgument.type === "SpreadElement" ||
35
+ !isBlobBackedWorkerCodeExpression(firstArgument)) {
36
+ return;
37
+ }
38
+ context.report({
39
+ messageId: "default",
40
+ node: firstArgument,
41
+ });
42
+ },
43
+ };
44
+ },
45
+ defaultOptions: [],
46
+ meta: {
47
+ deprecated: false,
48
+ docs: {
49
+ description: "disallow worker code-loading APIs that use blob: URLs or URL.createObjectURL(...) for executable scripts.",
50
+ frozen: false,
51
+ recommended: false,
52
+ url: "https://nick2bad4u.github.io/eslint-plugin-SDL-2/docs/rules/no-worker-blob-url",
53
+ },
54
+ messages: {
55
+ default: "Do not load worker code from a blob: URL or URL.createObjectURL(...); use a reviewed worker script resource instead.",
56
+ },
57
+ schema: [],
58
+ type: "problem",
59
+ },
60
+ name: "no-worker-blob-url",
61
+ });
62
+ export default rule;
63
+ /* eslint-enable @typescript-eslint/prefer-readonly-parameter-types -- Restore linting after rule implementation declarations. */
64
+ //# sourceMappingURL=no-worker-blob-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-worker-blob-url.js","sourceRoot":"","sources":["../../src/rules/no-worker-blob-url.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACH,SAAS,EACT,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACtB,MAAM,qCAAqC,CAAC;AAI7C,MAAM,gCAAgC,GAAG,CACrC,UAAyC,EAClC,EAAE;IACT,MAAM,eAAe,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAEzD,OAAO,CACH,CAAC,OAAO,eAAe,KAAK,QAAQ,IAAI,SAAS,CAAC,eAAe,CAAC,CAAC;QACnE,wBAAwB,CAAC,UAAU,CAAC,CACvC,CAAC;AACN,CAAC,CAAC;AAEF,2BAA2B;AAC3B,MAAM,IAAI,GAAkC,UAAU,CAAwB;IAC1E,MAAM,CAAC,OAAO;QACV,OAAO;YACH,cAAc,CAAC,IAA6B;gBACxC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACpC,OAAO;gBACX,CAAC;gBAED,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;oBACxC,IACI,YAAY,CAAC,IAAI,KAAK,eAAe;wBACrC,CAAC,gCAAgC,CAAC,YAAY,CAAC,EACjD,CAAC;wBACC,SAAS;oBACb,CAAC;oBAED,OAAO,CAAC,MAAM,CAAC;wBACX,SAAS,EAAE,SAAS;wBACpB,IAAI,EAAE,YAAY;qBACrB,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;YACD,aAAa,CAAC,IAA4B;gBACtC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACpC,OAAO;gBACX,CAAC;gBAED,MAAM,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;gBAEvC,IACI,aAAa,KAAK,SAAS;oBAC3B,aAAa,CAAC,IAAI,KAAK,eAAe;oBACtC,CAAC,gCAAgC,CAAC,aAAa,CAAC,EAClD,CAAC;oBACC,OAAO;gBACX,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACX,SAAS,EAAE,SAAS;oBACpB,IAAI,EAAE,aAAa;iBACtB,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;IACD,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACF,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE;YACF,WAAW,EACP,2GAA2G;YAC/G,MAAM,EAAE,KAAK;YACb,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,gFAAgF;SACxF;QACD,QAAQ,EAAE;YACN,OAAO,EACH,sHAAsH;SAC7H;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,IAAI,EAAE,oBAAoB;CAC7B,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC;AACpB,iIAAiI"}
@@ -0,0 +1,5 @@
1
+ import { createRule } from "../_internal/create-rule.js";
2
+ /** Rule implementation. */
3
+ declare const rule: ReturnType<typeof createRule>;
4
+ export default rule;
5
+ //# sourceMappingURL=no-worker-data-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-worker-data-url.d.ts","sourceRoot":"","sources":["../../src/rules/no-worker-data-url.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAUzD,2BAA2B;AAC3B,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CA4EtC,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { createRule } from "../_internal/create-rule.js";
2
+ import { getStaticStringValue } from "../_internal/estree-utils.js";
3
+ import { isDataUrl, isImportScriptsCall, isWorkerConstructor, } from "../_internal/worker-code-loading.js";
4
+ /** Rule implementation. */
5
+ const rule = createRule({
6
+ create(context) {
7
+ return {
8
+ CallExpression(node) {
9
+ if (!isImportScriptsCall(node.callee)) {
10
+ return;
11
+ }
12
+ for (const argumentNode of node.arguments) {
13
+ if (argumentNode.type === "SpreadElement") {
14
+ continue;
15
+ }
16
+ const configuredValue = getStaticStringValue(argumentNode);
17
+ if (typeof configuredValue !== "string" ||
18
+ !isDataUrl(configuredValue)) {
19
+ continue;
20
+ }
21
+ context.report({
22
+ messageId: "default",
23
+ node: argumentNode,
24
+ });
25
+ }
26
+ },
27
+ NewExpression(node) {
28
+ if (!isWorkerConstructor(node.callee)) {
29
+ return;
30
+ }
31
+ const [firstArgument] = node.arguments;
32
+ if (firstArgument === undefined ||
33
+ firstArgument.type === "SpreadElement") {
34
+ return;
35
+ }
36
+ const configuredValue = getStaticStringValue(firstArgument);
37
+ if (typeof configuredValue !== "string" ||
38
+ !isDataUrl(configuredValue)) {
39
+ return;
40
+ }
41
+ context.report({
42
+ messageId: "default",
43
+ node: firstArgument,
44
+ });
45
+ },
46
+ };
47
+ },
48
+ defaultOptions: [],
49
+ meta: {
50
+ deprecated: false,
51
+ docs: {
52
+ description: "disallow worker code-loading APIs that use static data: URLs for executable scripts.",
53
+ frozen: false,
54
+ recommended: false,
55
+ url: "https://nick2bad4u.github.io/eslint-plugin-SDL-2/docs/rules/no-worker-data-url",
56
+ },
57
+ messages: {
58
+ default: "Do not load worker code from a data: URL; use a reviewed worker script resource instead.",
59
+ },
60
+ schema: [],
61
+ type: "problem",
62
+ },
63
+ name: "no-worker-data-url",
64
+ });
65
+ export default rule;
66
+ /* eslint-enable @typescript-eslint/prefer-readonly-parameter-types -- Restore linting after rule implementation declarations. */
67
+ //# sourceMappingURL=no-worker-data-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-worker-data-url.js","sourceRoot":"","sources":["../../src/rules/no-worker-data-url.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACH,SAAS,EACT,mBAAmB,EACnB,mBAAmB,GACtB,MAAM,qCAAqC,CAAC;AAI7C,2BAA2B;AAC3B,MAAM,IAAI,GAAkC,UAAU,CAAwB;IAC1E,MAAM,CAAC,OAAO;QACV,OAAO;YACH,cAAc,CAAC,IAA6B;gBACxC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACpC,OAAO;gBACX,CAAC;gBAED,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;oBACxC,IAAI,YAAY,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;wBACxC,SAAS;oBACb,CAAC;oBAED,MAAM,eAAe,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;oBAE3D,IACI,OAAO,eAAe,KAAK,QAAQ;wBACnC,CAAC,SAAS,CAAC,eAAe,CAAC,EAC7B,CAAC;wBACC,SAAS;oBACb,CAAC;oBAED,OAAO,CAAC,MAAM,CAAC;wBACX,SAAS,EAAE,SAAS;wBACpB,IAAI,EAAE,YAAY;qBACrB,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;YACD,aAAa,CAAC,IAA4B;gBACtC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACpC,OAAO;gBACX,CAAC;gBAED,MAAM,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;gBAEvC,IACI,aAAa,KAAK,SAAS;oBAC3B,aAAa,CAAC,IAAI,KAAK,eA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