Skip to content

feat: add EIP-7702 signature validations - #5470

Merged
matthewwalsh0 merged 8 commits into
mainfrom
feat/validate-signatures-7702
Mar 13, 2025
Merged

feat: add EIP-7702 signature validations#5470
matthewwalsh0 merged 8 commits into
mainfrom
feat/validate-signatures-7702

Conversation

@matthewwalsh0

@matthewwalsh0 matthewwalsh0 commented Mar 13, 2025

Copy link
Copy Markdown
Member

Explanation

Add additional validations to signTypedData requests to protect EOAs that have been upgraded to a smart contract account via EIP-7702.

Specifically:

  • Throw if verifyingContract matches any internal EOA account.
  • Throw if primaryType is Delegation and delegator matches any internal EOA account.
  • Add dependency on @metamask/accounts-controller.

References

Changelog

See CHANGELOG.md.

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 highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@matthewwalsh0
matthewwalsh0 marked this pull request as ready for review March 13, 2025 11:50
@matthewwalsh0
matthewwalsh0 requested review from a team as code owners March 13, 2025 11:50
@matthewwalsh0
matthewwalsh0 enabled auto-merge (squash) March 13, 2025 12:50
@matthewwalsh0
matthewwalsh0 merged commit 5756b6a into main Mar 13, 2025
@matthewwalsh0
matthewwalsh0 deleted the feat/validate-signatures-7702 branch March 13, 2025 12:54
validateTypedSignatureRequestV1(messageData);
} else {
validateTypedSignatureRequestV3V4(messageData, currentChainId);
validateTypedSignatureRequestV3V4({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can a malicious actor bypass the validations added, by calling eth_signTypedData?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I assumed not as the resulting signature would be different as the format is different? I can try and test though.

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