Skip to content

fix: Check caveat in invokeKeyring - #4128

Merged
FrederikBolding merged 2 commits into
mainfrom
fb/use-caveat-to-check-permission
Sep 22, 2026
Merged

FrederikBolding merged 2 commits into
mainfrom
fb/use-caveat-to-check-permission

Conversation

@FrederikBolding

@FrederikBolding FrederikBolding commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Inspect permission and check caveat in invokeKeyring.


Note

High Risk
Tightens authorization for keyring Snap invocation; incorrect caveat handling could block legitimate calls or leave overly broad access if misimplemented.

Overview
wallet_invokeKeyring now verifies the dapp is connected to the requested Snap, not just that it holds the broad wallet_snap permission.

The handler switches from PermissionController:hasPermission to getPermission, reads the SnapIds caveat, and only proceeds when the target snapId is listed for the origin. Otherwise it returns the existing “not connected” error. Tests and handler metadata were updated to mock getPermission with caveat data (or null when denied). Jest line coverage threshold was bumped slightly (99.22 → 99.23).

Reviewed by Cursor Bugbot for commit 87f29a9. Bugbot is set up for automated code reviews on this repo. Configure here.

Mrtenz
Mrtenz previously approved these changes Sep 22, 2026

@Mrtenz Mrtenz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be noted that this is technically a breaking change.

@FrederikBolding
FrederikBolding marked this pull request as ready for review September 22, 2026 13:32
@FrederikBolding
FrederikBolding requested a review from a team as a code owner September 22, 2026 13:32
@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.60%. Comparing base (5ee78bd) to head (87f29a9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4128   +/-   ##
=======================================
  Coverage   98.60%   98.60%           
=======================================
  Files         429      429           
  Lines       12511    12513    +2     
  Branches     1978     1977    -1     
=======================================
+ Hits        12336    12338    +2     
  Misses        175      175           

☔ View full report in Codecov by Harness.
📢 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 added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit 3737adf Sep 22, 2026
132 checks passed
@FrederikBolding
FrederikBolding deleted the fb/use-caveat-to-check-permission branch September 22, 2026 13:43
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.

2 participants