Skip to content

Conversation

@FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Oct 7, 2025

When invoking Snaps directly, e.g. from within MetaMask, we were currently not validating that Snaps were installed. This means that misleading errors would be thrown about permissions when the Snap was not installed in the first place.

Also removes this check from one RPC method, since it is now unnecessary. We leave the RPC method around in invokeKeyring to not change the error handling behavior.

Closes #3658


Note

Adds an installation check to SnapController.handleRequest, removes redundant snap-installed checks from invokeSnap, aligns error messages, and updates tests and coverage thresholds.

  • SnapController:
    • Validate Snap exists in handleRequest and throw a clear error if not installed.
    • Refactor subsequent checks to use local snap (enabled/status).
  • RPC Methods:
    • invokeSnap: Remove getSnap hook and installed check; rely on controller for validation.
    • invokeKeyring: Align "not installed" error message with controller.
  • Tests:
    • Add test for non-installed Snap in SnapController.handleRequest.
    • Update invokeSnap tests to drop getSnap usage and non-installed error case.
    • Update invokeKeyring tests to match new error message.
  • Config:
    • Slightly adjust Jest coverage thresholds in snaps-rpc-methods.

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

@codecov
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.29%. Comparing base (5d19c66) to head (303b2b9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3666   +/-   ##
=======================================
  Coverage   98.29%   98.29%           
=======================================
  Files         417      417           
  Lines       11924    11924           
  Branches     1852     1851    -1     
=======================================
  Hits        11721    11721           
  Misses        203      203           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@FrederikBolding FrederikBolding force-pushed the fb/throw-if-snap-not-installed branch from 714321e to 303b2b9 Compare October 13, 2025 09:00
@FrederikBolding FrederikBolding marked this pull request as ready for review October 13, 2025 09:00
@FrederikBolding FrederikBolding requested a review from a team as a code owner October 13, 2025 09:00
@FrederikBolding FrederikBolding added this pull request to the merge queue Oct 13, 2025
Merged via the queue into main with commit 9aa68cd Oct 13, 2025
122 checks passed
@FrederikBolding FrederikBolding deleted the fb/throw-if-snap-not-installed branch October 13, 2025 09:48
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.

Validate that Snap is installed in handleRequest

4 participants