Move snap_manageAccounts to a gated permitted method#2869
Draft
GuillaumeRx wants to merge 11 commits intomainfrom
Draft
Move snap_manageAccounts to a gated permitted method#2869GuillaumeRx wants to merge 11 commits intomainfrom
snap_manageAccounts to a gated permitted method#2869GuillaumeRx wants to merge 11 commits intomainfrom
Conversation
Member
|
I don't think we can do this without a breaking change. Snaps may still request the permission which will no longer exist, and it also exists in the permission controller state for existing Snaps. |
Mrtenz
reviewed
Oct 31, 2024
Contributor
Author
@Mrtenz I'm working on a migration on the extension side and a fix in the snap side :) This should probably be a draft. |
c2a0010 to
d781570
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2869 +/- ##
==========================================
+ Coverage 94.48% 94.57% +0.09%
==========================================
Files 487 487
Lines 10427 10442 +15
Branches 1598 1600 +2
==========================================
+ Hits 9852 9876 +24
+ Misses 575 566 -9 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves the
snap_manageAccountsmethod from a restricted method to a permitted method.This allows us to couple it with the
Keyringendowment. The implementation checks if the snap has the permission to use the Keyring and throws if not.This also refactors how the message is passed to the snap. The keyring will now be retrieved on the hook implementation and we will only expose a mutated version of
handleKeyringSnapMessagewhere we will bind the origin coming from the RPC engine to the method hook. This ensures we don't manipulate the origin inside the method implementation.Fixes: #2798