feat: Gator permissions controller integration#35627
Conversation
✨ Files requiring CODEOWNER review ✨🧩 @MetaMask/extension-devs (4 files, +28 -0)
📜 @MetaMask/policy-reviewers (4 files, +28 -0)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. 🔗 @MetaMask/supply-chain (4 files, +28 -0)
|
## Explanation First release for the `@metamask/gator-permissions-controller` (0.1.0). ## References Required by(MM Extension): MetaMask/metamask-extension#35627 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
@metamaskbot update-policies |
|
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
📊 Page Load Benchmark ResultsCurrent Commit: 📄 https://metamask.github.io/test-dapp/Samples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
📊 Page Load Benchmark ResultsCurrent Commit: 📄 https://metamask.github.io/test-dapp/Samples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [9bf3f9a]
UI Startup Metrics (1202 ± 59 ms)
Benchmark value 4 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 255 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 10 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 276 exceeds gate value 195 for chrome webpack home p95 getState Benchmark value 13 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 32 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 27 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 4 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 223 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 82 exceeds gate value 70 for firefox browserify home p95 backgroundConnect Benchmark value 8 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 33 exceeds gate value 27 for firefox browserify home p95 setupStore Benchmark value 108 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 30 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 44 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 3 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 272 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 8 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 266ms | Sum of p95 exceeds: 506.8ms Sum of all benchmark exceeds: 772.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 https://metamask.github.io/test-dapp/Samples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [a891f16]
UI Startup Metrics (1267 ± 60 ms)
Benchmark value 1100 exceeds gate value 1070 for chrome browserify home mean load Benchmark value 1090 exceeds gate value 1061 for chrome browserify home mean domContentLoaded Benchmark value 260 exceeds gate value 10 for chrome browserify home mean backgroundConnect Benchmark value 24 exceeds gate value 23 for chrome browserify home mean firstReactRender Benchmark value 5 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 841 exceeds gate value 830 for chrome browserify home mean loadScripts Benchmark value 1191 exceeds gate value 1190 for chrome browserify home p95 load Benchmark value 1183 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded Benchmark value 1191 exceeds gate value 1180 for chrome browserify home p95 firstPaint Benchmark value 282 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 13 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 23 exceeds gate value 21 for chrome webpack home mean domInteractive Benchmark value 42 exceeds gate value 40 for chrome webpack home mean backgroundConnect Benchmark value 2585 exceeds gate value 2454 for chrome webpack home p95 uiStartup Benchmark value 2040 exceeds gate value 2030 for chrome webpack home p95 load Benchmark value 2034 exceeds gate value 2005 for chrome webpack home p95 domContentLoaded Benchmark value 95 exceeds gate value 57 for chrome webpack home p95 domInteractive Benchmark value 15 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 2024 exceeds gate value 1970 for chrome webpack home p95 loadScripts Benchmark value 30 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 27 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 3 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 217 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 7 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 107 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 34 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 43 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 5 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 266 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 6 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 397ms | Sum of p95 exceeds: 701.8ms Sum of all benchmark exceeds: 1098.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
jeffsmale90
left a comment
There was a problem hiding this comment.
I've opened #35775 into this branch that rejects invalid snapId provided via configuration, but falls back to default if no configuration is provided. This ensures only valid configuration is accepted, but allows end-to-end tests to run without needing additional configuration to be supplied.
## **Description** When instantiating the `GatorPermissionsController`, previously invalid snapIds specified by `process.env.GATOR_PERMISSIONS_PROVIDER_SNAP_ID` would be ignored, falling back to the default value specified by the controller implementation. This is undesired because the configuration that is supplied at build time is being ignored. The preferred behaviour is to fail, and require valid configuration. This change throws an error if an invalid snapId is specified, and adds reasonable configuration values to builds.yml configuration. If no values are specified, the default from Gator Permissions Controller is used. In order to enable the feature for any build (local, flask, production) with the production snaps, only the `GATOR_PERMISSIONS_ENABLED` variable would need to be set. [](https://codespaces.new/MetaMask/metamask-extension/pull/35775?quickstart=1) ## **Changelog** This PR is not user facing, as it's targeting a feature branch. Change log details will be provided in that PR. ## **Related** #35627 ## **Manual testing steps** Provide explicit configuration (default): 1. Extension should start successfully Provide no configuration: 1. Remove the `GATOR_PERMISSIONS_PROVIDER_SNAP_ID` from builds.yml 2. Extension should start successfully Provide invalid configuration 1. Set `GATOR_PERMISSIONS_PROVIDER_SNAP_ID` to an invalid snapId (ie "invalid-snap-id") 2. Extension should fail to start
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [42e94bd]
UI Startup Metrics (1259 ± 70 ms)
Benchmark value 1091 exceeds gate value 1070 for chrome browserify home mean load Benchmark value 1083 exceeds gate value 1061 for chrome browserify home mean domContentLoaded Benchmark value 255 exceeds gate value 10 for chrome browserify home mean backgroundConnect Benchmark value 24 exceeds gate value 23 for chrome browserify home mean firstReactRender Benchmark value 5 exceeds gate value 1 for chrome browserify home mean initialActions Benchmark value 837 exceeds gate value 830 for chrome browserify home mean loadScripts Benchmark value 1405 exceeds gate value 1365 for chrome browserify home p95 uiStartup Benchmark value 1232 exceeds gate value 1190 for chrome browserify home p95 load Benchmark value 1221 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded Benchmark value 1218 exceeds gate value 1180 for chrome browserify home p95 firstPaint Benchmark value 273 exceeds gate value 18 for chrome browserify home p95 backgroundConnect Benchmark value 11 exceeds gate value 1.2 for chrome browserify home p95 initialActions Benchmark value 977 exceeds gate value 940 for chrome browserify home p95 loadScripts Benchmark value 257 exceeds gate value 195 for chrome webpack home p95 getState Benchmark value 14 exceeds gate value 7 for chrome webpack home p95 initialActions Benchmark value 1421 exceeds gate value 1405 for firefox browserify home mean uiStartup Benchmark value 35 exceeds gate value 25 for firefox browserify home mean backgroundConnect Benchmark value 28 exceeds gate value 25 for firefox browserify home mean firstReactRender Benchmark value 3 exceeds gate value 1 for firefox browserify home mean initialActions Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore Benchmark value 1699 exceeds gate value 1660 for firefox browserify home p95 uiStartup Benchmark value 210 exceeds gate value 195 for firefox browserify home p95 domInteractive Benchmark value 74 exceeds gate value 70 for firefox browserify home p95 backgroundConnect Benchmark value 8 exceeds gate value 2 for firefox browserify home p95 initialActions Benchmark value 103 exceeds gate value 100 for firefox webpack home mean domInteractive Benchmark value 32 exceeds gate value 26 for firefox webpack home mean backgroundConnect Benchmark value 42 exceeds gate value 38 for firefox webpack home mean firstReactRender Benchmark value 4 exceeds gate value 1 for firefox webpack home mean initialActions Benchmark value 277 exceeds gate value 156 for firefox webpack home p95 domInteractive Benchmark value 8 exceeds gate value 2 for firefox webpack home p95 initialActions Sum of mean exceeds: 374ms | Sum of p95 exceeds: 722.8ms Sum of all benchmark exceeds: 1096.8ms Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This PR adds @metamask/gator-permissions-controller package into extension:
@metamask/gator-permissions-controller: a controller to handle managing gator permissions in MetaMask clients with @metamask/gator-permissions-snap integration.It also creates background actions to allow the UI to submit requests to the background to invoke actions exposed on
@metamask/gator-permissions-controller:fetchAndUpdateGatorPermissionsNote - local snap for development
The
GatorPermissionsControllerInitis configured to use a local running instance of the gator-snap for non-production environments to support development in future PRs.Related issues
Requires: MetaMask/core#6467
Relates to(MM Core): MetaMask/core#6033
Relates to: #35307
Required by: #35219
Manual testing steps
There is no need for testing, since we are integrating dependencies to support future PRs.
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist