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

[Mobile snaps] Update snaps packages to version 2.0.2 #7609

Merged
merged 21 commits into from
Nov 7, 2023

Conversation

owencraston
Copy link
Contributor

@owencraston owencraston commented Oct 25, 2023

Description

Update snaps controller to version 2.0.2.

This also involved updating some of the peer dependancies such as @metamask/slip44, @metamask/snaps-utils", @metamask/rpc-methods.

Updated the snaps permissions titles to include the newer permissions. The list of permissions can be found here.

This changed how snap are installed now...

Before:

  • installing a snap would be would trigger a wallet_installSnap approval. From this point we would parse the approval request data to show the requested permissions. We would then handle the install state internally.

Now:

  • Installing a a snap triggers a wallet_requestPermissions approval type. For this we show the InstallSnapConnectionRequest. Approving this triggers a second approval request of type wallet_installSnap. This is where we show the requested permissions inside the InstallSnapPermissionsRequest. Once approved we show a success/error screen

Since the install logic relies so heavily on the the useApprovalRequest response, I moved all of the install logic from app/components/UI/... into app/components/Approvals/InstallSnapApproval

Related issues

Progresses: https://github.com/MetaMask/accounts-planning/issues/116
Fixes: https://github.com/MetaMask/accounts-planning/issues/115
Fixes: https://github.com/MetaMask/accounts-planning/issues/114

Manual testing steps

  1. build branch
  2. run yarn setup
  3. navigate to browser tab
  4. go to http://metamask.github.io/snaps/test-snaps/1.1.0
  5. install BIP-32 snap
  6. go through approval flow
  7. the snap should be installed
  8. navigate to settings/snaps
  9. the snap should be available in settings
  10. you should be able to preview all of the snaps permissions in the snap settings

Screenshots/Recordings

Screen.Recording.2023-11-06.at.11.39.25.PM.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines).
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

@owencraston owencraston requested a review from a team as a code owner October 25, 2023 23:02
@github-actions
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.

@socket-security
Copy link

socket-security bot commented Oct 25, 2023

@socket-security
Copy link

socket-security bot commented Oct 25, 2023

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: @metamask/[email protected], @metamask/[email protected]

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] bar@* or ignore all packages with @SocketSecurity ignore-all

@owencraston owencraston force-pushed the update-snaps-packages branch from c39f538 to cf7287b Compare November 2, 2023 00:27
@owencraston owencraston force-pushed the update-snaps-packages branch from a2cee87 to 75885d5 Compare November 4, 2023 06:36
@owencraston
Copy link
Contributor Author

@SocketSecurity ignore @metamask/[email protected]

@owencraston
Copy link
Contributor Author

@SocketSecurity ignore @metamask/[email protected]

@owencraston owencraston changed the title [Mobile snaps] Update snaps packages [Mobile snaps] Update snaps packages to version 2.x.x Nov 7, 2023
@owencraston owencraston changed the title [Mobile snaps] Update snaps packages to version 2.x.x [Mobile snaps] Update snaps packages to version 2.0.2 Nov 7, 2023
app/core/Engine.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@Jonathansoufer Jonathansoufer left a comment

Choose a reason for hiding this comment

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

LGTM. Good job and well structure code.

@owencraston owencraston merged commit 49cc2ec into mobile-snaps Nov 7, 2023
@owencraston owencraston deleted the update-snaps-packages branch November 7, 2023 21:55
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants