Skip to content

fix: add logic to properly rate limit snap install requests #5824

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

hmalik88
Copy link
Contributor

@hmalik88 hmalik88 commented May 17, 2025

Explanation

  • What is the current state of things and why does it need to change? The approval controller doesn't properly block multiple snap install requests from the same origin. One can technically open up to 3 install flows at once (connect to snap A, proceed to install step, connect to snap B, proceed to install-result step for snap A, proceed to install for snap B, connect to snap C).
  • What is the solution your changes offer and how does it work? Add logic to treat wallet_installSnap, wallet_updateSnap, wallet_installSnapResult as one.
  • Are there any changes whose purpose might not obvious to those unfamiliar with the domain? The snap installation flow is comprised of multiple requests, hence why this probably slipped through the cracks.
  • If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? Added snap approval types to controller-utils (for use in the client).

References

Are there any issues that this pull request is tied to? No
Are there other links that reviewers should consult to understand these changes better? These changes are necessary to complete this PR: MetaMask/metamask-extension#33040

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

@hmalik88 hmalik88 requested review from a team as code owners May 17, 2025 06:01
@hmalik88 hmalik88 marked this pull request as draft May 17, 2025 06:08
@hmalik88 hmalik88 marked this pull request as ready for review May 25, 2025 06:01
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.

1 participant