-
Notifications
You must be signed in to change notification settings - Fork 563
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
Move snap_manageAccounts
to a gated permitted method
#2869
base: main
Are you sure you want to change the base?
Conversation
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 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:
|
This PR moves the
snap_manageAccounts
method from a restricted method to a permitted method.This allows us to couple it with the
Keyring
endowment. 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
handleKeyringSnapMessage
where 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