Skip to content

Commit 93fe233

Browse files
ffmcgee725jeffsmale90
authored andcommitted
fix: existing EVM permissions removed when a Solana Wallet Standard connection is rejected (#36283)
<!-- 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** When a dapp connects to MetaMask via EVM and the user *rejects a subsequent connection request for SVM*, the *existing EVM connection is closed*. This can potentially break dapp flows and edge cases where maintaining the EVM connection is critical. To fix this, we implemented partial revoking into the `wallet_revokeSession` handler on MetaMask/core#6668 so that we can then update our solana wallet-standard provider would only revoke the solana scopes when it is asked to disconnect, here MetaMask/solana-wallet-standard#53. This PR bumps all necessary packages for this to take place, fixing the undesired EVM permissions revoke when a solana wallet standard connection is refused. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/36283?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: Fixes existing EVM permissions removed when a Solana Wallet Standard connection is rejected ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/WAPI-413 ## **Manual testing steps** 1. Go to https://orca.so 2. On dev tools console, call `window.ethereum.enable()` 3. Proceed with permission (make sure _NO PERMISSIONS for Solana are checked_) and confirm 4. Click "Connect Wallet" button, choose "MetaMask" and proceed. 5. When wallet UI prompts to accept connection, click "Cancel" button. 6. Now, on dev tools console, call ``` await window.ethereum.request({ "method": "wallet_getPermissions", "params": [], }); ``` 7. Permission for `eth_accounts` should still be present with the permitted account in `caveats` array. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/77026a60-03e1-4293-ad8a-25f9c9c5056d ### **After** https://github.com/user-attachments/assets/e4bca63c-3e21-4736-88fc-6d35f723d90a ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] 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.
1 parent 572ff11 commit 93fe233

File tree

3 files changed

+80
-35
lines changed

3 files changed

+80
-35
lines changed

app/scripts/metamask-controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7305,6 +7305,10 @@ export default class MetamaskController extends EventEmitter {
73057305
this.permissionController,
73067306
origin,
73077307
),
7308+
updateCaveat: this.permissionController.updateCaveat.bind(
7309+
this.permissionController,
7310+
origin,
7311+
),
73087312
getSelectedNetworkClientId: () =>
73097313
this.networkController.state.selectedNetworkClientId,
73107314
revokePermissionForOrigin:

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@
322322
"@metamask/message-signing-snap": "1.1.3",
323323
"@metamask/metamask-eth-abis": "^3.1.1",
324324
"@metamask/multichain-account-service": "^1.0.0",
325-
"@metamask/multichain-api-client": "^0.6.5",
326-
"@metamask/multichain-api-middleware": "1.0.0",
325+
"@metamask/multichain-api-client": "^0.7.0",
326+
"@metamask/multichain-api-middleware": "1.1.0",
327327
"@metamask/multichain-network-controller": "^1.0.0",
328328
"@metamask/multichain-transactions-controller": "^5.0.0",
329329
"@metamask/name-controller": "^8.0.3",
@@ -356,7 +356,7 @@
356356
"@metamask/snaps-sdk": "^9.3.0",
357357
"@metamask/snaps-utils": "^11.5.0",
358358
"@metamask/solana-wallet-snap": "^2.4.0",
359-
"@metamask/solana-wallet-standard": "^0.5.1",
359+
"@metamask/solana-wallet-standard": "^0.6.0",
360360
"@metamask/streams": "^0.4.0",
361361
"@metamask/subscription-controller": "^0.1.0",
362362
"@metamask/transaction-controller": "^60.2.0",

yarn.lock

Lines changed: 73 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5648,18 +5648,18 @@ __metadata:
56485648
languageName: node
56495649
linkType: hard
56505650

5651-
"@metamask/chain-agnostic-permission@npm:^1.0.0, @metamask/chain-agnostic-permission@npm:^1.1.0":
5652-
version: 1.1.0
5653-
resolution: "@metamask/chain-agnostic-permission@npm:1.1.0"
5651+
"@metamask/chain-agnostic-permission@npm:^1.1.0, @metamask/chain-agnostic-permission@npm:^1.1.1":
5652+
version: 1.1.1
5653+
resolution: "@metamask/chain-agnostic-permission@npm:1.1.1"
56545654
dependencies:
56555655
"@metamask/api-specs": "npm:^0.14.0"
5656-
"@metamask/controller-utils": "npm:^11.11.0"
5657-
"@metamask/network-controller": "npm:^24.0.1"
5656+
"@metamask/controller-utils": "npm:^11.12.0"
5657+
"@metamask/network-controller": "npm:^24.1.0"
56585658
"@metamask/permission-controller": "npm:^11.0.6"
56595659
"@metamask/rpc-errors": "npm:^7.0.2"
56605660
"@metamask/utils": "npm:^11.4.2"
56615661
lodash: "npm:^4.17.21"
5662-
checksum: 10/5df177551538f200933f471f66c874633cc8dfc9b1dff975f3643b985719e6e8d69a966d1b4dd510d22ad5e9dde5326560ab8995dbd915c402c97d27ee10a749
5662+
checksum: 10/fc9bb730c97c100c23fa0f0ffb1e07c929196b4b3408d77699d38e5810d1103bda7f73c7787601e32bf32e126be66651637ed21e2c170b58d2805f052622e082
56635663
languageName: node
56645664
linkType: hard
56655665

@@ -6097,6 +6097,19 @@ __metadata:
60976097
languageName: node
60986098
linkType: hard
60996099

6100+
"@metamask/eth-json-rpc-provider@npm:^5.0.0":
6101+
version: 5.0.0
6102+
resolution: "@metamask/eth-json-rpc-provider@npm:5.0.0"
6103+
dependencies:
6104+
"@metamask/json-rpc-engine": "npm:^10.1.0"
6105+
"@metamask/rpc-errors": "npm:^7.0.2"
6106+
"@metamask/safe-event-emitter": "npm:^3.0.0"
6107+
"@metamask/utils": "npm:^11.8.0"
6108+
uuid: "npm:^8.3.2"
6109+
checksum: 10/b09a4c06bf570c09b045583733ba2cf5047937e84d42b4c13f8b6a1e39acae083f032aed16c17b37dd4b86cab16f6e52b0ba788d4f3a63c4301a614d69cad937
6110+
languageName: node
6111+
linkType: hard
6112+
61006113
"@metamask/eth-ledger-bridge-keyring@npm:11.1.2":
61016114
version: 11.1.2
61026115
resolution: "@metamask/eth-ledger-bridge-keyring@npm:11.1.2"
@@ -6419,14 +6432,14 @@ __metadata:
64196432
languageName: node
64206433
linkType: hard
64216434

6422-
"@metamask/json-rpc-engine@npm:^10.0.0, @metamask/json-rpc-engine@npm:^10.0.2, @metamask/json-rpc-engine@npm:^10.0.3":
6423-
version: 10.0.3
6424-
resolution: "@metamask/json-rpc-engine@npm:10.0.3"
6435+
"@metamask/json-rpc-engine@npm:^10.0.0, @metamask/json-rpc-engine@npm:^10.0.2, @metamask/json-rpc-engine@npm:^10.0.3, @metamask/json-rpc-engine@npm:^10.1.0":
6436+
version: 10.1.0
6437+
resolution: "@metamask/json-rpc-engine@npm:10.1.0"
64256438
dependencies:
64266439
"@metamask/rpc-errors": "npm:^7.0.2"
64276440
"@metamask/safe-event-emitter": "npm:^3.0.0"
6428-
"@metamask/utils": "npm:^11.1.0"
6429-
checksum: 10/0558f511aada9bfb13d3b55f6a834543431cc6148a681d3a2885f6171fefbcf092ea4aabc7bbb547de6fdf382cdaf6a73ca5175c63c2d1b6560f763b4b37162e
6441+
"@metamask/utils": "npm:^11.8.0"
6442+
checksum: 10/af41cd52074286e1d82917cc41b65954f79d96158c70c7426f89c572f9178b31c674658b6079f13df22a47d9d7743ddcfa8180df6e6cbabc30d848a172186d32
64306443
languageName: node
64316444
linkType: hard
64326445

@@ -6780,29 +6793,29 @@ __metadata:
67806793
languageName: node
67816794
linkType: hard
67826795

6783-
"@metamask/multichain-api-client@npm:^0.6.5":
6784-
version: 0.6.5
6785-
resolution: "@metamask/multichain-api-client@npm:0.6.5"
6786-
checksum: 10/2a3d72f2784b94f3d0eae5e3ecc60a61e6fb0d7da92808242ddf5eb58669abdacfc44e483cb28e3b6928987260b0be528fbc7bed7bd600fbe3f00cc74d72bd7a
6796+
"@metamask/multichain-api-client@npm:^0.7.0":
6797+
version: 0.7.0
6798+
resolution: "@metamask/multichain-api-client@npm:0.7.0"
6799+
checksum: 10/82c58ba382d651430cc27c15c1881ac9943131aebd66b1e404735795bcc4125cb20b74843504ffd207ba9e8c21272facfcd65a91c6f16846bf1aee4e83ed1fca
67876800
languageName: node
67886801
linkType: hard
67896802

6790-
"@metamask/multichain-api-middleware@npm:1.0.0":
6791-
version: 1.0.0
6792-
resolution: "@metamask/multichain-api-middleware@npm:1.0.0"
6803+
"@metamask/multichain-api-middleware@npm:1.1.0":
6804+
version: 1.1.0
6805+
resolution: "@metamask/multichain-api-middleware@npm:1.1.0"
67936806
dependencies:
67946807
"@metamask/api-specs": "npm:^0.14.0"
6795-
"@metamask/chain-agnostic-permission": "npm:^1.0.0"
6796-
"@metamask/controller-utils": "npm:^11.10.0"
6797-
"@metamask/json-rpc-engine": "npm:^10.0.3"
6798-
"@metamask/network-controller": "npm:^24.0.0"
6808+
"@metamask/chain-agnostic-permission": "npm:^1.1.1"
6809+
"@metamask/controller-utils": "npm:^11.14.0"
6810+
"@metamask/json-rpc-engine": "npm:^10.1.0"
6811+
"@metamask/network-controller": "npm:^24.2.0"
67996812
"@metamask/permission-controller": "npm:^11.0.6"
68006813
"@metamask/rpc-errors": "npm:^7.0.2"
6801-
"@metamask/utils": "npm:^11.2.0"
6814+
"@metamask/utils": "npm:^11.8.0"
68026815
"@open-rpc/meta-schema": "npm:^1.14.6"
68036816
"@open-rpc/schema-utils-js": "npm:^2.0.5"
68046817
jsonschema: "npm:^1.4.1"
6805-
checksum: 10/65b9ba7047bf2e6222d01a72fda65164d2ce393a254ccbc9c7ce74716f7e8962f53f2815fdd3330b57798a7a71ccb15275257cd65958422e753fc515ca78e496
6818+
checksum: 10/b9079aa1a59e397e5991bbbe5acaa826a7bba1c7ed2f090be71568d63e9e06cb6fefe7dea6d87d7eac008b80b7e6aee5c29c454155e2e0791ba31bcd41c43c27
68066819
languageName: node
68076820
linkType: hard
68086821

@@ -6859,7 +6872,7 @@ __metadata:
68596872
languageName: node
68606873
linkType: hard
68616874

6862-
"@metamask/network-controller@npm:24.1.0, @metamask/network-controller@npm:^24.0.0, @metamask/network-controller@npm:^24.0.1":
6875+
"@metamask/network-controller@npm:24.1.0":
68636876
version: 24.1.0
68646877
resolution: "@metamask/network-controller@npm:24.1.0"
68656878
dependencies:
@@ -6887,6 +6900,34 @@ __metadata:
68876900
languageName: node
68886901
linkType: hard
68896902

6903+
"@metamask/network-controller@npm:^24.1.0, @metamask/network-controller@npm:^24.2.0":
6904+
version: 24.2.0
6905+
resolution: "@metamask/network-controller@npm:24.2.0"
6906+
dependencies:
6907+
"@metamask/base-controller": "npm:^8.4.0"
6908+
"@metamask/controller-utils": "npm:^11.14.0"
6909+
"@metamask/eth-block-tracker": "npm:^12.0.1"
6910+
"@metamask/eth-json-rpc-infura": "npm:^10.2.0"
6911+
"@metamask/eth-json-rpc-middleware": "npm:^17.0.1"
6912+
"@metamask/eth-json-rpc-provider": "npm:^5.0.0"
6913+
"@metamask/eth-query": "npm:^4.0.0"
6914+
"@metamask/json-rpc-engine": "npm:^10.1.0"
6915+
"@metamask/rpc-errors": "npm:^7.0.2"
6916+
"@metamask/swappable-obj-proxy": "npm:^2.3.0"
6917+
"@metamask/utils": "npm:^11.8.0"
6918+
async-mutex: "npm:^0.5.0"
6919+
fast-deep-equal: "npm:^3.1.3"
6920+
immer: "npm:^9.0.6"
6921+
loglevel: "npm:^1.8.1"
6922+
reselect: "npm:^5.1.1"
6923+
uri-js: "npm:^4.4.1"
6924+
uuid: "npm:^8.3.2"
6925+
peerDependencies:
6926+
"@metamask/error-reporting-service": ^2.0.0
6927+
checksum: 10/a2b5dcd0a2d8e75692b889b13189645a10f026bc22063b29a1b8563456feb9bac982a47b48e02bbbb50f8de3d2bc1fb32f681f05b582d4b1bdd0240f4371db1a
6928+
languageName: node
6929+
linkType: hard
6930+
68906931
"@metamask/network-controller@patch:@metamask/network-controller@npm%3A24.1.0#~/.yarn/patches/@metamask-network-controller-npm-24.0.1-d913bfdf67.patch":
68916932
version: 24.1.0
68926933
resolution: "@metamask/network-controller@patch:@metamask/network-controller@npm%3A24.1.0#~/.yarn/patches/@metamask-network-controller-npm-24.0.1-d913bfdf67.patch::version=24.1.0&hash=b82720"
@@ -7554,17 +7595,17 @@ __metadata:
75547595
languageName: node
75557596
linkType: hard
75567597

7557-
"@metamask/solana-wallet-standard@npm:^0.5.1":
7558-
version: 0.5.1
7559-
resolution: "@metamask/solana-wallet-standard@npm:0.5.1"
7598+
"@metamask/solana-wallet-standard@npm:^0.6.0":
7599+
version: 0.6.0
7600+
resolution: "@metamask/solana-wallet-standard@npm:0.6.0"
75607601
dependencies:
75617602
"@solana/wallet-standard-chains": "npm:^1.1.1"
75627603
"@solana/wallet-standard-features": "npm:^1.3.0"
75637604
"@wallet-standard/base": "npm:^1.1.0"
75647605
"@wallet-standard/features": "npm:^1.1.0"
75657606
"@wallet-standard/wallet": "npm:^1.1.0"
75667607
bs58: "npm:^6.0.0"
7567-
checksum: 10/fed23c9507896c67a2efb3b55c26872c6d9172eb662a1ecbe081d8f78fa56d3393f59b3997726ccb459e026c04163354d30ca8d05e4b3f431026889878a1c3ba
7608+
checksum: 10/5a04227ed51ce27ffd24d691ba4f4136f07a77c04a79eed1f6eb883c9b98e3be7cdf5527833a8af1e1530936b581f74bb7dd6ba18019346939c77498f3c70ff4
75687609
languageName: node
75697610
linkType: hard
75707611

@@ -32106,8 +32147,8 @@ __metadata:
3210632147
"@metamask/message-signing-snap": "npm:1.1.3"
3210732148
"@metamask/metamask-eth-abis": "npm:^3.1.1"
3210832149
"@metamask/multichain-account-service": "npm:^1.0.0"
32109-
"@metamask/multichain-api-client": "npm:^0.6.5"
32110-
"@metamask/multichain-api-middleware": "npm:1.0.0"
32150+
"@metamask/multichain-api-client": "npm:^0.7.0"
32151+
"@metamask/multichain-api-middleware": "npm:1.1.0"
3211132152
"@metamask/multichain-network-controller": "npm:^1.0.0"
3211232153
"@metamask/multichain-transactions-controller": "npm:^5.0.0"
3211332154
"@metamask/name-controller": "npm:^8.0.3"
@@ -32142,7 +32183,7 @@ __metadata:
3214232183
"@metamask/snaps-sdk": "npm:^9.3.0"
3214332184
"@metamask/snaps-utils": "npm:^11.5.0"
3214432185
"@metamask/solana-wallet-snap": "npm:^2.4.0"
32145-
"@metamask/solana-wallet-standard": "npm:^0.5.1"
32186+
"@metamask/solana-wallet-standard": "npm:^0.6.0"
3214632187
"@metamask/streams": "npm:^0.4.0"
3214732188
"@metamask/subscription-controller": "npm:^0.1.0"
3214832189
"@metamask/superstruct": "npm:^3.2.1"

0 commit comments

Comments
 (0)