Repository navigation
feat(keyring-snap-bridge): populate v2 SnapKeyring capabilities from the manifest - #581
Merged
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
hmalik88
force-pushed
the
hm/keyring-capabilities
branch
from
June 30, 2026 12:43
b040597 to
c850aea
Compare
ccharly
reviewed
Jun 30, 2026
ccharly
reviewed
Jun 30, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9ac9ce9. Configure here.
ccharly
reviewed
Jun 30, 2026
ccharly
reviewed
Jul 1, 2026
ccharly
reviewed
Jul 1, 2026
ccharly
approved these changes
Jul 1, 2026
montelaidev
pushed a commit
that referenced
this pull request
Sep 21, 2026
…the manifest (#581) - Populate the v2 `SnapKeyring.capabilities` from the Snap manifest (`endowment:keyring`) on `deserialize`, via `SnapController:getSnap`, fulfilling the v2 `Keyring` contract's required `capabilities` field. Falls back to the empty default when the Snap declares none. - Guard v2 `SnapKeyring` operations (`getAccounts`/`getAccount`/`createAccounts`/`deleteAccount`/`submitRequest`) until `deserialize` has run; they now throw `"SnapKeyring has not been initialized"` instead of operating on an unbound keyring. - Bump `@metamask/snaps-utils` to `^12.2.1` (`keyring-snap-bridge` + `keyring-internal-snap-client`) for the `capabilities` field on the `endowment:keyring` manifest type. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes snap keyring lifecycle and when account operations are allowed; capabilities are taken from the manifest without local shape validation, so struct drift could cause runtime issues. > > **Overview** > v2 **`SnapKeyring`** now sets **`capabilities`** during **`deserialize`** by reading the Snap manifest’s **`endowment:keyring`** entry via **`SnapController:getSnap`**, with **`EMPTY_CAPABILITIES`** as the typed default when the snap is missing or declares none (including clearing stale values on re-hydrate). > > **`getAccounts`**, **`getAccount`**, **`createAccounts`**, **`deleteAccount`**, and **`submitRequest`** are blocked until **`deserialize`** finishes, throwing *SnapKeyring has not been initialized* instead of running on an unbound keyring. > > **`@metamask/snaps-utils`** is bumped to **`^12.2.1`** in **`keyring-snap-bridge`** and **`keyring-internal-snap-client`** for manifest typing around **`capabilities`**. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 39a8b94. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

SnapKeyring.capabilitiesfrom the Snap manifest (endowment:keyring) ondeserialize, viaSnapController:getSnap, fulfilling the v2Keyringcontract's requiredcapabilitiesfield. Falls back to the empty default when the Snap declares none.SnapKeyringoperations (getAccounts/getAccount/createAccounts/deleteAccount/submitRequest) untildeserializehas run; they now throw"SnapKeyring has not been initialized"instead of operating on an unbound keyring.@metamask/snaps-utilsto^12.2.1(keyring-snap-bridge+keyring-internal-snap-client) for thecapabilitiesfield on theendowment:keyringmanifest type.Note
Medium Risk
Changes snap keyring lifecycle and when account operations are allowed; capabilities are taken from the manifest without local shape validation, so struct drift could cause runtime issues.
Overview
v2
SnapKeyringnow setscapabilitiesduringdeserializeby reading the Snap manifest’sendowment:keyringentry viaSnapController:getSnap, withEMPTY_CAPABILITIESas the typed default when the snap is missing or declares none (including clearing stale values on re-hydrate).getAccounts,getAccount,createAccounts,deleteAccount, andsubmitRequestare blocked untildeserializefinishes, throwing SnapKeyring has not been initialized instead of running on an unbound keyring.@metamask/snaps-utilsis bumped to^12.2.1inkeyring-snap-bridgeandkeyring-internal-snap-clientfor manifest typing aroundcapabilities.Reviewed by Cursor Bugbot for commit 39a8b94. Bugbot is set up for automated code reviews on this repo. Configure here.