MetaMask / MetaMask/core

Add "incremental" permission revocation and caveat "subtraction"

Open
#4,236 0 comments 0 reactions 1 assignee Claimed by @rekmarks View on GitHub
team-wallet-framework wf-permission-controller-improvements
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

Following the closure of #4163 (#4222), we will have introduced a notion of "caveat merging" and incremental permission requests to the permission controller. Call this "additive permission requests". To complete the picture, we of course need to add the inverse operation, i.e. "_subtractive_ permission requests" or "incremental revocation". (Really, "incremental" is not an ideal word for this—"partial", anyone?—but since we have already designated "revoke" as the inverse of "request"... here we are.)

Here's a sketch of how this will work:
- The caller specifies caveat values for a set of permissions that they would like to revoke.
- The permission controller only attempts to delete these caveat values, nothing else.
- Each caveat specification will include a new property, tentatively named `subtractor`, where consumers have to specify how incremental revocation will work for their caveat.
- We can potentially reuse the `CaveatMutatorOperation` conceit for this.
- If the caveat is "emptied" by this operation, it is deleted.
- It'll probably be the subtractor's responsibility to determine if a caveat is empty, but TBD.
- If validation fails after revocation, the request rejects.
- If a permission is specified without naming any caveats, the whole permission will be revoked.
- Maybe we'll do something more explicit like `{ wallet_foo: '*' }` to signal that the whole thing should go, but TBD.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.