-
Notifications
You must be signed in to change notification settings - Fork 637
fix: Keep dynamic permissions on update #3726
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
| @@ -1,5 +1,5 @@ | |||
| { | |||
| "branches": 94.87, | |||
| "branches": 94.77, | |||
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.
The ?? [] branch is not covered, but it's not easy to do without adding mock data to DYNAMIC_PERMISSION_DEPENDENCIES.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3726 +/- ##
=======================================
Coverage 98.27% 98.28%
=======================================
Files 418 418
Lines 12146 12158 +12
Branches 1875 1877 +2
=======================================
+ Hits 11937 11949 +12
Misses 209 209 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This fixes a bug where dynamic permissions would be revoked when updating a Snap. For example, if a Snap dynamically requested accounts through the
endowment:caip25permission, that permission would be deemed unused, since the Snap can't request it in the manifest.To solve it, I've added some logic that checks if dynamic permissions are present in the old permissions, checks if the desired permissions has at least one of the "dependencies" of the dynamic permission (e.g.,
endowment:caip25requiresendowment:ethereum-providerto be useful), and adds it back to the desired permissions.Note
Ensures dynamic permissions persist on Snap update when dependencies remain requested, and are revoked when none are used.
#getDesiredPermissionsto retain dynamic permissions if any dependency inDYNAMIC_PERMISSION_DEPENDENCIESis still desired.#calculatePermissionsChangeto use desired permissions including dynamic ones; adjust unused/new permissions logic.DYNAMIC_PERMISSION_DEPENDENCIESmapping (e.g.,endowment:caip25→endowment:ethereum-provider).coverage.json.Written by Cursor Bugbot for commit 0ee3f2a. This will update automatically on new commits. Configure here.