Skip to content

Conversation

@hanzel98
Copy link

@hanzel98 hanzel98 commented Sep 24, 2025

Explanation

What is the current state of things and why does it need to change?

The GatorPermissionsController currently provides functionality to fetch, enable, disable, and decode gator permissions, but it lacks the ability to revoke permissions. This missing capability prevents MetaMask clients from providing users with a complete permission management experience where they can not only grant permissions but also revoke them when needed.

What is the solution your changes offer and how does it work?

This PR adds a new submitRevocation action to the GatorPermissionsController that allows consumers (MetaMask clients) to submit permission revocations through the gator permissions provider snap. The implementation:

  • Adds a new RevocationParams type that accepts a delegationHash (hex string) to identify the permission to revoke
  • Implements a submitRevocation method that forwards the revocation request to the gator permissions provider snap using the permissionsProvider_submitRevocation RPC method
  • Includes proper error handling using existing error types (GatorPermissionsNotEnabledError and GatorPermissionsProviderError)
  • Added new filter in the function to request the permissions
  • Follows the established patterns in the controller for action registration and snap communication

Are there any changes whose purpose might not obvious to those unfamiliar with the domain?

The delegationHash parameter is a unique identifier for ERC-7715 delegations/permissions that allows the snap to locate and revoke the specific permission. This hash-based approach is standard in the ERC-7715 delegation framework for permission management.

References

[Related to ]
This PR depends on this other PR of the permissions-controller #6713

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

Note: The changelog item should be checked off after updating the CHANGELOG.md file, and the last item can be checked as N/A since this is a new feature addition with no breaking changes.


Note

Adds submitRevocation and addPendingRevocation with transaction event handling, and supports optional filters when fetching permissions.

  • Controller:
    • Add submitRevocation(revocationParams) to forward permissionsProvider_submitRevocation to the Snap with errors surfaced via GatorPermissionsProviderError.
    • Add addPendingRevocation(txId, permissionContext) that listens for TransactionController terminal events and times out after 2h to submit revocations on confirmation.
    • Allow optional params in fetchAndUpdateGatorPermissions and pass through to Snap request.
    • Register new actions and subscribe to transactionConfirmed/Failed/Dropped events.
  • Types/Enums/Exports:
    • Add RevocationParams and PermissionProviderSubmitRevocation to GatorPermissionsSnapRpcMethod.
    • Extend StoredGatorPermission{,Sanitized} with optional isRevoked.
    • Export new actions/events/types from index and controller typings.
  • Tests:
    • Add tests for filtered fetch, submitRevocation, and addPendingRevocation (confirmed/failed/dropped/timeout/error paths).
    • Update messenger allowed events in tests.
  • Docs:
    • README: document filtered fetch usage example.

Written by Cursor Bugbot for commit 68fe787. This will update automatically on new commits. Configure here.

@hanzel98 hanzel98 requested a review from a team as a code owner September 24, 2025 16:32
@hanzel98 hanzel98 self-assigned this Sep 24, 2025
@hanzel98 hanzel98 marked this pull request as draft September 24, 2025 16:40
@hanzel98 hanzel98 force-pushed the chore/revokation-rpc-request branch from de7e505 to 11aa3a1 Compare September 24, 2025 16:43
- Add RevocationParams type with delegationHash field
- Add PermissionProviderSubmitRevocation RPC method enum
- Implement submitRevocation method with proper error handling
- Add comprehensive test suite with 100% coverage
- Export new types in public API

This enables MetaMask clients to submit permission revocations through
the gator permissions provider snap using the permissionsProvider_submitRevocation
RPC method.
@hanzel98 hanzel98 force-pushed the chore/revokation-rpc-request branch from c86dca7 to 1833a20 Compare September 24, 2025 18:47
@hanzel98 hanzel98 force-pushed the chore/revokation-rpc-request branch from 595f36d to 0a44e3c Compare October 14, 2025 03:09
@hanzel98 hanzel98 marked this pull request as ready for review October 26, 2025 01:42
cursor[bot]

This comment was marked as outdated.

@hanzel98 hanzel98 force-pushed the chore/revokation-rpc-request branch from da91f33 to 61b8900 Compare October 26, 2025 01:57
Copy link
Contributor

@MoMannn MoMannn left a comment

Choose a reason for hiding this comment

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

Add changes to CHANGELOG.md under ## [Unreleased].

/**
* Flag indicating whether this permission has been revoked.
*/
isRevoked?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

We talked about also adding the revocationTxHash and revocationTimestamp/date. Is that meant as an update?

* @returns A promise that resolves when the listener is set up.
*/
public async addPendingRevocation(
txId: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

You are using RevocationParams but here you are using seperate inputs. Change this also to PendingRevocationParams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants