Skip to content

Conversation

@V00D00-child
Copy link
Member

@V00D00-child V00D00-child commented Dec 15, 2025

Explanation

This PR extends the GatorPermissionsController to allow attaching metadata when submitting a revocation to the permission provider snap. Metadata includes:

  • The transaction hash
  • The block timestamp

References

Requires(gator snap): feat: Store metadata when revoking a permission
Required by(MM client): chore: Bump @metamask/gator-permissions-controller to 0.9.0

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

BREAKING: Enables attaching metadata to permission revocations and requires it in API.

  • GatorPermissionsController now submits revocationMetadata (includes txHash when available) with permissionsProvider_submitRevocation; captured on transactionConfirmed in addPendingRevocation
  • RevocationParams updated to require revocationMetadata; new RevocationMetadata type added and exported; index exports updated
  • Tests updated to assert metadata is sent (with txHash or undefined) and that permissions refresh still occurs post-revocation
  • Changelog updated; bumps @metamask/transaction-controller patch version

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

@V00D00-child V00D00-child changed the title [DRAFT] Attach metadata when submitting a revocation to the permission provider snap feat: Attach metadata when submitting a revocation to the permission provider snap Dec 17, 2025
@V00D00-child V00D00-child marked this pull request as ready for review December 17, 2025 22:26
@V00D00-child V00D00-child requested review from a team as code owners December 17, 2025 22:26
Copy link
Contributor

@jeffsmale90 jeffsmale90 left a comment

Choose a reason for hiding this comment

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

Should we also add revocationMetadata to StoredGatorPermission (and as per my comments on the related PR, perhaps remove the isRevoked flag?

This would probably require some changes to how we load the permission from storage also, but IMO worthwhile,

Copy link
Contributor

@jeffsmale90 jeffsmale90 left a comment

Choose a reason for hiding this comment

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

Looks good to me!

One nit that I'm not especially concerned about, but might be a nice tidy up.

I am keen to understand the behaviour regarding failed transactions - we definitely don't want to be marking a permission as revoked if the transaction has failed.

// Handle confirmed transaction - submit revocation
handlers.confirmed = (transactionMeta) => {
if (transactionMeta.id === txId) {
controllerLog('Transaction confirmed, submitting revocation', {
Copy link
Contributor

Choose a reason for hiding this comment

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

not strictly related to this PR - but do we need to check transactionMeta.status here?

When a transaction is confirmed, do we explicitly guard against failed transactions?

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

const { hash } = transactionMeta;
const revocationMetadata: RevocationMetadata = {
txHash: hash as Hex | undefined,
};
Copy link

Choose a reason for hiding this comment

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

Metadata object contains undefined key instead of being empty

Medium Severity

When transactionMeta.hash is undefined, the revocationMetadata object is created as { txHash: undefined } rather than {}. The test at line 1223 expects revocationMetadata: {} when no hash is provided, but the implementation always includes the txHash key even when undefined. These two object shapes are not equal in Jest's deep equality check (Object.keys({ txHash: undefined }) yields ['txHash'], while Object.keys({}) yields []). The snap receiving this data may also treat a present-but-undefined property differently from an absent property.

Fix in Cursor Fix in Web

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.

4 participants