Skip to content

Conversation

@MoMannn
Copy link
Contributor

@MoMannn MoMannn commented Dec 3, 2025

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, the gator-permissions build 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:

  1. Replacing the boolean flag with a comma-separated list: The GATOR_PERMISSIONS_ENABLED environment variable has been replaced with GATOR_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').

  2. Adding per-request validation: The processRequestExecutionPermissions handler 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 a methodNotSupported RPC error.

  3. Renaming the helper function: isGatorPermissionsFeatureEnabled() has been renamed to getEnabledAdvancedPermissions() to better reflect its new purpose of returning an array of enabled permission type strings.

  4. 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).

  5. Removing the gator-permissions build 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:

  • Incrementally enable new permission types without affecting others
  • Test specific permission types in isolation
  • Have different permission type configurations per build type
  • Use the same build artifacts across environments with different configurations

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null

Manual testing steps

  1. Change GATOR_ENABLED_PERMISSION_TYPES with different values
  2. Rebuild and try to grant those permissions. If not included they should be rejected.

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

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.

  • Environment & Config:
    • Replace isGatorPermissionsFeatureEnabled/GATOR_PERMISSIONS_ENABLED with getEnabledAdvancedPermissions parsing GATOR_ENABLED_PERMISSION_TYPES.
    • Update builds.yml: set Flask to enable specific types; default env declares empty list; remove gator-permissions feature and move snaps under keyring-snaps.
  • Background/Controllers:
    • metamask-controller: add per-request validation in processRequestExecutionPermissions against enabled types before forwarding to permissions-kernel snap.
    • GatorPermissionsControllerInit: derive isGatorPermissionsEnabled from enabled types; keep provider snap ID handling.
  • Snaps:
    • Always preinstall @metamask/permissions-kernel-snap and @metamask/gator-permissions-snap (app/scripts/constants/snaps.ts, shared/lib/snaps/snaps.ts).
  • UI:
    • confirm/info: gate Typed Sign Permission UI on enabled types; error when none enabled.
  • Tests & E2E:
    • Update unit tests to mock getEnabledAdvancedPermissions and new behavior.
    • Extend E2E state logs to include permissions snaps metadata.

Written by Cursor Bugbot for commit 9c5c1a8. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

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.

@metamaskbot metamaskbot added the team-delegation MetaMask Delegation Team label Dec 3, 2025
@metamaskbot
Copy link
Collaborator

metamaskbot commented Dec 3, 2025

✨ Files requiring CODEOWNER review ✨

@MetaMask/confirmations (2 files, +7 -5)
  • 📁 ui/
    • 📁 pages/
      • 📁 confirmations/
        • 📁 components/
          • 📁 confirm/
            • 📁 info/
              • 📄 info.test.tsx +5 -3
              • 📄 info.tsx +2 -2

🫰 @MetaMask/core-platform (2 files, +0 -4)
  • 📁 app/
    • 📁 scripts/
      • 📁 constants/
        • 📄 snaps.ts +0 -2
  • 📁 shared/
    • 📁 lib/
      • 📁 snaps/
        • 📄 snaps.ts +0 -2

🕵️ @MetaMask/extension-privacy-reviewers (1 files, +18 -0)
  • 📁 test/
    • 📁 e2e/
      • 📁 tests/
        • 📁 settings/
          • 📄 state-logs.json +18 -0

🧪 @MetaMask/qa (1 files, +18 -0)
  • 📁 test/
    • 📁 e2e/
      • 📁 tests/
        • 📁 settings/
          • 📄 state-logs.json +18 -0

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Dec 3, 2025
@github-actions github-actions bot added the size-M label Dec 3, 2025
@MoMannn MoMannn marked this pull request as ready for review December 3, 2025 12:21
@MoMannn MoMannn requested a review from a team as a code owner December 3, 2025 12:21
@metamaskbot
Copy link
Collaborator

Builds ready [b325418]
UI Startup Metrics (1270 ± 116 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12701036169511613401459
load1065872150410711281249
domContentLoaded1059867149710611251241
domInteractive3015168282396
firstPaint55886125741310231215
backgroundConnect22020225811227240
firstReactRender28196783043
getState3316113163756
initialActions104112
loadScripts84566812591039081022
setupStore1173441221
numNetworkReqs1257520572
BrowserifyPower User HomeuiStartup20581772271219920882538
load1046893146912310821368
domContentLoaded1032886146112410611360
domInteractive35181122235105
firstPaint5639614033889781252
backgroundConnect24620762874235507
firstReactRender58401251661100
getState19313633437210258
initialActions106113
loadScripts81967312461208411121
setupStore211189102343
numNetworkReqs93662482697133
WebpackStandard HomeuiStartup8357111135918621033
load64957390480662855
domContentLoaded64456689879656845
domInteractive29161152323100
firstPaint21583869147203656
backgroundConnect106617916
firstReactRender2920137123339
getState27135393444
initialActions103111
loadScripts64156489577654835
setupStore1153951320
numNetworkReqs1257520573
WebpackPower User HomeuiStartup16341314223924418282130
load684587103992698902
domContentLoaded673577102292684897
domInteractive38172103336117
firstPaint287103916198298732
backgroundConnect61762014419556
firstReactRender59468896476
getState1828570757185224
initialActions103112
loadScripts671575102091682888
setupStore241062142856
numNetworkReqs1596740767212299
FirefoxBrowserifyStandard HomeuiStartup14141105230619815111815
load1161924208114912101360
domContentLoaded1160924208114912101360
domInteractive7930103310390141
firstPaint------
backgroundConnect51221743161122
firstReactRender24184352637
getState197225371279
initialActions102122
loadScripts1129906205914211791331
setupStore156176211433
numNetworkReqs1256717760
BrowserifyPower User HomeuiStartup26742010525652727514077
load12541035242128312711696
domContentLoaded12531035242128312711696
domInteractive12837528111123468
firstPaint------
backgroundConnect15534735155144570
firstReactRender6140133166297
getState285711068229293813
initialActions3037427
loadScripts12121016229424912271663
setupStore1949803224297752
numNetworkReqs92592554491223
WebpackStandard HomeuiStartup17351452259522418582196
load14031220173212115031630
domContentLoaded14031219173212115031630
domInteractive70332653991138
firstPaint------
backgroundConnect60212444065166
firstReactRender3221157163443
getState2072033214104
initialActions216124
loadScripts13731200169611514751602
setupStore2210109202081
numNetworkReqs1257118764
WebpackPower User HomeuiStartup29562102535873829024627
load15301135282544416392712
domContentLoaded15301135282544416382712
domInteractive136291038168118430
firstPaint------
backgroundConnect2012412782711691120
firstReactRender63391902763107
getState23751841178284671
initialActions216123
loadScripts14301120272334714862408
setupStore16051077226154718
numNetworkReqs936231843100196
📊 Page Load Benchmark Results

Current Commit: b325418 | Date: 12/3/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±46ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 739ms (±41ms) 🟢 | historical mean value: 726ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±12ms) 🟢 | historical mean value: 79ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 46ms 1.02s 1.37s 1.12s 1.37s
domContentLoaded 739ms 41ms 704ms 1.02s 789ms 1.02s
firstPaint 79ms 12ms 64ms 188ms 88ms 188ms
firstContentfulPaint 79ms 12ms 64ms 188ms 88ms 188ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 630 Bytes (0.01%)
  • ui: -535 Bytes (-0.01%)
  • common: 21 Bytes (0%)

@MoMannn MoMannn requested a review from a team as a code owner December 4, 2025 11:16
@MoMannn MoMannn changed the title chore: configurable supported permission types chore: configurable supported permission types and removal of gator-permissions build feature Dec 4, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [b3b1762]
UI Startup Metrics (1254 ± 115 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12541028158711513401434
load104285513159711061233
domContentLoaded103784913119611001225
domInteractive2516104192184
firstPaint51976124239910051169
backgroundConnect21519727414218243
firstReactRender3019212203047
getState3616118193871
initialActions108112
loadScripts828649108292885999
setupStore1162941223
numNetworkReqs1157117560
BrowserifyPower User HomeuiStartup19991570275822020862445
load1018881136712010741302
domContentLoaded1006875135911910661283
domInteractive3216158243097
firstPaint5539313114129641243
backgroundConnect267200790129237582
firstReactRender544095115881
getState18514534733194228
initialActions104112
loadScripts79768111551178401070
setupStore1664581538
numNetworkReqs78652192175129
WebpackStandard HomeuiStartup77165699776805917
load60253581268625758
domContentLoaded59853080668619751
domInteractive251394201981
firstPaint25385813180262678
backgroundConnect1058491123
firstReactRender25193953036
getState261285133253
initialActions104111
loadScripts59552880467617743
setupStore1063551224
numNetworkReqs1156817564
WebpackPower User HomeuiStartup16441285228726719052137
load6975951106105710938
domContentLoaded6895881100105698929
domInteractive36182743629115
firstPaint292102737187337699
backgroundConnect98861718382564
firstReactRender614688106781
getState18914270959190257
initialActions103112
loadScripts6865861091104696921
setupStore18788131646
numNetworkReqs79642352773149
FirefoxBrowserifyStandard HomeuiStartup13961117181217315231715
load1152961157812912171403
domContentLoaded1151960157712912161402
domInteractive68302423990132
firstPaint------
backgroundConnect58223644874143
firstReactRender24185562436
getState12790111124
initialActions102122
loadScripts1118944145611511651356
setupStore165234291333
numNetworkReqs1256817659
BrowserifyPower User HomeuiStartup30801794547696641024730
load1464995372656714552546
domContentLoaded1464995372656714542544
domInteractive122332381236113264
firstPaint------
backgroundConnect3283213254144241216
firstReactRender62352743362142
getState323851309281414920
initialActions3041623
loadScripts1282965370443912542352
setupStore14851040214148667
numNetworkReqs76471402172122
WebpackStandard HomeuiStartup14721266211915415191785
load12151080157510312871418
domContentLoaded12141080157510312871418
domInteractive56291423080116
firstPaint------
backgroundConnect43231712645114
firstReactRender27204352938
getState15785131345
initialActions103122
loadScripts1191105815379712611357
setupStore12670111239
numNetworkReqs1256717761
WebpackPower User HomeuiStartup32972131579395541764932
load16431133306153321032688
domContentLoaded16421133306153321032682
domInteractive136271148186126354
firstPaint------
backgroundConnect2483012023322931120
firstReactRender77383685471203
getState361781810336518966
initialActions2156626
loadScripts14961118260640215542498
setupStore10661194183100457
numNetworkReqs78511392275128
📊 Page Load Benchmark Results

Current Commit: b3b1762 | Date: 12/4/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±40ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 723ms (±37ms) 🟢 | historical mean value: 726ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±12ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 40ms 1.01s 1.34s 1.07s 1.34s
domContentLoaded 723ms 37ms 703ms 1.00s 749ms 1.00s
firstPaint 77ms 12ms 64ms 180ms 88ms 180ms
firstContentfulPaint 77ms 12ms 64ms 180ms 88ms 180ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 26.62 KiB (0.51%)
  • ui: 4.49 KiB (0.06%)
  • common: -33.04 KiB (-0.37%)

@MoMannn MoMannn requested review from a team as code owners December 4, 2025 14:06
@metamaskbot
Copy link
Collaborator

Builds ready [5f5681f]
UI Startup Metrics (1255 ± 114 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12551002150311413471453
load1050849132010111301224
domContentLoaded1045842131310011191217
domInteractive2515118202183
firstPaint4728012613949621198
backgroundConnect21419526512221238
firstReactRender27198292949
getState3416106143860
initialActions103112
loadScripts8366461104969091010
setupStore1153541119
numNetworkReqs1057416561
BrowserifyPower User HomeuiStartup19861734270522720902496
load1022890147011910601303
domContentLoaded1010883144911910491295
domInteractive3117116213086
firstPaint57110314713919551204
backgroundConnect249202806111230605
firstReactRender523910295764
getState18814330329199243
initialActions103112
loadScripts80267412291158311075
setupStore16104371635
numNetworkReqs78651492075144
WebpackStandard HomeuiStartup80168997361828933
load62555879861665764
domContentLoaded62155279361662757
domInteractive241594192081
firstPaint20081763126192586
backgroundConnect1056371016
firstReactRender27206973136
getState271489123547
initialActions103111
loadScripts61854979160660749
setupStore1064251216
numNetworkReqs1056416559
WebpackPower User HomeuiStartup16381262224927719072109
load64957295885676858
domContentLoaded64256594785671851
domInteractive32171322631110
firstPaint290103902204309701
backgroundConnect1627638239447598
firstReactRender57417996477
getState202150908108194245
initialActions103012
loadScripts63956394083669842
setupStore17959121449
numNetworkReqs80652272973154
FirefoxBrowserifyStandard HomeuiStartup12731036170614113511615
load105489313079311201271
domContentLoaded105389313079311201271
domInteractive57311433084118
firstPaint------
backgroundConnect43211793041111
firstReactRender23184352436
getState157143191348
initialActions102122
loadScripts102787712808510831201
setupStore155236281032
numNetworkReqs1156817662
BrowserifyPower User HomeuiStartup320120256099103241615060
load1405960268351113762535
domContentLoaded1405960268251113762534
domInteractive113301186127113292
firstPaint------
backgroundConnect3202813304074221202
firstReactRender71373544676151
getState332911079268426929
initialActions2154523
loadScripts1209941232328012552181
setupStore11761243189102558
numNetworkReqs76511612273125
WebpackStandard HomeuiStartup14851260215714015701729
load1233104315339612871412
domContentLoaded1232104315339612871410
domInteractive62261883386113
firstPaint------
backgroundConnect45161352745108
firstReactRender271888102940
getState157174211346
initialActions103122
loadScripts1204102814568812581344
setupStore155258271136
numNetworkReqs1256816761
WebpackPower User HomeuiStartup30852238453868637944387
load15391115273542515522456
domContentLoaded15381115273542415522456
domInteractive149321271235124914
firstPaint------
backgroundConnect169291178209177551
firstReactRender66392793665144
getState282811006263405834
initialActions511031337
loadScripts14741099268739314772328
setupStore13171040198109664
numNetworkReqs77551332272125
📊 Page Load Benchmark Results

Current Commit: 5f5681f | Date: 12/4/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±37ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 718ms (±36ms) 🟢 | historical mean value: 725ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±10ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 37ms 1.01s 1.31s 1.07s 1.31s
domContentLoaded 718ms 36ms 695ms 987ms 746ms 987ms
firstPaint 76ms 10ms 60ms 152ms 88ms 152ms
firstContentfulPaint 76ms 10ms 60ms 152ms 88ms 152ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 612 Bytes (0.01%)
  • ui: 3.21 KiB (0.04%)
  • common: 100 Bytes (0%)

Copy link
Contributor

@jeffsmale90 jeffsmale90 left a 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.

@metamaskbot
Copy link
Collaborator

Builds ready [9c5c1a8]
UI Startup Metrics (1249 ± 115 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12491046154111513221457
load104585812439711081217
domContentLoaded103885312389611011207
domInteractive2615109192382
firstPaint61878125643310811192
backgroundConnect21018728416218242
firstReactRender301973113454
getState3414105154354
initialActions104112
loadScripts8356611034928961003
setupStore1273461426
numNetworkReqs271896211886
BrowserifyPower User HomeuiStartup20371746274619421102456
load1029895172214310221383
domContentLoaded1014886171514210021371
domInteractive3418134233398
firstPaint5028615853839391306
backgroundConnect262202726111235572
firstReactRender5442101115787
getState19213071292193227
initialActions104112
loadScripts80168714951397951154
setupStore21669102344
numNetworkReqs1486939964208252
WebpackStandard HomeuiStartup824702107673866981
load63056687261653766
domContentLoaded62555786461648760
domInteractive2515111192286
firstPaint240104764164219628
backgroundConnect1053961227
firstReactRender27204163237
getState291386143855
initialActions103112
loadScripts62355485760638751
setupStore1163851218
numNetworkReqs26996201885
WebpackPower User HomeuiStartup15751231220620216162010
load675585100686680869
domContentLoaded66558099887666863
domInteractive36191622735102
firstPaint2661031007187260712
backgroundConnect48862112019462
firstReactRender58478686473
getState17912872979179214
initialActions102012
loadScripts66257899085664858
setupStore22756122647
numNetworkReqs1607233562220279
FirefoxBrowserifyStandard HomeuiStartup13751132193416114401697
load1124966149510811731364
domContentLoaded1123959148910811721363
domInteractive76352763993140
firstPaint------
backgroundConnect54231693271113
firstReactRender26186592550
getState146120181167
initialActions103122
loadScripts1090945142410011371294
setupStore13692141044
numNetworkReqs281888202282
BrowserifyPower User HomeuiStartup26102008537559226304127
load1199951250728812562106
domContentLoaded1199951250728812502106
domInteractive118331029121119321
firstPaint------
backgroundConnect13430991166129477
firstReactRender5636175195793
getState299581076249406851
initialActions2032323
loadScripts1157919246727111631954
setupStore1787833233181730
numNetworkReqs82591732285139
WebpackStandard HomeuiStartup15401281214716716331862
load12711062158910713411477
domContentLoaded12701062158910713401477
domInteractive65262283985130
firstPaint------
backgroundConnect48192003248110
firstReactRender2720133122837
getState167195261427
initialActions102122
loadScripts12431047155810013171413
setupStore185202271449
numNetworkReqs281885202082
WebpackPower User HomeuiStartup30322112841793429404774
load15791193660769715602833
domContentLoaded15791193660769715602833
domInteractive186314766491112420
firstPaint------
backgroundConnect169241263242149983
firstReactRender64392053061141
getState32834998253518833
initialActions207126
loadScripts14991167657964415102719
setupStore1394830196118689
numNetworkReqs84582313180144
📊 Page Load Benchmark Results

Current Commit: 9c5c1a8 | Date: 12/5/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±41ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 720ms (±61ms) 🟢 | historical mean value: 724ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 86ms (±127ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 41ms 1.01s 1.35s 1.05s 1.35s
domContentLoaded 720ms 61ms 699ms 1.28s 739ms 1.28s
firstPaint 86ms 127ms 56ms 1.35s 84ms 1.35s
firstContentfulPaint 86ms 127ms 56ms 1.35s 84ms 1.35s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 612 Bytes (0.01%)
  • ui: 7 Bytes (0%)
  • common: 107 Bytes (0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template size-M team-delegation MetaMask Delegation Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants