Skip to content

Conversation

PR4SAN
Copy link

@PR4SAN PR4SAN commented Oct 18, 2025

Description

Context
When MetaMask is locked after a DApp has been granted permissions, signature requests (such as personal_sign, eth_signTypedData_v3/v4, eth_getEncryptionPublicKey, and eth_decrypt) hang indefinitely without showing any UI prompt or returning an error to the DApp. This leaves the request Promise in a pending state forever, and users have no way to complete or cancel the request.

The root cause is that the SignatureController, DecryptMessageController, and EncryptionPublicKeyController do not check the wallet's lock state before processing requests.

Created unlock-wrapper.ts - A new utility module containing:

withUnlockPrompt(): A generic wrapper function that adds unlock checking to any async function
createUnlockedMethodWrappers(): A factory function that creates wrapped methods bound to AppStateController and KeyringController

Flow after fix:

  • When a DApp calls a signature method while the wallet is locked

    1. The wrapper detects the locked state via keyringController.state.isUnlocked
    2. It calls appStateController.getUnlockPromise(true) to trigger the unlock popup
    3. User unlocks the wallet
    4. The original request proceeds normally
    5. The signature confirmation is shown and the promise resolves
  • When the wallet is already unlocked:

    1. The wrapper detects this immediately and proceeds without delay
    2. No behavior change from current functionality

Changelog

CHANGELOG entry: Fixed hanging signature requests by prompting for unlock when the wallet is locked.

CHANGELOG entry:

Related issues

Fixes: #36800, #36335

Manual testing steps

  1. Go to this page https://metamask.github.io/test-dapp/
  2. Click use MetaMask Provider
  3. Click Connect and approve the connection in MetaMask
  4. After successful connection, lock MetaMask manually
  5. Return to the Test DApp and click Personal Sign
  6. Observe: the request now opens password modal.

Screenshots/Recordings

Before

493838303-f5a9f054-af5f-4907-b24b-3590126426c1.mov

After

Screen.Recording.2025-10-18.at.14.04.31.mp4

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.

Copy link
Contributor

github-actions bot commented Oct 18, 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.

@PR4SAN
Copy link
Author

PR4SAN commented Oct 18, 2025

I have read the CLA Document and I hereby sign the CLA

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Personal Sign request hangs indefinitely when MetaMask is locked

2 participants