-
Notifications
You must be signed in to change notification settings - Fork 5.4k
chore: configurable supported permission types and removal of gator-permissions build feature
#38514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
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. |
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (2 files, +7 -5)
🫰 @MetaMask/core-platform (2 files, +0 -4)
🕵️ @MetaMask/extension-privacy-reviewers (1 files, +18 -0)
🧪 @MetaMask/qa (1 files, +18 -0)
|
Builds ready [b325418]
UI Startup Metrics (1270 ± 116 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
gator-permissions build feature
Builds ready [b3b1762]
UI Startup Metrics (1254 ± 115 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚀 Bundle size reduced!]
|
…://github.com/MetaMask/metamask-extension into chore/Configurable-supported-permission-types
Builds ready [5f5681f]
UI Startup Metrics (1255 ± 114 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
jeffsmale90
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two fairly minor comments, otherwise this looks excellent! I think this is a great step towards production readiness.
Builds ready [9c5c1a8]
UI Startup Metrics (1249 ± 115 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
Reason for the change
The previous implementation used a simple boolean feature flag (
GATOR_PERMISSIONS_ENABLED) to enable or disable all Gator permissions at once. This all-or-nothing approach lacked the granularity needed to progressively roll out individual permission types (e.g.,native-token-stream,erc20-token-periodic) across different builds or environments. Additionally, thegator-permissionsbuild feature with code fences complicated the build process by conditionally including snaps only in Flask builds.Improvement/Solution
This PR introduces granular control over Gator permission types by:
Replacing the boolean flag with a comma-separated list: The
GATOR_PERMISSIONS_ENABLEDenvironment variable has been replaced withGATOR_ENABLED_PERMISSION_TYPES, which accepts a comma-separated list of permission types (e.g.,'native-token-stream,native-token-periodic,erc20-token-stream,erc20-token-periodic').Adding per-request validation: The
processRequestExecutionPermissionshandler now validates that each requested permission type is included in the enabled list before forwarding the request to the Snap. If a permission type is not enabled, the request is rejected with amethodNotSupportedRPC error.Renaming the helper function:
isGatorPermissionsFeatureEnabled()has been renamed togetEnabledAdvancedPermissions()to better reflect its new purpose of returning an array of enabled permission type strings.Updating build configuration: The Flask build now explicitly lists all four supported permission types, while the default configuration uses an empty string (no permissions enabled).
Removing the
gator-permissionsbuild feature: The code fences (///: BEGIN:ONLY_INCLUDE_IF(gator-permissions)) have been removed, and the Gator permission snaps are now bundled in all builds. This brings us a step closer to production readiness.This change enables teams to:
Changelog
CHANGELOG entry: null
Manual testing steps
GATOR_ENABLED_PERMISSION_TYPESwith different valuesScreenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Configures enabled permission types via GATOR_ENABLED_PERMISSION_TYPES with per-request validation, removes the gator-permissions build feature, and bundles related snaps across builds.
isGatorPermissionsFeatureEnabled/GATOR_PERMISSIONS_ENABLEDwithgetEnabledAdvancedPermissionsparsingGATOR_ENABLED_PERMISSION_TYPES.builds.yml: set Flask to enable specific types; default env declares empty list; removegator-permissionsfeature and move snaps underkeyring-snaps.metamask-controller: add per-request validation inprocessRequestExecutionPermissionsagainst enabled types before forwarding topermissions-kernelsnap.GatorPermissionsControllerInit: deriveisGatorPermissionsEnabledfrom enabled types; keep provider snap ID handling.@metamask/permissions-kernel-snapand@metamask/gator-permissions-snap(app/scripts/constants/snaps.ts,shared/lib/snaps/snaps.ts).confirm/info: gate Typed Sign Permission UI on enabled types; error when none enabled.getEnabledAdvancedPermissionsand new behavior.Written by Cursor Bugbot for commit 9c5c1a8. This will update automatically on new commits. Configure here.