snaps icon indicating copy to clipboard operation
snaps copied to clipboard

Add Dynamic Permissions

Open david0xd opened this issue 2 years ago • 2 comments

This PR adds new RPC methods used to support dynamic permissions.

Fixes: https://github.com/MetaMask/snaps/issues/1821

Dynamic Permissions feature is specified in SIP-14.

Related metamask-extension PR: https://github.com/MetaMask/metamask-extension/pull/22878

Summary of changes in this PR

RPC Methods

Three new RPC methods are added to enable Dynamic Permissions feature functionality:

  1. snap_requestPermissions
  2. snap_getPermissions
  3. snap_revokePermissions

All RPC methods added are following naming convention proposed in SIP-14.

Manifest

dynamicPermissions field is added to the manifest. New structure DynamicPermissionsStruct is added to the manifest validation process and refined to follow the validation requirements proposed in the SIP-14.

Snap Controller

  • Snap controller logic for allowlist requirements is updated to handle dynamic permissions in the same way as the initial permissions are handled.

david0xd avatar Jan 11 '24 12:01 david0xd

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.73%. Comparing base (a0bdc87) to head (26562b8). Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2088      +/-   ##
==========================================
+ Coverage   96.60%   96.73%   +0.12%     
==========================================
  Files         337      340       +3     
  Lines        7610     7693      +83     
  Branches     1180     1198      +18     
==========================================
+ Hits         7352     7442      +90     
+ Misses        258      251       -7     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 24 '24 13:01 codecov[bot]

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

socket-security[bot] avatar Jan 24 '24 15:01 socket-security[bot]