Skip to content

Commit

Permalink
Bump SES and LavaMoat (MetaMask#2105)
Browse files Browse the repository at this point in the history
Bumps all LavaMoat packages to their latest versions.

This solves a problem where the snaps execution environment would fail
to function in the latest version of Chrome Canary. It also means we can
remove some of our patches as some changes have been upstreamed!
  • Loading branch information
FrederikBolding authored Jan 18, 2024
1 parent f87b45a commit fbef4f1
Show file tree
Hide file tree
Showing 48 changed files with 509 additions and 504 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
diff --git a/src/runtime.js b/src/runtime.js
index 5bee3d6fc752ee133aff8b12e503b674d7f32d1a..8141bff31e30d73b2f8be334272d2e20a1e73e0c 100644
index 545794c974c94f12f86abe510a33598b63cb3c01..2cd1210cfe6de51224e6b493770ad48c67c0c6d0 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -11326,6 +11326,8 @@ function observeImports(map, importName, importIndex) {
errorTaming: 'unsafe',
// shows the full call stack
stackFiltering: 'verbose',
+ // prevent issues when dealing with the "override mistake"
+ overrideTaming: 'severe',
}

lockdown(lockdownOptions)
@@ -12451,6 +12453,17 @@ module.exports = {


@@ -13196,6 +13196,17 @@ module.exports = {


function loadModuleData (moduleId) {
+ if (typeof window === 'undefined' && typeof require === 'function' && require('node:module').isBuiltin(moduleId)) {
+ return {
Expand Down
30 changes: 0 additions & 30 deletions .yarn/patches/lavamoat-browserify-npm-15.9.1-12130e68ce.patch

This file was deleted.

39 changes: 39 additions & 0 deletions .yarn/patches/lavamoat-browserify-npm-17.0.2-7b95761e43.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/src/index.js b/src/index.js
index db802666fb1126700dc604008d51c0f152b6cb37..f9f232171db273991334c9a4b3746ccc66fdda4d 100644
--- a/src/index.js
+++ b/src/index.js
@@ -8,6 +8,7 @@ const createLavaPack = require('@lavamoat/lavapack')
const { createSesWorkaroundsTransform } = require('./sesTransforms')
const { loadCanonicalNameMap } = require('@lavamoat/aa')
const browserResolve = require('browser-resolve')
+const { isBuiltin } = require('node:module')

// these are the reccomended arguments for lavaMoat to work well with browserify
const reccomendedArgs = {
@@ -72,7 +73,7 @@ function plugin(browserify, pluginOpts) {
createModuleInspectorSpy({
policyOverride,
// no builtins in the browser (yet!)
- isBuiltin: () => false,
+ isBuiltin: (name) => browserify._options.node && isBuiltin(name),
// should prepare debug info
includeDebugInfo: configuration.writeAutoPolicyDebug,
// write policy files to disk
@@ -321,7 +322,7 @@ function validatePolicy(policy) {
Object.entries(policy.resources).forEach(([, packageOpts]) => {
const packageOptions = Object.keys(packageOpts)
const packageEntries = Object.values(packageOpts)
- const optionsWhitelist = ['globals', 'packages']
+ const optionsWhitelist = ['globals', 'packages', 'builtin']
const valuesWhitelist = [true, 'write']

if (
@@ -330,7 +331,7 @@ function validatePolicy(policy) {
)
) {
throw new Error(
- "LavaMoat - Unrecognized package options. Expected 'globals' or 'packages'"
+ "LavaMoat - Unrecognized package options. Expected 'globals', 'packages' or 'builtin'"
)
}

13 changes: 0 additions & 13 deletions .yarn/patches/lavamoat-core-npm-14.4.1-c4e8bbb016.patch

This file was deleted.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"resolutions": {
"@babel/core": "patch:@babel/core@npm%3A7.23.2#./.yarn/patches/@babel-core-npm-7.23.2-b93f586907.patch",
"@esbuild-plugins/node-modules-polyfill@^0.2.2": "patch:@esbuild-plugins/node-modules-polyfill@npm%3A0.2.2#./.yarn/patches/@esbuild-plugins-node-modules-polyfill-npm-0.2.2-f612681798.patch",
"@lavamoat/lavapack@^5.4.1": "patch:@lavamoat/lavapack@npm%3A5.4.1#./.yarn/patches/@lavamoat-lavapack-npm-5.4.1-2548b3e225.patch",
"@lavamoat/lavapack@^6.0.2": "patch:@lavamoat/lavapack@npm%3A6.0.2#./.yarn/patches/@lavamoat-lavapack-npm-6.0.2-abebdc70c1.patch",
"@types/glob@*": "patch:@types/glob@npm%3A7.1.4#./.yarn/patches/@types-glob-npm-7.1.4-d45247eaa2.patch",
"@types/glob@^7.1.1": "patch:@types/glob@npm%3A7.1.4#./.yarn/patches/@types-glob-npm-7.1.4-d45247eaa2.patch",
"@types/mocha@^10.0.1": "patch:@types/mocha@npm:10.0.1#.yarn/patches/@types-mocha-npm-10.0.1-7c94e9e170.patch",
Expand All @@ -61,12 +61,11 @@
"jest-fetch-mock@^3.0.3": "patch:jest-fetch-mock@npm:3.0.3#.yarn/patches/jest-fetch-mock-npm-3.0.3-ac072ca8af.patch",
"jest-util@^29.5.0": "patch:jest-util@npm%3A29.6.3#./.yarn/patches/jest-util-npm-29.6.3-6ffdea2c1c.patch",
"jest-util@^29.6.3": "patch:jest-util@npm%3A29.6.3#./.yarn/patches/jest-util-npm-29.6.3-6ffdea2c1c.patch",
"lavamoat-browserify@^15.9.1": "patch:lavamoat-browserify@npm%3A15.9.1#./.yarn/patches/lavamoat-browserify-npm-15.9.1-12130e68ce.patch",
"lavamoat-core@^14.4.1": "patch:lavamoat-core@npm%3A14.4.1#./.yarn/patches/lavamoat-core-npm-14.4.1-c4e8bbb016.patch",
"lavamoat-browserify@^17.0.2": "patch:lavamoat-browserify@npm%3A17.0.2#./.yarn/patches/lavamoat-browserify-npm-17.0.2-7b95761e43.patch",
"luxon@^3.2.1": "patch:luxon@npm%3A3.3.0#./.yarn/patches/luxon-npm-3.3.0-bdbae9bfd5.patch"
},
"devDependencies": {
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/create-release-branch": "^2.0.1",
"@metamask/eslint-config": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"yargs": "^17.7.1"
},
"devDependencies": {
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"lint:dependencies": "depcheck"
},
"devDependencies": {
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip44/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/browserify-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/cronjobs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/dialogs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethereum-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethers-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-entropy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/home-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/images/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/invoke-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"lint:dependencies": "depcheck"
},
"devDependencies": {
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/json-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/lifecycle-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/localization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/manage-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/name-lookup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/network-access/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/notifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/rollup-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@babel/preset-env": "^7.23.2",
"@babel/preset-typescript": "^7.23.2",
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/signature-insights/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@lavamoat/allow-scripts": "^2.5.1",
"@lavamoat/allow-scripts": "^3.0.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/eslint-config": "^12.1.0",
"@metamask/eslint-config-jest": "^12.1.0",
Expand Down
Loading

0 comments on commit fbef4f1

Please sign in to comment.