Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(22851): check if active device to prevent autoconnect for hw #25503

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

Akaryatrh
Copy link
Contributor

@Akaryatrh Akaryatrh commented Jun 25, 2024

Description

There was an issue where the selected device was kept "unlocked" by keyring controller. Then, the following logic was always redirecting to the selected device "page" and was connecting again to the previously unlocked hardware device:
https://github.com/MetaMask/metamask-extension/blob/develop/ui/pages/create-account/connect-hardware/index.js#L135-L139

      const unlocked = await this.props.checkHardwareStatus(device, path);
      if (unlocked) {
        this.setState({ unlocked: true });
        this.getPage(device, 0, path);
      }

To fix this, I simply checked if a device was active or not. Tested on Ledger, Trezor and QR based wallets

Open in GitHub Codespaces

Related issues

Fixes: #22851

Manual testing steps

  1. From account list, click on "add account or hardware wallet"
  2. then click on "add hardware wallet"
  3. select a hardware wallet
  4. Wait for the pop up for HID access (if you use the Trezor simulator, you can close the pop-up)
  5. Click cancel or select an account (and add it). You should be redirected to device selection.
  6. Click on account
  7. Add hardware wallet
  8. You should now be able to select again the device you want (while before last active device was automatically selected and user redirected to account selection)

Screenshots/Recordings

Before

Enregistrement.de.l.ecran.2024-06-25.a.14.14.10.mov

After

Enregistrement.de.l.ecran.2024-06-25.a.14.09.34.mov

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

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.

@Akaryatrh Akaryatrh marked this pull request as ready for review June 25, 2024 12:19
@Akaryatrh Akaryatrh requested a review from a team as a code owner June 25, 2024 12:19
@metamaskbot
Copy link
Collaborator

Builds ready [712d03e]
Page Load Metrics (132 ± 177 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6410781115
domContentLoaded9211142
load391738132368177
domInteractive9211142
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 19 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.65%. Comparing base (9760248) to head (712d03e).
Report is 9 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #25503   +/-   ##
========================================
  Coverage    69.64%   69.65%           
========================================
  Files         1345     1345           
  Lines        47789    47789           
  Branches     13179    13179           
========================================
+ Hits         33282    33283    +1     
+ Misses       14507    14506    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hjetpoluru hjetpoluru self-requested a review July 9, 2024 17:03
Copy link
Contributor

@hjetpoluru hjetpoluru left a comment

Choose a reason for hiding this comment

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

LGTM

@hjetpoluru hjetpoluru merged commit 4c9abed into develop Jul 17, 2024
70 checks passed
@hjetpoluru hjetpoluru deleted the fix/22851 branch July 17, 2024 23:13
@github-actions github-actions bot locked and limited conversation to collaborators Jul 17, 2024
@metamaskbot metamaskbot added the release-12.3.0 Issue or pull request that will be included in release 12.3.0 label Jul 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.3.0 Issue or pull request that will be included in release 12.3.0 team-hardware-wallets
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Bug]: Metamask keeps trying to connect Ledger device when clicking add hardware wallet
4 participants