Skip to content

fix: revoke the entire session on connect-evm disconnect - #344

Open
adonesky1 wants to merge 2 commits into
mainfrom
fix/connect-evm-full-session-revoke
Open

fix: revoke the entire session on connect-evm disconnect#344
adonesky1 wants to merge 2 commits into
mainfrom
fix/connect-evm-full-session-revoke

Conversation

@adonesky1

Copy link
Copy Markdown
Contributor

Summary

Make connect-evm's disconnect() revoke the entire session instead of only its eip155:* scopes, so scopes granted beyond the client's request don't get stranded in a session the wallet still reports as connected.

Problem

disconnect() filters the session scopes to eip155:* and passes only those to wallet_revokeSession. The wallet's revoke handler does a partial revocation when scopes are specified and keeps the permission alive while any accounts remain on other scopes.

The wallet can grant more than the client requested: for EIP-1193 compatible connections it pre-selects all of the user's enabled networks on the connect prompt (see fix: pre-select all networks for eip1193-compatible requests), so a single approval can include Solana, Bitcoin, and Tron scopes alongside the requested EVM chains. No client on the page is responsible for revoking those extras:

  • connect-evm revokes only eip155:*
  • the Solana Wallet Standard wallet revokes only solana:*
  • nothing revokes bip122:* / tron:*

Net effect (reproduced while testing the extension PR above on app.uniswap.org): after the dapp's disconnect flow runs, the wallet still shows the site as connected, with Bitcoin and Tron listed as connected networks, and the user can only fully disconnect from inside the wallet UI.

Solution

Call core.disconnect() with no scope filter. The transport sends wallet_revokeSession with empty scopes, which the wallet treats as "revoke the whole session".

This matches the legacy EIP-1193 behavior this client emulates: wagmi's injected disconnect calls wallet_revokePermissions, which revokes the origin's entire CAIP-25 permission, over-granted scopes included. That symmetry (broad grant, broad revoke) is why stranded scopes were never an issue before the migration to scoped revocation.

Risk

A dapp that manages its EVM and Solana connections independently and expects connect-evm.disconnect() to leave a concurrent Solana connection intact will now see the full session revoked (the Solana client is notified via wallet_sessionChanged, so its state stays consistent). This is the pre-migration behavior of the injected flow, and we're not aware of a dapp relying on the scoped behavior; flagging it in case reviewers know of one.

@adonesky1
adonesky1 marked this pull request as ready for review August 6, 2026 20:12
@adonesky1
adonesky1 requested a review from a team as a code owner August 6, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant