Skip to content

Conversation

@jeffsmale90
Copy link
Contributor

Explanation

The method decodePermissionFromPermissionContextForOrigin was incorrectly implemented as a synchronous function. This change updates this function and related tests to be synchronous.

Because this function has not yet been released, this is not being considered a breaking change.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@jeffsmale90 jeffsmale90 requested review from a team as code owners September 18, 2025 23:56
@jeffsmale90 jeffsmale90 force-pushed the gator-permissions-controller-sync-decoding branch from e53f4e2 to 1143dfa Compare September 19, 2025 00:11
Copy link

@mj-kiwi mj-kiwi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeffsmale90 jeffsmale90 merged commit 9bc3858 into main Sep 19, 2025
238 checks passed
@jeffsmale90 jeffsmale90 deleted the gator-permissions-controller-sync-decoding branch September 19, 2025 00:56
aganglada pushed a commit that referenced this pull request Sep 24, 2025
…onous (#6656)

## Explanation

The method `decodePermissionFromPermissionContextForOrigin` was
incorrectly implemented as a synchronous function. This change updates
this function and related tests to be synchronous.

Because this function has not yet been released, this is not being
considered a breaking change.

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Sep 25, 2025
…ded permission (#36054)

## **Description**


This feature is only enabled in Flask.

When a dapp requests an EIP-7715 Readable Permission, the user must sign
with `eth_signTypedData_v4`, but it's important that the user can
understand what is being signed. This PR surfaced the decoded permission
information in a new Sign Permission view.

When a `eth_signTypedData_v4` request is received by
`@metamask/signature-controller` that appears to be a delegation, it
will pass this request to `@metamask/gator-permissions-controller` to
decode the request into the originating permission. If this is
successful, `@metamask/signature-controller` attaches the decoded
permission to the request `metadata`.

This PR adds a new view showing the details of the permission that the
user is signing. This does not implement the final design, and focusses
only on introducing the functionality to extension. Further iteration
will be made to improve the UX. As such, no internationalization has
been included in this change.

A couple important points to note:
- if `GATOR_PERMISSIONS_ENABLED` is not true, the request will be
rejected here (this should never happen, because the method
`wallet_requestExecutionPermissions` will not allow requests if the
feature is not enabled
- if the origin is not the configured Gator Permissions Snap, the
permission will not be decoded by the `GatorPermissionsController`
- if the request is for a delegation signature, and no permission is
decoded, the SignatureController will reject the request
- This feature is only being released into Flask at this stage - future
PRs will refine the UX before this is released to end-users

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/36054?quickstart=1)

## **Changelog**

CHANGELOG entry: presents a Permission confirmation view when a decoded
permission exists on signTypedData metadata. Flask only.

## **Related issues**

These PRs are related to this feature:
- Introduce GatorPermissionsController to mobile
MetaMask/metamask-mobile#20006
- Decode permissions in SignatureController
MetaMask/core#6619
- Method 'decodePermissionFromPermissionContextForOrigin' is now
synchronous MetaMask/core#6656
- Add `decodePermissionFromPermissionContextForOrigin` to
`GatorPermissionsController` MetaMask/core#6556

## **Manual testing steps**

1. Run the 7715 gator snaps locally
2. Build MetaMask flask with `GATOR_PERMISSIONS_ENABLED=true` and
`GATOR_PERMISSIONS_PROVIDER_SNAP_ID=local:http://localhost:8082`
2. Open the 7715 gator snap page
3. Install snaps if necessary, by clicking "Install kernel snap", then
"Install provider snap"
4. Select the appropriate permission type and parameters
5. Click "Grant Permission"
6. Adjust the requested permission as necessary
7. Click "Grant"

Expect to see the sign permission screen:

## **Screenshots/Recordings**

<img width="396" height="852" alt="image"
src="https://github.com/user-attachments/assets/b45e5a7d-ccaa-4456-be65-4b990bc2ea2d"
/>

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants