Skip to content

fix: Only reject approvals if subject has endowment:caip25 permission revoked#40139

Merged
FrederikBolding merged 3 commits intomainfrom
fb/reject-approvals-only-if-subject-has-caip25
Feb 18, 2026
Merged

fix: Only reject approvals if subject has endowment:caip25 permission revoked#40139
FrederikBolding merged 3 commits intomainfrom
fb/reject-approvals-only-if-subject-has-caip25

Conversation

@FrederikBolding
Copy link
Copy Markdown
Member

@FrederikBolding FrederikBolding commented Feb 16, 2026

Description

Rejecting all approvals caused strange behavior when installing Snaps from the Snaps Directory because the directory page uses wallet_revokePermissions. This PR fixes it by only rejecting pending approvals from the origin if the revoked permission is endowment:caip25.

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Fixed an issue where approvals would be closed too soon

Related issues

Fixes: #40112

Manual testing steps

See attached issue


Note

Low Risk
Small conditional change in RPC middleware behavior with targeted test update; low risk aside from potential behavioral differences in edge cases around permission key selection.

Overview
Updates wallet_revokePermissions so it only calls rejectApprovalRequestsForOrigin when the revoke set includes endowment:caip25, instead of rejecting approvals for any permission revocation.

Adjusts the corresponding unit test to trigger approval rejection via a CAIP-25-equivalent permission (eth_accounts) rather than an explicit endowment:caip25 entry.

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

@FrederikBolding FrederikBolding requested a review from a team as a code owner February 16, 2026 12:37
@metamaskbot metamaskbot added the team-core-platform Core Platform team label Feb 16, 2026
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Feb 16, 2026

✨ Files requiring CODEOWNER review ✨

👨‍🔧 @MetaMask/wallet-integrations (2 files, +5 -2)
  • 📁 app/
    • 📁 scripts/
      • 📁 lib/
        • 📁 rpc-method-middleware/
          • 📁 handlers/
            • 📄 wallet-revokePermissions.test.ts +1 -1
            • 📄 wallet-revokePermissions.ts +4 -1

params: [
{
[Caip25EndowmentPermissionName]: {},
"eth_accounts": {},
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

endowment:caip25 is currently only revokable if specifying a legacy permission

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Feb 16, 2026

Builds ready [a9615f1]
UI Startup Metrics (1397 ± 100 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup13971190184910014491569
load1204102315359012621349
domContentLoaded1198101815279012551342
domInteractive281797182577
firstPaint159691034116203304
backgroundConnect25323241422257284
firstReactRender16103641825
initialActions104112
loadScripts96277712859010171106
setupStore1254361421
numNetworkReqs231586201580
BrowserifyPower User HomeuiStartup17611452246416717902122
load11901057181816511671669
domContentLoaded11741051175815911521658
domInteractive37191802834115
firstPaint1777351086241316
backgroundConnect34330542625354390
firstReactRender22174352432
initialActions105112
loadScripts91079314761568871351
setupStore1573351827
numNetworkReqs1224726047143217
WebpackStandard HomeuiStartup8317111189948701013
load721628104787766879
domContentLoaded715624104186761872
domInteractive271698192481
firstPaint1146434956142236
backgroundConnect27174473239
firstReactRender16103251927
initialActions102112
loadScripts712622103985759865
setupStore1162331219
numNetworkReqs231597211584
WebpackPower User HomeuiStartup1301938202717913721684
load74365013651277341095
domContentLoaded73364313571277211087
domInteractive40201893534132
firstPaint1547043585191325
backgroundConnect17213337850186279
firstReactRender24193332631
initialActions104111
loadScripts73064113461257191076
setupStore1454771521
numNetworkReqs1174828555146264
FirefoxBrowserifyStandard HomeuiStartup15061308221118815341980
load12991147191114813301589
domContentLoaded12981144190614813291589
domInteractive62323464285125
firstPaint------
backgroundConnect5428205245884
firstReactRender12102321214
initialActions102012
loadScripts12731122184514113081569
setupStore166173231240
numNetworkReqs241297211785
BrowserifyPower User HomeuiStartup27302139455143027643515
load15531258226925116102170
domContentLoaded15521253226825116102166
domInteractive1123445993112361
firstPaint------
backgroundConnect342116960278502899
firstReactRender18146661822
initialActions103122
loadScripts15131237219423315712112
setupStore103777815785434
numNetworkReqs67331483490137
WebpackStandard HomeuiStartup16541410209613817011977
load14281229180510814711611
domContentLoaded14281229180510814701611
domInteractive963023546132151
firstPaint------
backgroundConnect55222393357116
firstReactRender15114441424
initialActions103112
loadScripts14021211177810414501588
setupStore166167231349
numNetworkReqs231289191775
WebpackPower User HomeuiStartup27521933377844829873599
load15791301231728517172155
domContentLoaded15781301231628517172154
domInteractive12631743148114554
firstPaint------
backgroundConnect3391221315268397913
firstReactRender22155662531
initialActions213122
loadScripts15141183223925016752023
setupStore1618791211177680
numNetworkReqs65351383191127
📊 Page Load Benchmark Results

Current Commit: a9615f1 | Date: 2/16/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±46ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 739ms (±43ms) 🟢 | historical mean value: 736ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 81ms (±19ms) 🟢 | historical mean value: 86ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 46ms 1.02s 1.43s 1.08s 1.43s
domContentLoaded 739ms 43ms 714ms 1.09s 757ms 1.09s
firstPaint 81ms 19ms 64ms 256ms 88ms 256ms
firstContentfulPaint 81ms 19ms 64ms 256ms 88ms 256ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 103 Bytes (0%)
  • ui: -1.31 KiB (-0.02%)
  • common: -294 Bytes (0%)

Copy link
Copy Markdown
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@FrederikBolding FrederikBolding added this pull request to the merge queue Feb 18, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 18, 2026
…on revoked (#40139)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Rejecting all approvals caused strange behavior when installing Snaps
from the Snaps Directory because the directory page uses
`wallet_revokePermissions`. This PR fixes it by only rejecting pending
approvals from the origin if the revoked permission is
`endowment:caip25`.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/40139?quickstart=1)

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: Fixed an issue where approvals would be closed too soon

## **Related issues**

Fixes: #40112

## **Manual testing steps**

See attached issue

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Small, well-scoped conditional change to approval rejection behavior
with accompanying test update; low risk aside from potentially altering
when pending confirmations are closed.
> 
> **Overview**
> Updates `wallet_revokePermissions` middleware to **only call**
`rejectApprovalRequestsForOrigin` when the revocation set includes
`endowment:caip25`, instead of rejecting approvals for any permission
revocation.
> 
> Adjusts the unit test to trigger approval rejection via revoking a
CAIP-25-equivalent permission (e.g. `eth_accounts`) that causes
`endowment:caip25` to be revoked.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
a9615f1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@FrederikBolding FrederikBolding removed this pull request from the merge queue due to a manual request Feb 18, 2026
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Feb 18, 2026

Builds ready [e5caae2]
UI Startup Metrics (1447 ± 112 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup14471241196911215051632
load12441044164110212921405
domContentLoaded12361039162110012871397
domInteractive3118118212684
firstPaint188711253201214374
backgroundConnect26723833215272296
firstReactRender17104551826
initialActions106112
loadScripts98778713669910361141
setupStore147115111521
numNetworkReqs231589201581
BrowserifyPower User HomeuiStartup2746148111013212023198654
load12981112184214813511618
domContentLoaded12781094181214613251591
domInteractive3620142213760
firstPaint1928145781256327
backgroundConnect1043313919319604196232
firstReactRender26175682742
initialActions106112
loadScripts1008840154714010421310
setupStore1675381932
numNetworkReqs1015022741127183
WebpackStandard HomeuiStartup7906431066104874961
load68857499999760871
domContentLoaded68356999298756864
domInteractive251587172275
firstPaint1115930551149180
backgroundConnect24155982738
firstReactRender1492941722
initialActions102111
loadScripts68056799097754861
setupStore1163951120
numNetworkReqs231598221588
WebpackPower User HomeuiStartup1314879199421313891788
load76264811451107641051
domContentLoaded75264311361117541041
domInteractive38171682836105
firstPaint1627648591173332
backgroundConnect18313373484175335
firstReactRender22173842328
initialActions103111
loadScripts74964111251087511032
setupStore1254851319
numNetworkReqs1424628545165202
FirefoxBrowserifyStandard HomeuiStartup15051322223417315301898
load13091139191215013441617
domContentLoaded13071139190715013421617
domInteractive60323004172125
firstPaint------
backgroundConnect5326174225275
firstReactRender12102221216
initialActions103012
loadScripts12821116181713913191591
setupStore1365481332
numNetworkReqs241291211784
BrowserifyPower User HomeuiStartup28432154456940629493696
load16081331325029916522062
domContentLoaded16071331325029916482062
domInteractive181491830223185612
firstPaint------
backgroundConnect3801201166262476947
firstReactRender2114171161927
initialActions102122
loadScripts15591304321328916052025
setupStore1728806213225685
numNetworkReqs914520031106152
WebpackStandard HomeuiStartup16581423218114717201961
load14351219170010415041610
domContentLoaded14341218170010515041610
domInteractive952931158132194
firstPaint------
backgroundConnect59261652864114
firstReactRender14112521518
initialActions103122
loadScripts14091203167110214791587
setupStore156163211234
numNetworkReqs231386171773
WebpackPower User HomeuiStartup27412111382633429343267
load16041325262224116572177
domContentLoaded16041319262124116572176
domInteractive200501095210207712
firstPaint------
backgroundConnect3031271250195369690
firstReactRender22166972433
initialActions214122
loadScripts15681303258924116182145
setupStore13818781168135607
numNetworkReqs93392213992199
📊 Page Load Benchmark Results

Current Commit: e5caae2 | Date: 2/18/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 971ms (±76ms) 🟢 | historical mean value: 1.03s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 688ms (±73ms) 🟢 | historical mean value: 726ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±12ms) 🟢 | historical mean value: 82ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 971ms 76ms 927ms 1.34s 1.21s 1.34s
domContentLoaded 688ms 73ms 650ms 1.04s 908ms 1.04s
firstPaint 77ms 12ms 60ms 184ms 84ms 184ms
firstContentfulPaint 77ms 12ms 60ms 184ms 84ms 184ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: 103 Bytes (0%)
  • ui: 5 Bytes (0%)
  • common: 20 Bytes (0%)

@FrederikBolding FrederikBolding added this pull request to the merge queue Feb 18, 2026
Merged via the queue into main with commit a741bb1 Feb 18, 2026
177 checks passed
@FrederikBolding FrederikBolding deleted the fb/reject-approvals-only-if-subject-has-caip25 branch February 18, 2026 13:14
@github-actions github-actions bot locked and limited conversation to collaborators Feb 18, 2026
@metamaskbot metamaskbot added the release-13.20.0 Issue or pull request that will be included in release 13.20.0 label Feb 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template release-13.20.0 Issue or pull request that will be included in release 13.20.0 size-XS team-core-platform Core Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Uncaught (in promise) n.EthereumProviderError: User rejected the request.when adding Cosmos wallet

6 participants