mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-10-22 19:26:13 +02:00
d55507615c
Our Sentry setup relies upon application state, but it wasn't able to access it in LavaMoat builds because it's running in a separate Compartment. A patch has been introduced to the LavaMoat runtime to allow the root Compartment to mutate the `rootGlobals` object, which is accessible from outside the compartment as well. This lets us expose application state to our Sentry integration.
32 lines
1.5 KiB
Diff
32 lines
1.5 KiB
Diff
diff --git a/node_modules/@lavamoat/lavapack/src/pack.js b/node_modules/@lavamoat/lavapack/src/pack.js
|
|
index eb41a0a..3f891ea 100644
|
|
--- a/node_modules/@lavamoat/lavapack/src/pack.js
|
|
+++ b/node_modules/@lavamoat/lavapack/src/pack.js
|
|
@@ -203,7 +203,9 @@ function createPacker({
|
|
const jsonSerializeableData = {
|
|
// id,
|
|
package: packageName,
|
|
- file,
|
|
+ // Omit this absolute filename from bundle so that builds are reproducible between environments
|
|
+ // TODO: update lavapack with an option to omit this, and/or make this filepath relative to the current working directory
|
|
+ // file,
|
|
// deps,
|
|
// source: sourceMeta.code
|
|
}
|
|
diff --git a/node_modules/@lavamoat/lavapack/src/runtime.js b/node_modules/@lavamoat/lavapack/src/runtime.js
|
|
index 58f76f3..53df0e7 100644
|
|
--- a/node_modules/@lavamoat/lavapack/src/runtime.js
|
|
+++ b/node_modules/@lavamoat/lavapack/src/runtime.js
|
|
@@ -11160,6 +11160,11 @@ function makePrepareRealmGlobalFromConfig ({ createFunctionWrapper }) {
|
|
rootPackageCompartment.globalThis[ref] = rootPackageCompartment.globalThis
|
|
}
|
|
|
|
+ // Allow root compartment to expose things to the initial execution environment of the realm.
|
|
+ // This is intended to support passing data to shims run before lockdown.
|
|
+ globalThis.rootGlobals = {}
|
|
+ rootPackageCompartment.globalThis.rootGlobals = globalThis.rootGlobals
|
|
+
|
|
// save the compartment for use by other modules in the package
|
|
packageCompartmentCache.set(rootPackageName, rootPackageCompartment)
|
|
|