-
Notifications
You must be signed in to change notification settings - Fork 637
fix: Recover missing permissions for preinstalled Snaps #3775
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3775 +/- ##
==========================================
+ Coverage 98.28% 98.29% +0.01%
==========================================
Files 420 420
Lines 12211 12232 +21
Branches 1889 1897 +8
==========================================
+ Hits 12002 12024 +22
+ Misses 209 208 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| () => ({}), | ||
| ); | ||
|
|
||
| rootMessenger.registerActionHandler( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes to some tests that were improperly emulating the PermissionController and would cause the permissions re-sync when unnecessary
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Patch to bring in the changes from: #23976 / MetaMask/snaps#3775 to the RC, which fixes a production issue preventing Snaps from executing properly due to a persistence bug. The patch was created by building the main Snaps branch locally and copying over the SnapController files. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Switches @metamask/snaps-controllers to a Yarn patch and updates yarn.lock accordingly. > > - **Dependencies**: > - Switch `@metamask/[email protected]` to a Yarn patch reference in `package.json`. > - Update `yarn.lock` to resolve the patched package (new entries/resolutions and checksums). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8a44c10. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: sethkfman <[email protected]>
Due to a bug in the mobile client, some users may have preinstalled Snaps with out-of-sync permissions (or no permissions at all). This PR implements mitigation that checks the permissions for every preinstalled Snap during initialization and re-grants / re-revokes any out-of-sync permissions.
Note
Validates and automatically restores out-of-sync permissions for preinstalled Snaps at init, updating subject metadata and adding targeted tests.
PermissionController:grantPermissions/revokePermissionsand refreshes metadata withSubjectMetadataController:addSubjectMetadata(icon recovered from preinstalled files when available).grantPermissionsand adjusted expectations (call orders, lifecycle hooks indices).clearStateflow tests to revoke all permissions and verify re-grant on reinstallation of preinstalled snaps.Written by Cursor Bugbot for commit a37a0ce. This will update automatically on new commits. Configure here.