Skip to content
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

Hide PermissionController state from third parties #4239

Open
rekmarks opened this issue May 1, 2024 · 2 comments
Open

Hide PermissionController state from third parties #4239

rekmarks opened this issue May 1, 2024 · 2 comments
Labels
barad-dur enhancement New feature or request PermissionController Related to the PermissionController. team-wallet-api-platform

Comments

@rekmarks
Copy link
Member

rekmarks commented May 1, 2024

When successful, wallet_getPermissions and wallet_requestPermissions both return the current permissions for the requesting subject, which is a subset of the permission controller's state. This is very unfortunate, because it means that we are externalizing the state of an otherwise internal module, and makes changes to its state breaking changes of our public API. In preparation for the introduction of a multichain API and its new permissions (see #4241), we should introduce an adapter function between the permission controller at the RPC methods that return its state.

This adapter function should take the permission controller state and return a public representation thereof, perhaps modeled on what we already do for Snaps manifest permissions. We can then ship this public state representation as part of our API, and do whatever we want with our internal state. This public representation should focus on what's strictly necessary for the consumer to understand the authority they've been granted, and nothing more. In particular, it should not contain any ZCAP-LD properties or make mention of caveats, all of which we should regard as implementation details.

Complication: window.ethereum

Of course, we have already shipped our current internal state via window.ethereum (and potentially the Snaps provider). The adapter must be written such that, for interfaces that support wallet_getPermissions and wallet_requestPermissions they return the same state that they do today, unmodified. If necessary, they can support newly introduced permissions as well, but we cannot break this APIs for existing consumers, and especially consumers of window.ethereum.

@vandan
Copy link

vandan commented May 16, 2024

Hey team! Please add your planning poker estimate with Zenhub @adonesky1 @BelfordZ @shanejonas

@vandan
Copy link

vandan commented May 16, 2024

Migration should also be addressed along with this change: https://github.com/MetaMask/MetaMask-planning/issues/2530

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
barad-dur enhancement New feature or request PermissionController Related to the PermissionController. team-wallet-api-platform
Projects
None yet
Development

No branches or pull requests

3 participants