@metamask/snaps-execution-environments 6.6.2 → 6.7.0

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 (526) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/common/BaseSnapExecutor.cjs +436 -0
  3. package/dist/common/BaseSnapExecutor.cjs.map +1 -0
  4. package/dist/{types/common/BaseSnapExecutor.d.ts → common/BaseSnapExecutor.d.cts} +8 -6
  5. package/dist/common/BaseSnapExecutor.d.cts.map +1 -0
  6. package/dist/common/BaseSnapExecutor.d.mts +70 -0
  7. package/dist/common/BaseSnapExecutor.d.mts.map +1 -0
  8. package/dist/common/BaseSnapExecutor.mjs +430 -24
  9. package/dist/common/BaseSnapExecutor.mjs.map +1 -1
  10. package/dist/common/commands.cjs +95 -0
  11. package/dist/common/commands.cjs.map +1 -0
  12. package/dist/{types/common/commands.d.ts → common/commands.d.cts} +5 -4
  13. package/dist/common/commands.d.cts.map +1 -0
  14. package/dist/common/commands.d.mts +31 -0
  15. package/dist/common/commands.d.mts.map +1 -0
  16. package/dist/common/commands.mjs +89 -10
  17. package/dist/common/commands.mjs.map +1 -1
  18. package/dist/common/endowments/commonEndowmentFactory.cjs +76 -0
  19. package/dist/common/endowments/commonEndowmentFactory.cjs.map +1 -0
  20. package/dist/{types/common/endowments/commonEndowmentFactory.d.ts → common/endowments/commonEndowmentFactory.d.cts} +5 -4
  21. package/dist/common/endowments/commonEndowmentFactory.d.cts.map +1 -0
  22. package/dist/common/endowments/commonEndowmentFactory.d.mts +26 -0
  23. package/dist/common/endowments/commonEndowmentFactory.d.mts.map +1 -0
  24. package/dist/common/endowments/commonEndowmentFactory.mjs +69 -18
  25. package/dist/common/endowments/commonEndowmentFactory.mjs.map +1 -1
  26. package/dist/common/endowments/console.cjs +103 -0
  27. package/dist/common/endowments/console.cjs.map +1 -0
  28. package/dist/{types/common/endowments/console.d.ts → common/endowments/console.d.cts} +2 -1
  29. package/dist/common/endowments/console.d.cts.map +1 -0
  30. package/dist/common/endowments/console.d.mts +46 -0
  31. package/dist/common/endowments/console.d.mts.map +1 -0
  32. package/dist/common/endowments/console.mjs +98 -11
  33. package/dist/common/endowments/console.mjs.map +1 -1
  34. package/dist/common/endowments/crypto.cjs +30 -0
  35. package/dist/common/endowments/crypto.cjs.map +1 -0
  36. package/dist/{types/common/endowments/crypto.d.ts → common/endowments/crypto.d.cts} +1 -0
  37. package/dist/common/endowments/crypto.d.cts.map +1 -0
  38. package/dist/common/endowments/crypto.d.mts +13 -0
  39. package/dist/common/endowments/crypto.d.mts.map +1 -0
  40. package/dist/common/endowments/crypto.mjs +24 -9
  41. package/dist/common/endowments/crypto.mjs.map +1 -1
  42. package/dist/common/endowments/date.cjs +39 -0
  43. package/dist/common/endowments/date.cjs.map +1 -0
  44. package/dist/{types/common/endowments/date.d.ts → common/endowments/date.d.cts} +1 -0
  45. package/dist/common/endowments/date.d.cts.map +1 -0
  46. package/dist/common/endowments/date.d.mts +16 -0
  47. package/dist/common/endowments/date.d.mts.map +1 -0
  48. package/dist/common/endowments/date.mjs +35 -7
  49. package/dist/common/endowments/date.mjs.map +1 -1
  50. package/dist/common/endowments/index.cjs +93 -0
  51. package/dist/common/endowments/index.cjs.map +1 -0
  52. package/dist/{types/common/endowments/index.d.ts → common/endowments/index.d.cts} +4 -3
  53. package/dist/common/endowments/index.d.cts.map +1 -0
  54. package/dist/common/endowments/index.d.mts +29 -0
  55. package/dist/common/endowments/index.d.mts.map +1 -0
  56. package/dist/common/endowments/index.mjs +85 -20
  57. package/dist/common/endowments/index.mjs.map +1 -1
  58. package/dist/common/endowments/interval.cjs +51 -0
  59. package/dist/common/endowments/interval.cjs.map +1 -0
  60. package/dist/{types/common/endowments/interval.d.ts → common/endowments/interval.d.cts} +1 -0
  61. package/dist/common/endowments/interval.d.cts.map +1 -0
  62. package/dist/common/endowments/interval.d.mts +10 -0
  63. package/dist/common/endowments/interval.d.mts.map +1 -0
  64. package/dist/common/endowments/interval.mjs +47 -6
  65. package/dist/common/endowments/interval.mjs.map +1 -1
  66. package/dist/common/endowments/math.cjs +54 -0
  67. package/dist/common/endowments/math.cjs.map +1 -0
  68. package/dist/{types/common/endowments/math.d.ts → common/endowments/math.d.cts} +1 -0
  69. package/dist/common/endowments/math.d.cts.map +1 -0
  70. package/dist/common/endowments/math.d.mts +61 -0
  71. package/dist/common/endowments/math.d.mts.map +1 -0
  72. package/dist/common/endowments/math.mjs +50 -8
  73. package/dist/common/endowments/math.mjs.map +1 -1
  74. package/dist/common/endowments/network.cjs +255 -0
  75. package/dist/common/endowments/network.cjs.map +1 -0
  76. package/dist/{types/common/endowments/network.d.ts → common/endowments/network.d.cts} +4 -2
  77. package/dist/common/endowments/network.d.cts.map +1 -0
  78. package/dist/common/endowments/network.d.mts +25 -0
  79. package/dist/common/endowments/network.d.mts.map +1 -0
  80. package/dist/common/endowments/network.mjs +251 -8
  81. package/dist/common/endowments/network.mjs.map +1 -1
  82. package/dist/common/endowments/textDecoder.cjs +18 -0
  83. package/dist/common/endowments/textDecoder.cjs.map +1 -0
  84. package/dist/{types/common/endowments/textDecoder.d.ts → common/endowments/textDecoder.d.cts} +1 -0
  85. package/dist/common/endowments/textDecoder.d.cts.map +1 -0
  86. package/dist/common/endowments/textDecoder.d.mts +11 -0
  87. package/dist/common/endowments/textDecoder.d.mts.map +1 -0
  88. package/dist/common/endowments/textDecoder.mjs +14 -6
  89. package/dist/common/endowments/textDecoder.mjs.map +1 -1
  90. package/dist/common/endowments/textEncoder.cjs +18 -0
  91. package/dist/common/endowments/textEncoder.cjs.map +1 -0
  92. package/dist/{types/common/endowments/textEncoder.d.ts → common/endowments/textEncoder.d.cts} +1 -0
  93. package/dist/common/endowments/textEncoder.d.cts.map +1 -0
  94. package/dist/common/endowments/textEncoder.d.mts +11 -0
  95. package/dist/common/endowments/textEncoder.d.mts.map +1 -0
  96. package/dist/common/endowments/textEncoder.mjs +14 -6
  97. package/dist/common/endowments/textEncoder.mjs.map +1 -1
  98. package/dist/common/endowments/timeout.cjs +53 -0
  99. package/dist/common/endowments/timeout.cjs.map +1 -0
  100. package/dist/{types/common/endowments/timeout.d.ts → common/endowments/timeout.d.cts} +1 -0
  101. package/dist/common/endowments/timeout.d.cts.map +1 -0
  102. package/dist/common/endowments/timeout.d.mts +10 -0
  103. package/dist/common/endowments/timeout.d.mts.map +1 -0
  104. package/dist/common/endowments/timeout.mjs +49 -6
  105. package/dist/common/endowments/timeout.mjs.map +1 -1
  106. package/dist/common/globalEvents.cjs +48 -0
  107. package/dist/common/globalEvents.cjs.map +1 -0
  108. package/dist/{types/common/globalEvents.d.ts → common/globalEvents.d.cts} +1 -0
  109. package/dist/common/globalEvents.d.cts.map +1 -0
  110. package/dist/common/globalEvents.d.mts +21 -0
  111. package/dist/common/globalEvents.d.mts.map +1 -0
  112. package/dist/common/globalEvents.mjs +42 -10
  113. package/dist/common/globalEvents.mjs.map +1 -1
  114. package/dist/common/globalObject.cjs +50 -0
  115. package/dist/common/globalObject.cjs.map +1 -0
  116. package/dist/{types/common/globalObject.d.ts → common/globalObject.d.cts} +1 -0
  117. package/dist/common/globalObject.d.cts.map +1 -0
  118. package/dist/common/globalObject.d.mts +10 -0
  119. package/dist/common/globalObject.d.mts.map +1 -0
  120. package/dist/common/globalObject.mjs +45 -9
  121. package/dist/common/globalObject.mjs.map +1 -1
  122. package/dist/common/lockdown/lockdown-events.cjs +60 -0
  123. package/dist/common/lockdown/lockdown-events.cjs.map +1 -0
  124. package/dist/{types/common/lockdown/lockdown-events.d.ts → common/lockdown/lockdown-events.d.cts} +1 -0
  125. package/dist/common/lockdown/lockdown-events.d.cts.map +1 -0
  126. package/dist/common/lockdown/lockdown-events.d.mts +5 -0
  127. package/dist/common/lockdown/lockdown-events.d.mts.map +1 -0
  128. package/dist/common/lockdown/lockdown-events.mjs +55 -7
  129. package/dist/common/lockdown/lockdown-events.mjs.map +1 -1
  130. package/dist/common/lockdown/lockdown-more.cjs +89 -0
  131. package/dist/common/lockdown/lockdown-more.cjs.map +1 -0
  132. package/dist/{types/common/lockdown/lockdown-more.d.ts → common/lockdown/lockdown-more.d.cts} +1 -0
  133. package/dist/common/lockdown/lockdown-more.d.cts.map +1 -0
  134. package/dist/common/lockdown/lockdown-more.d.mts +23 -0
  135. package/dist/common/lockdown/lockdown-more.d.mts.map +1 -0
  136. package/dist/common/lockdown/lockdown-more.mjs +84 -7
  137. package/dist/common/lockdown/lockdown-more.mjs.map +1 -1
  138. package/dist/common/lockdown/lockdown.cjs +29 -0
  139. package/dist/common/lockdown/lockdown.cjs.map +1 -0
  140. package/dist/{types/common/lockdown/lockdown.d.ts → common/lockdown/lockdown.d.cts} +1 -0
  141. package/dist/common/lockdown/lockdown.d.cts.map +1 -0
  142. package/dist/common/lockdown/lockdown.d.mts +8 -0
  143. package/dist/common/lockdown/lockdown.d.mts.map +1 -0
  144. package/dist/common/lockdown/lockdown.mjs +22 -19
  145. package/dist/common/lockdown/lockdown.mjs.map +1 -1
  146. package/dist/common/sortParams.cjs +35 -0
  147. package/dist/common/sortParams.cjs.map +1 -0
  148. package/dist/{types/common/sortParams.d.ts → common/sortParams.d.cts} +2 -1
  149. package/dist/common/sortParams.d.cts.map +1 -0
  150. package/dist/common/sortParams.d.mts +17 -0
  151. package/dist/common/sortParams.d.mts.map +1 -0
  152. package/dist/common/sortParams.mjs +29 -6
  153. package/dist/common/sortParams.mjs.map +1 -1
  154. package/dist/common/utils.cjs +156 -0
  155. package/dist/common/utils.cjs.map +1 -0
  156. package/dist/{types/common/utils.d.ts → common/utils.d.cts} +2 -1
  157. package/dist/common/utils.d.cts.map +1 -0
  158. package/dist/common/utils.d.mts +50 -0
  159. package/dist/common/utils.d.mts.map +1 -0
  160. package/dist/common/utils.mjs +146 -20
  161. package/dist/common/utils.mjs.map +1 -1
  162. package/dist/common/validation.cjs +137 -0
  163. package/dist/common/validation.cjs.map +1 -0
  164. package/dist/{types/common/validation.d.ts → common/validation.d.cts} +37 -36
  165. package/dist/common/validation.d.cts.map +1 -0
  166. package/dist/common/validation.d.mts +199 -0
  167. package/dist/common/validation.d.mts.map +1 -0
  168. package/dist/common/validation.mjs +127 -37
  169. package/dist/common/validation.mjs.map +1 -1
  170. package/dist/iframe/IFrameSnapExecutor.cjs +42 -0
  171. package/dist/iframe/IFrameSnapExecutor.cjs.map +1 -0
  172. package/dist/{types/iframe/IFrameSnapExecutor.d.ts → iframe/IFrameSnapExecutor.d.cts} +3 -2
  173. package/dist/iframe/IFrameSnapExecutor.d.cts.map +1 -0
  174. package/dist/iframe/IFrameSnapExecutor.d.mts +14 -0
  175. package/dist/iframe/IFrameSnapExecutor.d.mts.map +1 -0
  176. package/dist/iframe/IFrameSnapExecutor.mjs +42 -26
  177. package/dist/iframe/IFrameSnapExecutor.mjs.map +1 -1
  178. package/dist/iframe/index.cjs +10 -0
  179. package/dist/iframe/index.cjs.map +1 -0
  180. package/dist/iframe/index.d.cts +2 -0
  181. package/dist/iframe/index.d.cts.map +1 -0
  182. package/dist/iframe/index.d.mts +2 -0
  183. package/dist/iframe/index.d.mts.map +1 -0
  184. package/dist/iframe/index.mjs +4 -31
  185. package/dist/iframe/index.mjs.map +1 -1
  186. package/dist/index.cjs +18 -0
  187. package/dist/index.cjs.map +1 -0
  188. package/dist/index.d.cts +2 -0
  189. package/dist/index.d.cts.map +1 -0
  190. package/dist/index.d.mts +2 -0
  191. package/dist/index.d.mts.map +1 -0
  192. package/dist/index.mjs +1 -8
  193. package/dist/index.mjs.map +1 -1
  194. package/dist/logging.cjs +13 -0
  195. package/dist/logging.cjs.map +1 -0
  196. package/dist/{types/logging.d.ts → logging.d.cts} +1 -0
  197. package/dist/logging.d.cts.map +1 -0
  198. package/dist/logging.d.mts +9 -0
  199. package/dist/logging.d.mts.map +1 -0
  200. package/dist/logging.mjs +9 -7
  201. package/dist/logging.mjs.map +1 -1
  202. package/dist/node-process/ChildProcessSnapExecutor.cjs +30 -0
  203. package/dist/node-process/ChildProcessSnapExecutor.cjs.map +1 -0
  204. package/dist/{types/node-process/ChildProcessSnapExecutor.d.ts → node-process/ChildProcessSnapExecutor.d.cts} +2 -1
  205. package/dist/node-process/ChildProcessSnapExecutor.d.cts.map +1 -0
  206. package/dist/node-process/ChildProcessSnapExecutor.d.mts +5 -0
  207. package/dist/node-process/ChildProcessSnapExecutor.d.mts.map +1 -0
  208. package/dist/node-process/ChildProcessSnapExecutor.mjs +30 -26
  209. package/dist/node-process/ChildProcessSnapExecutor.mjs.map +1 -1
  210. package/dist/node-process/index.cjs +8 -0
  211. package/dist/node-process/index.cjs.map +1 -0
  212. package/dist/node-process/index.d.cts +2 -0
  213. package/dist/node-process/index.d.cts.map +1 -0
  214. package/dist/node-process/index.d.mts +2 -0
  215. package/dist/node-process/index.d.mts.map +1 -0
  216. package/dist/node-process/index.mjs +3 -28
  217. package/dist/node-process/index.mjs.map +1 -1
  218. package/dist/node-thread/ThreadSnapExecutor.cjs +30 -0
  219. package/dist/node-thread/ThreadSnapExecutor.cjs.map +1 -0
  220. package/dist/node-thread/ThreadSnapExecutor.d.cts +5 -0
  221. package/dist/node-thread/ThreadSnapExecutor.d.cts.map +1 -0
  222. package/dist/node-thread/ThreadSnapExecutor.d.mts +5 -0
  223. package/dist/node-thread/ThreadSnapExecutor.d.mts.map +1 -0
  224. package/dist/node-thread/ThreadSnapExecutor.mjs +30 -26
  225. package/dist/node-thread/ThreadSnapExecutor.mjs.map +1 -1
  226. package/dist/node-thread/index.cjs +8 -0
  227. package/dist/node-thread/index.cjs.map +1 -0
  228. package/dist/node-thread/index.d.cts +2 -0
  229. package/dist/node-thread/index.d.cts.map +1 -0
  230. package/dist/node-thread/index.d.mts +2 -0
  231. package/dist/node-thread/index.d.mts.map +1 -0
  232. package/dist/node-thread/index.mjs +3 -28
  233. package/dist/node-thread/index.mjs.map +1 -1
  234. package/dist/proxy/ProxySnapExecutor.cjs +112 -0
  235. package/dist/proxy/ProxySnapExecutor.cjs.map +1 -0
  236. package/dist/{types/proxy/ProxySnapExecutor.d.ts → proxy/ProxySnapExecutor.d.cts} +4 -3
  237. package/dist/proxy/ProxySnapExecutor.d.cts.map +1 -0
  238. package/dist/proxy/ProxySnapExecutor.d.mts +36 -0
  239. package/dist/proxy/ProxySnapExecutor.d.mts.map +1 -0
  240. package/dist/proxy/ProxySnapExecutor.mjs +104 -6
  241. package/dist/proxy/ProxySnapExecutor.mjs.map +1 -1
  242. package/dist/proxy/index.cjs +18 -0
  243. package/dist/proxy/index.cjs.map +1 -0
  244. package/dist/proxy/index.d.cts +2 -0
  245. package/dist/proxy/index.d.cts.map +1 -0
  246. package/dist/proxy/index.d.mts +2 -0
  247. package/dist/proxy/index.d.mts.map +1 -0
  248. package/dist/proxy/index.mjs +1 -8
  249. package/dist/proxy/index.mjs.map +1 -1
  250. package/dist/webview/WebViewExecutorStream.cjs +79 -0
  251. package/dist/webview/WebViewExecutorStream.cjs.map +1 -0
  252. package/dist/{types/webview/WebViewExecutorStream.d.ts → webview/WebViewExecutorStream.d.cts} +3 -2
  253. package/dist/webview/WebViewExecutorStream.d.cts.map +1 -0
  254. package/dist/webview/WebViewExecutorStream.d.mts +33 -0
  255. package/dist/webview/WebViewExecutorStream.d.mts.map +1 -0
  256. package/dist/webview/WebViewExecutorStream.mjs +74 -6
  257. package/dist/webview/WebViewExecutorStream.mjs.map +1 -1
  258. package/dist/webview/index.cjs +16 -0
  259. package/dist/webview/index.cjs.map +1 -0
  260. package/dist/webview/index.d.cts +2 -0
  261. package/dist/webview/index.d.cts.map +1 -0
  262. package/dist/webview/index.d.mts +2 -0
  263. package/dist/webview/index.d.mts.map +1 -0
  264. package/dist/webview/index.mjs +9 -21
  265. package/dist/webview/index.mjs.map +1 -1
  266. package/dist/webworker/executor/WebWorkerSnapExecutor.cjs +37 -0
  267. package/dist/webworker/executor/WebWorkerSnapExecutor.cjs.map +1 -0
  268. package/dist/{types/webworker/executor/WebWorkerSnapExecutor.d.ts → webworker/executor/WebWorkerSnapExecutor.d.cts} +3 -2
  269. package/dist/webworker/executor/WebWorkerSnapExecutor.d.cts.map +1 -0
  270. package/dist/webworker/executor/WebWorkerSnapExecutor.d.mts +14 -0
  271. package/dist/webworker/executor/WebWorkerSnapExecutor.d.mts.map +1 -0
  272. package/dist/webworker/executor/WebWorkerSnapExecutor.mjs +37 -26
  273. package/dist/webworker/executor/WebWorkerSnapExecutor.mjs.map +1 -1
  274. package/dist/webworker/executor/index.cjs +10 -0
  275. package/dist/webworker/executor/index.cjs.map +1 -0
  276. package/dist/webworker/executor/index.d.cts +2 -0
  277. package/dist/webworker/executor/index.d.cts.map +1 -0
  278. package/dist/webworker/executor/index.d.mts +2 -0
  279. package/dist/webworker/executor/index.d.mts.map +1 -0
  280. package/dist/webworker/executor/index.mjs +4 -31
  281. package/dist/webworker/executor/index.mjs.map +1 -1
  282. package/dist/webworker/pool/WebWorkerPool.cjs +168 -0
  283. package/dist/webworker/pool/WebWorkerPool.cjs.map +1 -0
  284. package/dist/{types/webworker/pool/WebWorkerPool.d.ts → webworker/pool/WebWorkerPool.d.cts} +4 -3
  285. package/dist/webworker/pool/WebWorkerPool.d.cts.map +1 -0
  286. package/dist/webworker/pool/WebWorkerPool.d.mts +24 -0
  287. package/dist/webworker/pool/WebWorkerPool.d.mts.map +1 -0
  288. package/dist/webworker/pool/WebWorkerPool.mjs +163 -6
  289. package/dist/webworker/pool/WebWorkerPool.mjs.map +1 -1
  290. package/dist/webworker/pool/index.cjs +10 -0
  291. package/dist/webworker/pool/index.cjs.map +1 -0
  292. package/dist/webworker/pool/index.d.cts +2 -0
  293. package/dist/webworker/pool/index.d.cts.map +1 -0
  294. package/dist/webworker/pool/index.d.mts +2 -0
  295. package/dist/webworker/pool/index.d.mts.map +1 -0
  296. package/dist/webworker/pool/index.mjs +4 -12
  297. package/dist/webworker/pool/index.mjs.map +1 -1
  298. package/package.json +21 -18
  299. package/dist/browserify/iframe/bundle.js +0 -9
  300. package/dist/browserify/iframe/index.html +0 -13394
  301. package/dist/browserify/node-process/bundle.js +0 -13390
  302. package/dist/browserify/node-thread/bundle.js +0 -13390
  303. package/dist/browserify/webview/index.html +0 -13402
  304. package/dist/browserify/worker-executor/bundle.js +0 -13392
  305. package/dist/browserify/worker-pool/bundle.js +0 -9
  306. package/dist/browserify/worker-pool/index.html +0 -13394
  307. package/dist/chunk-2VA6RAEE.js +0 -30
  308. package/dist/chunk-2VA6RAEE.js.map +0 -1
  309. package/dist/chunk-3JCT4MWT.js +0 -108
  310. package/dist/chunk-3JCT4MWT.js.map +0 -1
  311. package/dist/chunk-46LW37FK.js +0 -144
  312. package/dist/chunk-46LW37FK.js.map +0 -1
  313. package/dist/chunk-4COIRXF5.js +0 -86
  314. package/dist/chunk-4COIRXF5.js.map +0 -1
  315. package/dist/chunk-4XRZLEKU.js +0 -49
  316. package/dist/chunk-4XRZLEKU.js.map +0 -1
  317. package/dist/chunk-53ZULHPK.mjs +0 -16
  318. package/dist/chunk-53ZULHPK.mjs.map +0 -1
  319. package/dist/chunk-5DEV3QQU.mjs +0 -12
  320. package/dist/chunk-5DEV3QQU.mjs.map +0 -1
  321. package/dist/chunk-5LGIS4VY.js +0 -33
  322. package/dist/chunk-5LGIS4VY.js.map +0 -1
  323. package/dist/chunk-5STN3QCA.js +0 -183
  324. package/dist/chunk-5STN3QCA.js.map +0 -1
  325. package/dist/chunk-75RCH4ZX.mjs +0 -151
  326. package/dist/chunk-75RCH4ZX.mjs.map +0 -1
  327. package/dist/chunk-7AJWXSDQ.mjs +0 -73
  328. package/dist/chunk-7AJWXSDQ.mjs.map +0 -1
  329. package/dist/chunk-7MMUJJQ2.js +0 -151
  330. package/dist/chunk-7MMUJJQ2.js.map +0 -1
  331. package/dist/chunk-BCBKEUCG.mjs +0 -38
  332. package/dist/chunk-BCBKEUCG.mjs.map +0 -1
  333. package/dist/chunk-BTEAZZKP.mjs +0 -24
  334. package/dist/chunk-BTEAZZKP.mjs.map +0 -1
  335. package/dist/chunk-BVRVUIJB.mjs +0 -67
  336. package/dist/chunk-BVRVUIJB.mjs.map +0 -1
  337. package/dist/chunk-CV5LC4PP.js +0 -24
  338. package/dist/chunk-CV5LC4PP.js.map +0 -1
  339. package/dist/chunk-DAG7NWEU.mjs +0 -33
  340. package/dist/chunk-DAG7NWEU.mjs.map +0 -1
  341. package/dist/chunk-DKDTGAFK.js +0 -67
  342. package/dist/chunk-DKDTGAFK.js.map +0 -1
  343. package/dist/chunk-DLLLH5HN.js +0 -26
  344. package/dist/chunk-DLLLH5HN.js.map +0 -1
  345. package/dist/chunk-EXN2TFDJ.js +0 -38
  346. package/dist/chunk-EXN2TFDJ.js.map +0 -1
  347. package/dist/chunk-FJT65CXB.js +0 -472
  348. package/dist/chunk-FJT65CXB.js.map +0 -1
  349. package/dist/chunk-FOEAIF5U.js +0 -16
  350. package/dist/chunk-FOEAIF5U.js.map +0 -1
  351. package/dist/chunk-FUPEJT7B.js +0 -82
  352. package/dist/chunk-FUPEJT7B.js.map +0 -1
  353. package/dist/chunk-HCJZG6W7.mjs +0 -45
  354. package/dist/chunk-HCJZG6W7.mjs.map +0 -1
  355. package/dist/chunk-HGLRZZ56.js +0 -32
  356. package/dist/chunk-HGLRZZ56.js.map +0 -1
  357. package/dist/chunk-HL2TTKF3.mjs +0 -144
  358. package/dist/chunk-HL2TTKF3.mjs.map +0 -1
  359. package/dist/chunk-HWS4QSOC.mjs +0 -16
  360. package/dist/chunk-HWS4QSOC.mjs.map +0 -1
  361. package/dist/chunk-HXKBUIYS.js +0 -262
  362. package/dist/chunk-HXKBUIYS.js.map +0 -1
  363. package/dist/chunk-I5G4YFHM.js +0 -73
  364. package/dist/chunk-I5G4YFHM.js.map +0 -1
  365. package/dist/chunk-IX5S3V47.mjs +0 -26
  366. package/dist/chunk-IX5S3V47.mjs.map +0 -1
  367. package/dist/chunk-JOT5JH42.js +0 -52
  368. package/dist/chunk-JOT5JH42.js.map +0 -1
  369. package/dist/chunk-KEAB7ZVV.js +0 -50
  370. package/dist/chunk-KEAB7ZVV.js.map +0 -1
  371. package/dist/chunk-LAKWJYBO.js +0 -33
  372. package/dist/chunk-LAKWJYBO.js.map +0 -1
  373. package/dist/chunk-LO5ORVRC.js +0 -16
  374. package/dist/chunk-LO5ORVRC.js.map +0 -1
  375. package/dist/chunk-MCXWFCGV.js +0 -1
  376. package/dist/chunk-MCXWFCGV.js.map +0 -1
  377. package/dist/chunk-MIWGLICQ.mjs +0 -108
  378. package/dist/chunk-MIWGLICQ.mjs.map +0 -1
  379. package/dist/chunk-MMYM63NH.mjs +0 -82
  380. package/dist/chunk-MMYM63NH.mjs.map +0 -1
  381. package/dist/chunk-MS2LQQYH.js +0 -38
  382. package/dist/chunk-MS2LQQYH.js.map +0 -1
  383. package/dist/chunk-MXNMMTJW.mjs +0 -51
  384. package/dist/chunk-MXNMMTJW.mjs.map +0 -1
  385. package/dist/chunk-OBT45IWW.js +0 -92
  386. package/dist/chunk-OBT45IWW.js.map +0 -1
  387. package/dist/chunk-OCNPLHS2.js +0 -51
  388. package/dist/chunk-OCNPLHS2.js.map +0 -1
  389. package/dist/chunk-ODICKSGZ.mjs +0 -86
  390. package/dist/chunk-ODICKSGZ.mjs.map +0 -1
  391. package/dist/chunk-OIN7VU4G.mjs +0 -33
  392. package/dist/chunk-OIN7VU4G.mjs.map +0 -1
  393. package/dist/chunk-Q42NNJFY.mjs +0 -32
  394. package/dist/chunk-Q42NNJFY.mjs.map +0 -1
  395. package/dist/chunk-Q42WB3ZO.js +0 -40
  396. package/dist/chunk-Q42WB3ZO.js.map +0 -1
  397. package/dist/chunk-QZC2X6NG.js +0 -44
  398. package/dist/chunk-QZC2X6NG.js.map +0 -1
  399. package/dist/chunk-S5NWI5Z7.mjs +0 -50
  400. package/dist/chunk-S5NWI5Z7.mjs.map +0 -1
  401. package/dist/chunk-S7257EN3.mjs +0 -49
  402. package/dist/chunk-S7257EN3.mjs.map +0 -1
  403. package/dist/chunk-TSEAPB7L.mjs +0 -1
  404. package/dist/chunk-TSEAPB7L.mjs.map +0 -1
  405. package/dist/chunk-TZAPZE45.mjs +0 -472
  406. package/dist/chunk-TZAPZE45.mjs.map +0 -1
  407. package/dist/chunk-UOPIRTJX.mjs +0 -44
  408. package/dist/chunk-UOPIRTJX.mjs.map +0 -1
  409. package/dist/chunk-V76DI2XM.mjs +0 -183
  410. package/dist/chunk-V76DI2XM.mjs.map +0 -1
  411. package/dist/chunk-VFQ5CRZS.mjs +0 -40
  412. package/dist/chunk-VFQ5CRZS.mjs.map +0 -1
  413. package/dist/chunk-W7EDURT5.mjs +0 -92
  414. package/dist/chunk-W7EDURT5.mjs.map +0 -1
  415. package/dist/chunk-WZDVTU5C.js +0 -45
  416. package/dist/chunk-WZDVTU5C.js.map +0 -1
  417. package/dist/chunk-XPCW7TKM.mjs +0 -262
  418. package/dist/chunk-XPCW7TKM.mjs.map +0 -1
  419. package/dist/chunk-Y7AK2VVC.mjs +0 -52
  420. package/dist/chunk-Y7AK2VVC.mjs.map +0 -1
  421. package/dist/chunk-YRZVIDCF.mjs +0 -38
  422. package/dist/chunk-YRZVIDCF.mjs.map +0 -1
  423. package/dist/chunk-Z7BOREC4.js +0 -12
  424. package/dist/chunk-Z7BOREC4.js.map +0 -1
  425. package/dist/chunk-ZNTCZK7J.mjs +0 -30
  426. package/dist/chunk-ZNTCZK7J.mjs.map +0 -1
  427. package/dist/common/BaseSnapExecutor.js +0 -26
  428. package/dist/common/BaseSnapExecutor.js.map +0 -1
  429. package/dist/common/commands.js +0 -11
  430. package/dist/common/commands.js.map +0 -1
  431. package/dist/common/endowments/commonEndowmentFactory.js +0 -20
  432. package/dist/common/endowments/commonEndowmentFactory.js.map +0 -1
  433. package/dist/common/endowments/console.js +0 -13
  434. package/dist/common/endowments/console.js.map +0 -1
  435. package/dist/common/endowments/crypto.js +0 -11
  436. package/dist/common/endowments/crypto.js.map +0 -1
  437. package/dist/common/endowments/date.js +0 -9
  438. package/dist/common/endowments/date.js.map +0 -1
  439. package/dist/common/endowments/index.js +0 -21
  440. package/dist/common/endowments/index.js.map +0 -1
  441. package/dist/common/endowments/interval.js +0 -8
  442. package/dist/common/endowments/interval.js.map +0 -1
  443. package/dist/common/endowments/math.js +0 -10
  444. package/dist/common/endowments/math.js.map +0 -1
  445. package/dist/common/endowments/network.js +0 -10
  446. package/dist/common/endowments/network.js.map +0 -1
  447. package/dist/common/endowments/textDecoder.js +0 -8
  448. package/dist/common/endowments/textDecoder.js.map +0 -1
  449. package/dist/common/endowments/textEncoder.js +0 -8
  450. package/dist/common/endowments/textEncoder.js.map +0 -1
  451. package/dist/common/endowments/timeout.js +0 -8
  452. package/dist/common/endowments/timeout.js.map +0 -1
  453. package/dist/common/globalEvents.js +0 -11
  454. package/dist/common/globalEvents.js.map +0 -1
  455. package/dist/common/globalObject.js +0 -10
  456. package/dist/common/globalObject.js.map +0 -1
  457. package/dist/common/lockdown/lockdown-events.js +0 -8
  458. package/dist/common/lockdown/lockdown-events.js.map +0 -1
  459. package/dist/common/lockdown/lockdown-more.js +0 -8
  460. package/dist/common/lockdown/lockdown-more.js.map +0 -1
  461. package/dist/common/lockdown/lockdown.js +0 -22
  462. package/dist/common/lockdown/lockdown.js.map +0 -1
  463. package/dist/common/sortParams.js +0 -8
  464. package/dist/common/sortParams.js.map +0 -1
  465. package/dist/common/utils.js +0 -21
  466. package/dist/common/utils.js.map +0 -1
  467. package/dist/common/validation.js +0 -38
  468. package/dist/common/validation.js.map +0 -1
  469. package/dist/globals.d.js +0 -1
  470. package/dist/globals.d.js.map +0 -1
  471. package/dist/globals.d.mjs +0 -1
  472. package/dist/globals.d.mjs.map +0 -1
  473. package/dist/iframe/IFrameSnapExecutor.js +0 -27
  474. package/dist/iframe/IFrameSnapExecutor.js.map +0 -1
  475. package/dist/iframe/index.js +0 -35
  476. package/dist/iframe/index.js.map +0 -1
  477. package/dist/index.js +0 -9
  478. package/dist/index.js.map +0 -1
  479. package/dist/logging.js +0 -8
  480. package/dist/logging.js.map +0 -1
  481. package/dist/node-process/ChildProcessSnapExecutor.js +0 -27
  482. package/dist/node-process/ChildProcessSnapExecutor.js.map +0 -1
  483. package/dist/node-process/index.js +0 -31
  484. package/dist/node-process/index.js.map +0 -1
  485. package/dist/node-thread/ThreadSnapExecutor.js +0 -27
  486. package/dist/node-thread/ThreadSnapExecutor.js.map +0 -1
  487. package/dist/node-thread/index.js +0 -31
  488. package/dist/node-thread/index.js.map +0 -1
  489. package/dist/proxy/ProxySnapExecutor.js +0 -8
  490. package/dist/proxy/ProxySnapExecutor.js.map +0 -1
  491. package/dist/proxy/index.js +0 -9
  492. package/dist/proxy/index.js.map +0 -1
  493. package/dist/tsconfig.build.tsbuildinfo +0 -1
  494. package/dist/types/iframe/index.d.ts +0 -1
  495. package/dist/types/index.d.ts +0 -1
  496. package/dist/types/node-process/index.d.ts +0 -1
  497. package/dist/types/node-thread/ThreadSnapExecutor.d.ts +0 -4
  498. package/dist/types/node-thread/index.d.ts +0 -1
  499. package/dist/types/proxy/index.d.ts +0 -1
  500. package/dist/types/vendor/global.d.js +0 -1
  501. package/dist/types/vendor/global.d.js.map +0 -1
  502. package/dist/types/vendor/global.d.mjs +0 -1
  503. package/dist/types/vendor/global.d.mjs.map +0 -1
  504. package/dist/types/vendor/providers.d.js +0 -1
  505. package/dist/types/vendor/providers.d.js.map +0 -1
  506. package/dist/types/vendor/providers.d.mjs +0 -1
  507. package/dist/types/vendor/providers.d.mjs.map +0 -1
  508. package/dist/types/vendor/readable-stream.d.js +0 -1
  509. package/dist/types/vendor/readable-stream.d.js.map +0 -1
  510. package/dist/types/vendor/readable-stream.d.mjs +0 -1
  511. package/dist/types/vendor/readable-stream.d.mjs.map +0 -1
  512. package/dist/types/webview/index.d.ts +0 -1
  513. package/dist/types/webworker/executor/index.d.ts +0 -1
  514. package/dist/types/webworker/pool/index.d.ts +0 -1
  515. package/dist/webview/WebViewExecutorStream.js +0 -8
  516. package/dist/webview/WebViewExecutorStream.js.map +0 -1
  517. package/dist/webview/index.js +0 -26
  518. package/dist/webview/index.js.map +0 -1
  519. package/dist/webworker/executor/WebWorkerSnapExecutor.js +0 -27
  520. package/dist/webworker/executor/WebWorkerSnapExecutor.js.map +0 -1
  521. package/dist/webworker/executor/index.js +0 -35
  522. package/dist/webworker/executor/index.js.map +0 -1
  523. package/dist/webworker/pool/WebWorkerPool.js +0 -8
  524. package/dist/webworker/pool/WebWorkerPool.js.map +0 -1
  525. package/dist/webworker/pool/index.js +0 -16
  526. package/dist/webworker/pool/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"globalObject.mjs","sourceRoot":"","sources":["../../src/common/globalObject.ts"],"names":[],"mappings":"AAAA,IAAK,iBAUJ;AAVD,WAAK,iBAAiB;IACpB,yEAAyE;IACzE,cAAc;IACd,yDAAyD;IACzD,wDAAwD;IACxD,8CAAyB,CAAA;IACzB,sCAAiB,CAAA;IACjB,kCAAa,CAAA;IACb,sCAAiB,CAAA;IACjB,wDAAwD;AAC1D,CAAC,EAVI,iBAAiB,KAAjB,iBAAiB,QAUrB;AAED,IAAI,gBAAmC,CAAC;AACxC,IAAI,oBAA4B,CAAC;AAEjC,0BAA0B;AAC1B,yCAAyC;AACzC,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE,CAAC;IACtC,gBAAgB,GAAG,UAAU,CAAC;IAC9B,oBAAoB,GAAG,iBAAiB,CAAC,UAAU,CAAC;AACtD,CAAC;KAAM,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;IACvC,gBAAgB,GAAG,IAAI,CAAC;IACxB,oBAAoB,GAAG,iBAAiB,CAAC,IAAI,CAAC;AAChD,CAAC;KAAM,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACzC,gBAAgB,GAAG,MAAM,CAAC;IAC1B,oBAAoB,GAAG,iBAAiB,CAAC,MAAM,CAAC;AAClD,CAAC;KAAM,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACzC,gBAAgB,GAAG,MAAM,CAAC;IAC1B,oBAAoB,GAAG,iBAAiB,CAAC,MAAM,CAAC;AAClD,CAAC;KAAM,CAAC;IACN,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AAC3E,CAAC;AACD,wCAAwC;AAExC;;GAEG;AACH,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAEzC;;GAEG;AACH,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["enum GlobalObjectNames {\n // The globalThis entry is incorrectly identified as shadowing the global\n // globalThis.\n /* eslint-disable @typescript-eslint/naming-convention */\n // eslint-disable-next-line @typescript-eslint/no-shadow\n globalThis = 'globalThis',\n global = 'global',\n self = 'self',\n window = 'window',\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n\nlet _rootRealmGlobal: typeof globalThis;\nlet _rootRealmGlobalName: string;\n\n/* istanbul ignore next */\n/* eslint-disable no-negated-condition */\nif (typeof globalThis !== 'undefined') {\n _rootRealmGlobal = globalThis;\n _rootRealmGlobalName = GlobalObjectNames.globalThis;\n} else if (typeof self !== 'undefined') {\n _rootRealmGlobal = self;\n _rootRealmGlobalName = GlobalObjectNames.self;\n} else if (typeof window !== 'undefined') {\n _rootRealmGlobal = window;\n _rootRealmGlobalName = GlobalObjectNames.window;\n} else if (typeof global !== 'undefined') {\n _rootRealmGlobal = global;\n _rootRealmGlobalName = GlobalObjectNames.global;\n} else {\n throw new Error('Unknown realm type; failed to identify global object.');\n}\n/* eslint-enable no-negated-condition */\n\n/**\n * A platform-agnostic alias for the root realm global object.\n */\nconst rootRealmGlobal = _rootRealmGlobal;\n\n/**\n * The string literal corresponding to the name of the root realm global object.\n */\nconst rootRealmGlobalName = _rootRealmGlobalName;\n\nexport { rootRealmGlobal, rootRealmGlobalName };\n"]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeLockdownEvents = void 0;
4
+ // When creating a sandbox, limitation of the events from leaking
5
+ // sensitive objects is required. This is done by overriding own properties
6
+ // of prototypes of all existing events.
7
+ const utils_1 = require("@metamask/utils");
8
+ /**
9
+ * Targeted Event objects and properties.
10
+ * Note: This is a map of the prototypes that inherit from Events with
11
+ * properties that are identified to leak sensitive objects.
12
+ * Not all browsers support all event types, so checking its existence is required.
13
+ */
14
+ const targetEvents = new Map();
15
+ if ((0, utils_1.hasProperty)(globalThis, 'UIEvent')) {
16
+ targetEvents.set(UIEvent.prototype, ['view']);
17
+ }
18
+ if ((0, utils_1.hasProperty)(globalThis, 'MutationEvent')) {
19
+ targetEvents.set(MutationEvent.prototype, ['relatedNode']);
20
+ }
21
+ if ((0, utils_1.hasProperty)(globalThis, 'MessageEvent')) {
22
+ targetEvents.set(MessageEvent.prototype, ['source']);
23
+ }
24
+ if ((0, utils_1.hasProperty)(globalThis, 'FocusEvent')) {
25
+ targetEvents.set(FocusEvent.prototype, ['relatedTarget']);
26
+ }
27
+ if ((0, utils_1.hasProperty)(globalThis, 'MouseEvent')) {
28
+ targetEvents.set(MouseEvent.prototype, [
29
+ 'relatedTarget',
30
+ 'fromElement',
31
+ 'toElement',
32
+ ]);
33
+ }
34
+ if ((0, utils_1.hasProperty)(globalThis, 'TouchEvent')) {
35
+ targetEvents.set(TouchEvent.prototype, ['targetTouches', 'touches']);
36
+ }
37
+ if ((0, utils_1.hasProperty)(globalThis, 'Event')) {
38
+ targetEvents.set(Event.prototype, [
39
+ 'target',
40
+ 'currentTarget',
41
+ 'srcElement',
42
+ 'composedPath',
43
+ ]);
44
+ }
45
+ /**
46
+ * Attenuate Event objects by replacing its own properties.
47
+ */
48
+ function executeLockdownEvents() {
49
+ targetEvents.forEach((properties, prototype) => {
50
+ for (const property of properties) {
51
+ Object.defineProperty(prototype, property, {
52
+ value: undefined,
53
+ configurable: false,
54
+ writable: false,
55
+ });
56
+ }
57
+ });
58
+ }
59
+ exports.executeLockdownEvents = executeLockdownEvents;
60
+ //# sourceMappingURL=lockdown-events.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockdown-events.cjs","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown-events.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AACjE,2EAA2E;AAC3E,wCAAwC;AACxC,2CAA8C;AAE9C;;;;;GAKG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAC/B,IAAI,IAAA,mBAAW,EAAC,UAAU,EAAE,SAAS,CAAC,EAAE,CAAC;IACvC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AAChD,CAAC;AACD,IAAI,IAAA,mBAAW,EAAC,UAAU,EAAE,eAAe,CAAC,EAAE,CAAC;IAC7C,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;AAC7D,CAAC;AACD,IAAI,IAAA,mBAAW,EAAC,UAAU,EAAE,cAAc,CAAC,EAAE,CAAC;IAC5C,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACvD,CAAC;AACD,IAAI,IAAA,mBAAW,EAAC,UAAU,EAAE,YAAY,CAAC,EAAE,CAAC;IAC1C,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;AAC5D,CAAC;AACD,IAAI,IAAA,mBAAW,EAAC,UAAU,EAAE,YAAY,CAAC,EAAE,CAAC;IAC1C,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE;QACrC,eAAe;QACf,aAAa;QACb,WAAW;KACZ,CAAC,CAAC;AACL,CAAC;AACD,IAAI,IAAA,mBAAW,EAAC,UAAU,EAAE,YAAY,CAAC,EAAE,CAAC;IAC1C,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC;AACvE,CAAC;AACD,IAAI,IAAA,mBAAW,EAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC;IACrC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE;QAChC,QAAQ;QACR,eAAe;QACf,YAAY;QACZ,cAAc;KACf,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB;IACnC,YAAY,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE;QAC7C,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;YAClC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE;gBACzC,KAAK,EAAE,SAAS;gBAChB,YAAY,EAAE,KAAK;gBACnB,QAAQ,EAAE,KAAK;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAVD,sDAUC","sourcesContent":["// When creating a sandbox, limitation of the events from leaking\n// sensitive objects is required. This is done by overriding own properties\n// of prototypes of all existing events.\nimport { hasProperty } from '@metamask/utils';\n\n/**\n * Targeted Event objects and properties.\n * Note: This is a map of the prototypes that inherit from Events with\n * properties that are identified to leak sensitive objects.\n * Not all browsers support all event types, so checking its existence is required.\n */\nconst targetEvents = new Map();\nif (hasProperty(globalThis, 'UIEvent')) {\n targetEvents.set(UIEvent.prototype, ['view']);\n}\nif (hasProperty(globalThis, 'MutationEvent')) {\n targetEvents.set(MutationEvent.prototype, ['relatedNode']);\n}\nif (hasProperty(globalThis, 'MessageEvent')) {\n targetEvents.set(MessageEvent.prototype, ['source']);\n}\nif (hasProperty(globalThis, 'FocusEvent')) {\n targetEvents.set(FocusEvent.prototype, ['relatedTarget']);\n}\nif (hasProperty(globalThis, 'MouseEvent')) {\n targetEvents.set(MouseEvent.prototype, [\n 'relatedTarget',\n 'fromElement',\n 'toElement',\n ]);\n}\nif (hasProperty(globalThis, 'TouchEvent')) {\n targetEvents.set(TouchEvent.prototype, ['targetTouches', 'touches']);\n}\nif (hasProperty(globalThis, 'Event')) {\n targetEvents.set(Event.prototype, [\n 'target',\n 'currentTarget',\n 'srcElement',\n 'composedPath',\n ]);\n}\n\n/**\n * Attenuate Event objects by replacing its own properties.\n */\nexport function executeLockdownEvents() {\n targetEvents.forEach((properties, prototype) => {\n for (const property of properties) {\n Object.defineProperty(prototype, property, {\n value: undefined,\n configurable: false,\n writable: false,\n });\n }\n });\n}\n"]}
@@ -2,3 +2,4 @@
2
2
  * Attenuate Event objects by replacing its own properties.
3
3
  */
4
4
  export declare function executeLockdownEvents(): void;
5
+ //# sourceMappingURL=lockdown-events.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockdown-events.d.cts","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown-events.ts"],"names":[],"mappings":"AA2CA;;GAEG;AACH,wBAAgB,qBAAqB,SAUpC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Attenuate Event objects by replacing its own properties.
3
+ */
4
+ export declare function executeLockdownEvents(): void;
5
+ //# sourceMappingURL=lockdown-events.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockdown-events.d.mts","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown-events.ts"],"names":[],"mappings":"AA2CA;;GAEG;AACH,wBAAgB,qBAAqB,SAUpC"}
@@ -1,8 +1,56 @@
1
- import {
2
- executeLockdownEvents
3
- } from "../../chunk-S7257EN3.mjs";
4
- import "../../chunk-YRZVIDCF.mjs";
5
- export {
6
- executeLockdownEvents
7
- };
1
+ // When creating a sandbox, limitation of the events from leaking
2
+ // sensitive objects is required. This is done by overriding own properties
3
+ // of prototypes of all existing events.
4
+ import { hasProperty } from "@metamask/utils";
5
+ /**
6
+ * Targeted Event objects and properties.
7
+ * Note: This is a map of the prototypes that inherit from Events with
8
+ * properties that are identified to leak sensitive objects.
9
+ * Not all browsers support all event types, so checking its existence is required.
10
+ */
11
+ const targetEvents = new Map();
12
+ if (hasProperty(globalThis, 'UIEvent')) {
13
+ targetEvents.set(UIEvent.prototype, ['view']);
14
+ }
15
+ if (hasProperty(globalThis, 'MutationEvent')) {
16
+ targetEvents.set(MutationEvent.prototype, ['relatedNode']);
17
+ }
18
+ if (hasProperty(globalThis, 'MessageEvent')) {
19
+ targetEvents.set(MessageEvent.prototype, ['source']);
20
+ }
21
+ if (hasProperty(globalThis, 'FocusEvent')) {
22
+ targetEvents.set(FocusEvent.prototype, ['relatedTarget']);
23
+ }
24
+ if (hasProperty(globalThis, 'MouseEvent')) {
25
+ targetEvents.set(MouseEvent.prototype, [
26
+ 'relatedTarget',
27
+ 'fromElement',
28
+ 'toElement',
29
+ ]);
30
+ }
31
+ if (hasProperty(globalThis, 'TouchEvent')) {
32
+ targetEvents.set(TouchEvent.prototype, ['targetTouches', 'touches']);
33
+ }
34
+ if (hasProperty(globalThis, 'Event')) {
35
+ targetEvents.set(Event.prototype, [
36
+ 'target',
37
+ 'currentTarget',
38
+ 'srcElement',
39
+ 'composedPath',
40
+ ]);
41
+ }
42
+ /**
43
+ * Attenuate Event objects by replacing its own properties.
44
+ */
45
+ export function executeLockdownEvents() {
46
+ targetEvents.forEach((properties, prototype) => {
47
+ for (const property of properties) {
48
+ Object.defineProperty(prototype, property, {
49
+ value: undefined,
50
+ configurable: false,
51
+ writable: false,
52
+ });
53
+ }
54
+ });
55
+ }
8
56
  //# sourceMappingURL=lockdown-events.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"lockdown-events.mjs","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown-events.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,2EAA2E;AAC3E,wCAAwC;AACxC,OAAO,EAAE,WAAW,EAAE,wBAAwB;AAE9C;;;;;GAKG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAC/B,IAAI,WAAW,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,CAAC;IACvC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AAChD,CAAC;AACD,IAAI,WAAW,CAAC,UAAU,EAAE,eAAe,CAAC,EAAE,CAAC;IAC7C,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;AAC7D,CAAC;AACD,IAAI,WAAW,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,CAAC;IAC5C,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACvD,CAAC;AACD,IAAI,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,CAAC;IAC1C,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;AAC5D,CAAC;AACD,IAAI,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,CAAC;IAC1C,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE;QACrC,eAAe;QACf,aAAa;QACb,WAAW;KACZ,CAAC,CAAC;AACL,CAAC;AACD,IAAI,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,CAAC;IAC1C,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC;AACvE,CAAC;AACD,IAAI,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC;IACrC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE;QAChC,QAAQ;QACR,eAAe;QACf,YAAY;QACZ,cAAc;KACf,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,YAAY,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE;QAC7C,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;YAClC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE;gBACzC,KAAK,EAAE,SAAS;gBAChB,YAAY,EAAE,KAAK;gBACnB,QAAQ,EAAE,KAAK;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// When creating a sandbox, limitation of the events from leaking\n// sensitive objects is required. This is done by overriding own properties\n// of prototypes of all existing events.\nimport { hasProperty } from '@metamask/utils';\n\n/**\n * Targeted Event objects and properties.\n * Note: This is a map of the prototypes that inherit from Events with\n * properties that are identified to leak sensitive objects.\n * Not all browsers support all event types, so checking its existence is required.\n */\nconst targetEvents = new Map();\nif (hasProperty(globalThis, 'UIEvent')) {\n targetEvents.set(UIEvent.prototype, ['view']);\n}\nif (hasProperty(globalThis, 'MutationEvent')) {\n targetEvents.set(MutationEvent.prototype, ['relatedNode']);\n}\nif (hasProperty(globalThis, 'MessageEvent')) {\n targetEvents.set(MessageEvent.prototype, ['source']);\n}\nif (hasProperty(globalThis, 'FocusEvent')) {\n targetEvents.set(FocusEvent.prototype, ['relatedTarget']);\n}\nif (hasProperty(globalThis, 'MouseEvent')) {\n targetEvents.set(MouseEvent.prototype, [\n 'relatedTarget',\n 'fromElement',\n 'toElement',\n ]);\n}\nif (hasProperty(globalThis, 'TouchEvent')) {\n targetEvents.set(TouchEvent.prototype, ['targetTouches', 'touches']);\n}\nif (hasProperty(globalThis, 'Event')) {\n targetEvents.set(Event.prototype, [\n 'target',\n 'currentTarget',\n 'srcElement',\n 'composedPath',\n ]);\n}\n\n/**\n * Attenuate Event objects by replacing its own properties.\n */\nexport function executeLockdownEvents() {\n targetEvents.forEach((properties, prototype) => {\n for (const property of properties) {\n Object.defineProperty(prototype, property, {\n value: undefined,\n configurable: false,\n writable: false,\n });\n }\n });\n}\n"]}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
3
+ /// <reference path="../../../../../node_modules/ses/types.d.ts" />
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.executeLockdownMore = void 0;
6
+ const snaps_utils_1 = require("@metamask/snaps-utils");
7
+ /**
8
+ * The SES `lockdown` function only hardens the properties enumerated by the
9
+ * universalPropertyNames constant specified in 'ses/src/whitelist'. This
10
+ * function makes all function and object properties on the start compartment
11
+ * global non-configurable and non-writable, unless they are already
12
+ * non-configurable.
13
+ *
14
+ * It is critical that this function runs at the right time during
15
+ * initialization, which should always be immediately after `lockdown` has been
16
+ * called. At the time of writing, the modifications this function makes to the
17
+ * runtime environment appear to be non-breaking, but that could change with
18
+ * the addition of dependencies, or the order of our scripts in our HTML files.
19
+ * Exercise caution.
20
+ *
21
+ * See inline comments for implementation details.
22
+ *
23
+ * We write this function in IIFE format to avoid polluting global scope.
24
+ *
25
+ * @throws If the lockdown failed.
26
+ */
27
+ function executeLockdownMore() {
28
+ // Make all "object" and "function" own properties of globalThis
29
+ // non-configurable and non-writable, when possible.
30
+ // We call a property that is non-configurable and non-writable,
31
+ // "non-modifiable".
32
+ try {
33
+ const namedIntrinsics = Reflect.ownKeys(new Compartment().globalThis);
34
+ // These named intrinsics are not automatically hardened by `lockdown`
35
+ const shouldHardenManually = new Set(['eval', 'Function']);
36
+ const globalProperties = new Set([
37
+ // universalPropertyNames is a constant added by lockdown to global scope
38
+ // at the time of writing, it is initialized in 'ses/src/whitelist'.
39
+ // These properties tend to be non-enumerable.
40
+ ...namedIntrinsics,
41
+ // TODO: Also include the named platform globals
42
+ // This grabs every enumerable property on globalThis.
43
+ // ...Object.keys(globalThis),
44
+ ]);
45
+ globalProperties.forEach((propertyName) => {
46
+ const descriptor = Reflect.getOwnPropertyDescriptor(globalThis, propertyName);
47
+ if (descriptor) {
48
+ if (descriptor.configurable) {
49
+ // If the property on globalThis is configurable, make it
50
+ // non-configurable. If it has no accessor properties, also make it
51
+ // non-writable.
52
+ if (hasAccessor(descriptor)) {
53
+ Object.defineProperty(globalThis, propertyName, {
54
+ configurable: false,
55
+ });
56
+ }
57
+ else {
58
+ Object.defineProperty(globalThis, propertyName, {
59
+ configurable: false,
60
+ writable: false,
61
+ });
62
+ }
63
+ }
64
+ if (shouldHardenManually.has(propertyName)) {
65
+ harden(globalThis[propertyName]);
66
+ }
67
+ }
68
+ });
69
+ }
70
+ catch (error) {
71
+ (0, snaps_utils_1.logError)('Protecting intrinsics failed:', error);
72
+ throw error;
73
+ }
74
+ }
75
+ exports.executeLockdownMore = executeLockdownMore;
76
+ /**
77
+ * Checks whether the given propertyName descriptor has any accessors, i.e. the
78
+ * properties `get` or `set`.
79
+ *
80
+ * We want to make globals non-writable, and we can't set the `writable`
81
+ * property and accessor properties at the same time.
82
+ *
83
+ * @param descriptor - The propertyName descriptor to check.
84
+ * @returns Whether the propertyName descriptor has any accessors.
85
+ */
86
+ function hasAccessor(descriptor) {
87
+ return 'set' in descriptor || 'get' in descriptor;
88
+ }
89
+ //# sourceMappingURL=lockdown-more.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockdown-more.cjs","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown-more.ts"],"names":[],"mappings":";AAAA,qFAAqF;AACrF,mEAAmE;;;AAEnE,uDAAiD;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,mBAAmB;IACjC,gEAAgE;IAChE,oDAAoD;IACpD,gEAAgE;IAChE,oBAAoB;IACpB,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,WAAW,EAAE,CAAC,UAAU,CAAC,CAAC;QAEtE,sEAAsE;QACtE,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;QAE5E,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;YAC/B,yEAAyE;YACzE,oEAAoE;YACpE,8CAA8C;YAC9C,GAAG,eAAe;YAElB,gDAAgD;YAChD,sDAAsD;YACtD,8BAA8B;SAC/B,CAAC,CAAC;QAEH,gBAAgB,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;YACxC,MAAM,UAAU,GAAG,OAAO,CAAC,wBAAwB,CACjD,UAAU,EACV,YAAY,CACb,CAAC;YAEF,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;oBAC5B,yDAAyD;oBACzD,mEAAmE;oBACnE,gBAAgB;oBAChB,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;wBAC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,YAAY,EAAE;4BAC9C,YAAY,EAAE,KAAK;yBACpB,CAAC,CAAC;oBACL,CAAC;yBAAM,CAAC;wBACN,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,YAAY,EAAE;4BAC9C,YAAY,EAAE,KAAK;4BACnB,QAAQ,EAAE,KAAK;yBAChB,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAED,IAAI,oBAAoB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;oBAC3C,MAAM,CAAE,UAAkB,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAA,sBAAQ,EAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAtDD,kDAsDC;AAED;;;;;;;;;GASG;AACH,SAAS,WAAW,CAAC,UAAe;IAClC,OAAO,KAAK,IAAI,UAAU,IAAI,KAAK,IAAI,UAAU,CAAC;AACpD,CAAC","sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment\n/// <reference path=\"../../../../../node_modules/ses/types.d.ts\" />\n\nimport { logError } from '@metamask/snaps-utils';\n\n/**\n * The SES `lockdown` function only hardens the properties enumerated by the\n * universalPropertyNames constant specified in 'ses/src/whitelist'. This\n * function makes all function and object properties on the start compartment\n * global non-configurable and non-writable, unless they are already\n * non-configurable.\n *\n * It is critical that this function runs at the right time during\n * initialization, which should always be immediately after `lockdown` has been\n * called. At the time of writing, the modifications this function makes to the\n * runtime environment appear to be non-breaking, but that could change with\n * the addition of dependencies, or the order of our scripts in our HTML files.\n * Exercise caution.\n *\n * See inline comments for implementation details.\n *\n * We write this function in IIFE format to avoid polluting global scope.\n *\n * @throws If the lockdown failed.\n */\nexport function executeLockdownMore() {\n // Make all \"object\" and \"function\" own properties of globalThis\n // non-configurable and non-writable, when possible.\n // We call a property that is non-configurable and non-writable,\n // \"non-modifiable\".\n try {\n const namedIntrinsics = Reflect.ownKeys(new Compartment().globalThis);\n\n // These named intrinsics are not automatically hardened by `lockdown`\n const shouldHardenManually = new Set<symbol | string>(['eval', 'Function']);\n\n const globalProperties = new Set([\n // universalPropertyNames is a constant added by lockdown to global scope\n // at the time of writing, it is initialized in 'ses/src/whitelist'.\n // These properties tend to be non-enumerable.\n ...namedIntrinsics,\n\n // TODO: Also include the named platform globals\n // This grabs every enumerable property on globalThis.\n // ...Object.keys(globalThis),\n ]);\n\n globalProperties.forEach((propertyName) => {\n const descriptor = Reflect.getOwnPropertyDescriptor(\n globalThis,\n propertyName,\n );\n\n if (descriptor) {\n if (descriptor.configurable) {\n // If the property on globalThis is configurable, make it\n // non-configurable. If it has no accessor properties, also make it\n // non-writable.\n if (hasAccessor(descriptor)) {\n Object.defineProperty(globalThis, propertyName, {\n configurable: false,\n });\n } else {\n Object.defineProperty(globalThis, propertyName, {\n configurable: false,\n writable: false,\n });\n }\n }\n\n if (shouldHardenManually.has(propertyName)) {\n harden((globalThis as any)[propertyName]);\n }\n }\n });\n } catch (error) {\n logError('Protecting intrinsics failed:', error);\n throw error;\n }\n}\n\n/**\n * Checks whether the given propertyName descriptor has any accessors, i.e. the\n * properties `get` or `set`.\n *\n * We want to make globals non-writable, and we can't set the `writable`\n * property and accessor properties at the same time.\n *\n * @param descriptor - The propertyName descriptor to check.\n * @returns Whether the propertyName descriptor has any accessors.\n */\nfunction hasAccessor(descriptor: any): boolean {\n return 'set' in descriptor || 'get' in descriptor;\n}\n"]}
@@ -20,3 +20,4 @@
20
20
  * @throws If the lockdown failed.
21
21
  */
22
22
  export declare function executeLockdownMore(): void;
23
+ //# sourceMappingURL=lockdown-more.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockdown-more.d.cts","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown-more.ts"],"names":[],"mappings":";AAKA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,SAsDlC"}
@@ -0,0 +1,23 @@
1
+ /// <reference types="ses" />
2
+ /**
3
+ * The SES `lockdown` function only hardens the properties enumerated by the
4
+ * universalPropertyNames constant specified in 'ses/src/whitelist'. This
5
+ * function makes all function and object properties on the start compartment
6
+ * global non-configurable and non-writable, unless they are already
7
+ * non-configurable.
8
+ *
9
+ * It is critical that this function runs at the right time during
10
+ * initialization, which should always be immediately after `lockdown` has been
11
+ * called. At the time of writing, the modifications this function makes to the
12
+ * runtime environment appear to be non-breaking, but that could change with
13
+ * the addition of dependencies, or the order of our scripts in our HTML files.
14
+ * Exercise caution.
15
+ *
16
+ * See inline comments for implementation details.
17
+ *
18
+ * We write this function in IIFE format to avoid polluting global scope.
19
+ *
20
+ * @throws If the lockdown failed.
21
+ */
22
+ export declare function executeLockdownMore(): void;
23
+ //# sourceMappingURL=lockdown-more.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockdown-more.d.mts","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown-more.ts"],"names":[],"mappings":";AAKA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,SAsDlC"}
@@ -1,8 +1,85 @@
1
- import {
2
- executeLockdownMore
3
- } from "../../chunk-MXNMMTJW.mjs";
4
- import "../../chunk-YRZVIDCF.mjs";
5
- export {
6
- executeLockdownMore
7
- };
1
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
2
+ /// <reference path="../../../../../node_modules/ses/types.d.ts" />
3
+ import { logError } from "@metamask/snaps-utils";
4
+ /**
5
+ * The SES `lockdown` function only hardens the properties enumerated by the
6
+ * universalPropertyNames constant specified in 'ses/src/whitelist'. This
7
+ * function makes all function and object properties on the start compartment
8
+ * global non-configurable and non-writable, unless they are already
9
+ * non-configurable.
10
+ *
11
+ * It is critical that this function runs at the right time during
12
+ * initialization, which should always be immediately after `lockdown` has been
13
+ * called. At the time of writing, the modifications this function makes to the
14
+ * runtime environment appear to be non-breaking, but that could change with
15
+ * the addition of dependencies, or the order of our scripts in our HTML files.
16
+ * Exercise caution.
17
+ *
18
+ * See inline comments for implementation details.
19
+ *
20
+ * We write this function in IIFE format to avoid polluting global scope.
21
+ *
22
+ * @throws If the lockdown failed.
23
+ */
24
+ export function executeLockdownMore() {
25
+ // Make all "object" and "function" own properties of globalThis
26
+ // non-configurable and non-writable, when possible.
27
+ // We call a property that is non-configurable and non-writable,
28
+ // "non-modifiable".
29
+ try {
30
+ const namedIntrinsics = Reflect.ownKeys(new Compartment().globalThis);
31
+ // These named intrinsics are not automatically hardened by `lockdown`
32
+ const shouldHardenManually = new Set(['eval', 'Function']);
33
+ const globalProperties = new Set([
34
+ // universalPropertyNames is a constant added by lockdown to global scope
35
+ // at the time of writing, it is initialized in 'ses/src/whitelist'.
36
+ // These properties tend to be non-enumerable.
37
+ ...namedIntrinsics,
38
+ // TODO: Also include the named platform globals
39
+ // This grabs every enumerable property on globalThis.
40
+ // ...Object.keys(globalThis),
41
+ ]);
42
+ globalProperties.forEach((propertyName) => {
43
+ const descriptor = Reflect.getOwnPropertyDescriptor(globalThis, propertyName);
44
+ if (descriptor) {
45
+ if (descriptor.configurable) {
46
+ // If the property on globalThis is configurable, make it
47
+ // non-configurable. If it has no accessor properties, also make it
48
+ // non-writable.
49
+ if (hasAccessor(descriptor)) {
50
+ Object.defineProperty(globalThis, propertyName, {
51
+ configurable: false,
52
+ });
53
+ }
54
+ else {
55
+ Object.defineProperty(globalThis, propertyName, {
56
+ configurable: false,
57
+ writable: false,
58
+ });
59
+ }
60
+ }
61
+ if (shouldHardenManually.has(propertyName)) {
62
+ harden(globalThis[propertyName]);
63
+ }
64
+ }
65
+ });
66
+ }
67
+ catch (error) {
68
+ logError('Protecting intrinsics failed:', error);
69
+ throw error;
70
+ }
71
+ }
72
+ /**
73
+ * Checks whether the given propertyName descriptor has any accessors, i.e. the
74
+ * properties `get` or `set`.
75
+ *
76
+ * We want to make globals non-writable, and we can't set the `writable`
77
+ * property and accessor properties at the same time.
78
+ *
79
+ * @param descriptor - The propertyName descriptor to check.
80
+ * @returns Whether the propertyName descriptor has any accessors.
81
+ */
82
+ function hasAccessor(descriptor) {
83
+ return 'set' in descriptor || 'get' in descriptor;
84
+ }
8
85
  //# sourceMappingURL=lockdown-more.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"lockdown-more.mjs","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown-more.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,mEAAmE;AAEnE,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,mBAAmB;IACjC,gEAAgE;IAChE,oDAAoD;IACpD,gEAAgE;IAChE,oBAAoB;IACpB,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,WAAW,EAAE,CAAC,UAAU,CAAC,CAAC;QAEtE,sEAAsE;QACtE,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;QAE5E,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;YAC/B,yEAAyE;YACzE,oEAAoE;YACpE,8CAA8C;YAC9C,GAAG,eAAe;YAElB,gDAAgD;YAChD,sDAAsD;YACtD,8BAA8B;SAC/B,CAAC,CAAC;QAEH,gBAAgB,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;YACxC,MAAM,UAAU,GAAG,OAAO,CAAC,wBAAwB,CACjD,UAAU,EACV,YAAY,CACb,CAAC;YAEF,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;oBAC5B,yDAAyD;oBACzD,mEAAmE;oBACnE,gBAAgB;oBAChB,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;wBAC5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,YAAY,EAAE;4BAC9C,YAAY,EAAE,KAAK;yBACpB,CAAC,CAAC;oBACL,CAAC;yBAAM,CAAC;wBACN,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,YAAY,EAAE;4BAC9C,YAAY,EAAE,KAAK;4BACnB,QAAQ,EAAE,KAAK;yBAChB,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAED,IAAI,oBAAoB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;oBAC3C,MAAM,CAAE,UAAkB,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,WAAW,CAAC,UAAe;IAClC,OAAO,KAAK,IAAI,UAAU,IAAI,KAAK,IAAI,UAAU,CAAC;AACpD,CAAC","sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment\n/// <reference path=\"../../../../../node_modules/ses/types.d.ts\" />\n\nimport { logError } from '@metamask/snaps-utils';\n\n/**\n * The SES `lockdown` function only hardens the properties enumerated by the\n * universalPropertyNames constant specified in 'ses/src/whitelist'. This\n * function makes all function and object properties on the start compartment\n * global non-configurable and non-writable, unless they are already\n * non-configurable.\n *\n * It is critical that this function runs at the right time during\n * initialization, which should always be immediately after `lockdown` has been\n * called. At the time of writing, the modifications this function makes to the\n * runtime environment appear to be non-breaking, but that could change with\n * the addition of dependencies, or the order of our scripts in our HTML files.\n * Exercise caution.\n *\n * See inline comments for implementation details.\n *\n * We write this function in IIFE format to avoid polluting global scope.\n *\n * @throws If the lockdown failed.\n */\nexport function executeLockdownMore() {\n // Make all \"object\" and \"function\" own properties of globalThis\n // non-configurable and non-writable, when possible.\n // We call a property that is non-configurable and non-writable,\n // \"non-modifiable\".\n try {\n const namedIntrinsics = Reflect.ownKeys(new Compartment().globalThis);\n\n // These named intrinsics are not automatically hardened by `lockdown`\n const shouldHardenManually = new Set<symbol | string>(['eval', 'Function']);\n\n const globalProperties = new Set([\n // universalPropertyNames is a constant added by lockdown to global scope\n // at the time of writing, it is initialized in 'ses/src/whitelist'.\n // These properties tend to be non-enumerable.\n ...namedIntrinsics,\n\n // TODO: Also include the named platform globals\n // This grabs every enumerable property on globalThis.\n // ...Object.keys(globalThis),\n ]);\n\n globalProperties.forEach((propertyName) => {\n const descriptor = Reflect.getOwnPropertyDescriptor(\n globalThis,\n propertyName,\n );\n\n if (descriptor) {\n if (descriptor.configurable) {\n // If the property on globalThis is configurable, make it\n // non-configurable. If it has no accessor properties, also make it\n // non-writable.\n if (hasAccessor(descriptor)) {\n Object.defineProperty(globalThis, propertyName, {\n configurable: false,\n });\n } else {\n Object.defineProperty(globalThis, propertyName, {\n configurable: false,\n writable: false,\n });\n }\n }\n\n if (shouldHardenManually.has(propertyName)) {\n harden((globalThis as any)[propertyName]);\n }\n }\n });\n } catch (error) {\n logError('Protecting intrinsics failed:', error);\n throw error;\n }\n}\n\n/**\n * Checks whether the given propertyName descriptor has any accessors, i.e. the\n * properties `get` or `set`.\n *\n * We want to make globals non-writable, and we can't set the `writable`\n * property and accessor properties at the same time.\n *\n * @param descriptor - The propertyName descriptor to check.\n * @returns Whether the propertyName descriptor has any accessors.\n */\nfunction hasAccessor(descriptor: any): boolean {\n return 'set' in descriptor || 'get' in descriptor;\n}\n"]}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
3
+ /// <reference path="../../../../../node_modules/ses/types.d.ts" />
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.executeLockdown = void 0;
6
+ const snaps_utils_1 = require("@metamask/snaps-utils");
7
+ /**
8
+ * Execute SES lockdown in the current context, i.e., the current iframe.
9
+ *
10
+ * @throws If the SES lockdown failed.
11
+ */
12
+ function executeLockdown() {
13
+ try {
14
+ lockdown({
15
+ consoleTaming: 'unsafe',
16
+ errorTaming: 'unsafe',
17
+ mathTaming: 'unsafe',
18
+ dateTaming: 'unsafe',
19
+ overrideTaming: 'severe',
20
+ });
21
+ }
22
+ catch (error) {
23
+ // If the `lockdown` call throws an exception, it should not be able to continue
24
+ (0, snaps_utils_1.logError)('Lockdown failed:', error);
25
+ throw error;
26
+ }
27
+ }
28
+ exports.executeLockdown = executeLockdown;
29
+ //# sourceMappingURL=lockdown.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockdown.cjs","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown.ts"],"names":[],"mappings":";AAAA,qFAAqF;AACrF,mEAAmE;;;AAEnE,uDAAiD;AAEjD;;;;GAIG;AACH,SAAgB,eAAe;IAC7B,IAAI,CAAC;QACH,QAAQ,CAAC;YACP,aAAa,EAAE,QAAQ;YACvB,WAAW,EAAE,QAAQ;YACrB,UAAU,EAAE,QAAQ;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;SACzB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gFAAgF;QAChF,IAAA,sBAAQ,EAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QACpC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAdD,0CAcC","sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment\n/// <reference path=\"../../../../../node_modules/ses/types.d.ts\" />\n\nimport { logError } from '@metamask/snaps-utils';\n\n/**\n * Execute SES lockdown in the current context, i.e., the current iframe.\n *\n * @throws If the SES lockdown failed.\n */\nexport function executeLockdown() {\n try {\n lockdown({\n consoleTaming: 'unsafe',\n errorTaming: 'unsafe',\n mathTaming: 'unsafe',\n dateTaming: 'unsafe',\n overrideTaming: 'severe',\n });\n } catch (error) {\n // If the `lockdown` call throws an exception, it should not be able to continue\n logError('Lockdown failed:', error);\n throw error;\n }\n}\n"]}
@@ -5,3 +5,4 @@
5
5
  * @throws If the SES lockdown failed.
6
6
  */
7
7
  export declare function executeLockdown(): void;
8
+ //# sourceMappingURL=lockdown.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockdown.d.cts","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown.ts"],"names":[],"mappings":";AAKA;;;;GAIG;AACH,wBAAgB,eAAe,SAc9B"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="ses" />
2
+ /**
3
+ * Execute SES lockdown in the current context, i.e., the current iframe.
4
+ *
5
+ * @throws If the SES lockdown failed.
6
+ */
7
+ export declare function executeLockdown(): void;
8
+ //# sourceMappingURL=lockdown.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockdown.d.mts","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown.ts"],"names":[],"mappings":";AAKA;;;;GAIG;AACH,wBAAgB,eAAe,SAc9B"}
@@ -1,22 +1,25 @@
1
- import "../../chunk-YRZVIDCF.mjs";
2
-
3
- // src/common/lockdown/lockdown.ts
1
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment
2
+ /// <reference path="../../../../../node_modules/ses/types.d.ts" />
4
3
  import { logError } from "@metamask/snaps-utils";
5
- function executeLockdown() {
6
- try {
7
- lockdown({
8
- consoleTaming: "unsafe",
9
- errorTaming: "unsafe",
10
- mathTaming: "unsafe",
11
- dateTaming: "unsafe",
12
- overrideTaming: "severe"
13
- });
14
- } catch (error) {
15
- logError("Lockdown failed:", error);
16
- throw error;
17
- }
4
+ /**
5
+ * Execute SES lockdown in the current context, i.e., the current iframe.
6
+ *
7
+ * @throws If the SES lockdown failed.
8
+ */
9
+ export function executeLockdown() {
10
+ try {
11
+ lockdown({
12
+ consoleTaming: 'unsafe',
13
+ errorTaming: 'unsafe',
14
+ mathTaming: 'unsafe',
15
+ dateTaming: 'unsafe',
16
+ overrideTaming: 'severe',
17
+ });
18
+ }
19
+ catch (error) {
20
+ // If the `lockdown` call throws an exception, it should not be able to continue
21
+ logError('Lockdown failed:', error);
22
+ throw error;
23
+ }
18
24
  }
19
- export {
20
- executeLockdown
21
- };
22
25
  //# sourceMappingURL=lockdown.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/common/lockdown/lockdown.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment\n/// <reference path=\"../../../../../node_modules/ses/types.d.ts\" />\n\nimport { logError } from '@metamask/snaps-utils';\n\n/**\n * Execute SES lockdown in the current context, i.e., the current iframe.\n *\n * @throws If the SES lockdown failed.\n */\nexport function executeLockdown() {\n try {\n lockdown({\n consoleTaming: 'unsafe',\n errorTaming: 'unsafe',\n mathTaming: 'unsafe',\n dateTaming: 'unsafe',\n overrideTaming: 'severe',\n });\n } catch (error) {\n // If the `lockdown` call throws an exception, it should not be able to continue\n logError('Lockdown failed:', error);\n throw error;\n }\n}\n"],"mappings":";;;AAGA,SAAS,gBAAgB;AAOlB,SAAS,kBAAkB;AAChC,MAAI;AACF,aAAS;AAAA,MACP,eAAe;AAAA,MACf,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,gBAAgB;AAAA,IAClB,CAAC;AAAA,EACH,SAAS,OAAO;AAEd,aAAS,oBAAoB,KAAK;AAClC,UAAM;AAAA,EACR;AACF;","names":[]}
1
+ {"version":3,"file":"lockdown.mjs","sourceRoot":"","sources":["../../../src/common/lockdown/lockdown.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,mEAAmE;AAEnE,OAAO,EAAE,QAAQ,EAAE,8BAA8B;AAEjD;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC;QACH,QAAQ,CAAC;YACP,aAAa,EAAE,QAAQ;YACvB,WAAW,EAAE,QAAQ;YACrB,UAAU,EAAE,QAAQ;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;SACzB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gFAAgF;QAChF,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QACpC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference, spaced-comment\n/// <reference path=\"../../../../../node_modules/ses/types.d.ts\" />\n\nimport { logError } from '@metamask/snaps-utils';\n\n/**\n * Execute SES lockdown in the current context, i.e., the current iframe.\n *\n * @throws If the SES lockdown failed.\n */\nexport function executeLockdown() {\n try {\n lockdown({\n consoleTaming: 'unsafe',\n errorTaming: 'unsafe',\n mathTaming: 'unsafe',\n dateTaming: 'unsafe',\n overrideTaming: 'severe',\n });\n } catch (error) {\n // If the `lockdown` call throws an exception, it should not be able to continue\n logError('Lockdown failed:', error);\n throw error;\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ // original source sortParamKeys from: https://github.com/etclabscore/sig.tools/blob/master/src/postMessageServer/postMessageServer.ts#L75-L77
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.sortParamKeys = void 0;
5
+ /**
6
+ * Deterministically sort JSON-RPC parameter keys. This makes it possible to
7
+ * support both arrays and objects as parameters. Objects are sorted and turned
8
+ * into arrays, for easier consumption by the snap.
9
+ *
10
+ * The order is defined by the `method` parameter.
11
+ *
12
+ * @param methodParams - The parameters of the JSON-RPC method, which
13
+ * determines the ordering for the parameters.
14
+ * @param params - JSON-RPC parameters as object or array.
15
+ * @returns The values for the sorted keys. If `params` is not provided, this
16
+ * returns an empty array. If `params` is an array, this returns the same
17
+ * `params`.
18
+ */
19
+ const sortParamKeys = (methodParams, params) => {
20
+ if (!params) {
21
+ return [];
22
+ }
23
+ if (params instanceof Array) {
24
+ return params;
25
+ }
26
+ const methodParamsOrder = methodParams.reduce((paramsOrderObj, paramsName, i) => ({
27
+ ...paramsOrderObj,
28
+ [paramsName]: i,
29
+ }), {});
30
+ return Object.entries(params)
31
+ .sort(([name1, _1], [name2, _2]) => methodParamsOrder[name1] - methodParamsOrder[name2])
32
+ .map(([_, val]) => val);
33
+ };
34
+ exports.sortParamKeys = sortParamKeys;
35
+ //# sourceMappingURL=sortParams.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sortParams.cjs","sourceRoot":"","sources":["../../src/common/sortParams.ts"],"names":[],"mappings":";AAAA,8IAA8I;;;AAI9I;;;;;;;;;;;;;GAaG;AACI,MAAM,aAAa,GAAG,CAC3B,YAAsB,EACtB,MAAsB,EACtB,EAAE;IACF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,MAAM,YAAY,KAAK,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,iBAAiB,GAA4B,YAAY,CAAC,MAAM,CACpE,CAAC,cAAc,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAClC,GAAG,cAAc;QACjB,CAAC,UAAU,CAAC,EAAE,CAAC;KAChB,CAAC,EACF,EAAE,CACH,CAAC;IAEF,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;SAC1B,IAAI,CACH,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAC3B,iBAAiB,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CACtD;SACA,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC;AA1BW,QAAA,aAAa,iBA0BxB","sourcesContent":["// original source sortParamKeys from: https://github.com/etclabscore/sig.tools/blob/master/src/postMessageServer/postMessageServer.ts#L75-L77\n\nimport type { JsonRpcParams } from '@metamask/utils';\n\n/**\n * Deterministically sort JSON-RPC parameter keys. This makes it possible to\n * support both arrays and objects as parameters. Objects are sorted and turned\n * into arrays, for easier consumption by the snap.\n *\n * The order is defined by the `method` parameter.\n *\n * @param methodParams - The parameters of the JSON-RPC method, which\n * determines the ordering for the parameters.\n * @param params - JSON-RPC parameters as object or array.\n * @returns The values for the sorted keys. If `params` is not provided, this\n * returns an empty array. If `params` is an array, this returns the same\n * `params`.\n */\nexport const sortParamKeys = (\n methodParams: string[],\n params?: JsonRpcParams,\n) => {\n if (!params) {\n return [];\n }\n\n if (params instanceof Array) {\n return params;\n }\n\n const methodParamsOrder: { [k: string]: number } = methodParams.reduce(\n (paramsOrderObj, paramsName, i) => ({\n ...paramsOrderObj,\n [paramsName]: i,\n }),\n {},\n );\n\n return Object.entries(params)\n .sort(\n ([name1, _1], [name2, _2]) =>\n methodParamsOrder[name1] - methodParamsOrder[name2],\n )\n .map(([_, val]) => val);\n};\n"]}
@@ -1,4 +1,4 @@
1
- import type { JsonRpcParams } from '@metamask/utils';
1
+ import type { JsonRpcParams } from "@metamask/utils";
2
2
  /**
3
3
  * Deterministically sort JSON-RPC parameter keys. This makes it possible to
4
4
  * support both arrays and objects as parameters. Objects are sorted and turned
@@ -14,3 +14,4 @@ import type { JsonRpcParams } from '@metamask/utils';
14
14
  * `params`.
15
15
  */
16
16
  export declare const sortParamKeys: (methodParams: string[], params?: JsonRpcParams) => import("@metamask/utils").Json[];
17
+ //# sourceMappingURL=sortParams.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sortParams.d.cts","sourceRoot":"","sources":["../../src/common/sortParams.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAErD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,iBACV,MAAM,EAAE,WACb,aAAa,qCAwBvB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { JsonRpcParams } from "@metamask/utils";
2
+ /**
3
+ * Deterministically sort JSON-RPC parameter keys. This makes it possible to
4
+ * support both arrays and objects as parameters. Objects are sorted and turned
5
+ * into arrays, for easier consumption by the snap.
6
+ *
7
+ * The order is defined by the `method` parameter.
8
+ *
9
+ * @param methodParams - The parameters of the JSON-RPC method, which
10
+ * determines the ordering for the parameters.
11
+ * @param params - JSON-RPC parameters as object or array.
12
+ * @returns The values for the sorted keys. If `params` is not provided, this
13
+ * returns an empty array. If `params` is an array, this returns the same
14
+ * `params`.
15
+ */
16
+ export declare const sortParamKeys: (methodParams: string[], params?: JsonRpcParams) => import("@metamask/utils").Json[];
17
+ //# sourceMappingURL=sortParams.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sortParams.d.mts","sourceRoot":"","sources":["../../src/common/sortParams.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB;AAErD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,iBACV,MAAM,EAAE,WACb,aAAa,qCAwBvB,CAAC"}