Skip to content

Conversation

@FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Nov 12, 2025

This PR adds a new required constructor argument to JsonSnapsRegistry called clientConfig. By using this constructor argument we can determine if a Snap version is compatible with the client version that the user is running. This can be done by comparing the constructor argument to the optional client metadata in the registry when resolving the allowlist version.


Note

Adds a required clientConfig to JsonSnapsRegistry and uses registry clientVersions to verify and resolve only client-compatible Snap versions.

  • snaps-controllers:
    • Registry compatibility:
      • Add required constructor arg clientConfig to JsonSnapsRegistry and store as private field.
      • When verifying (SnapsRegistry:get), require checksum match and client compatibility using clientVersions[clientConfig.type] via satisfiesVersionRange.
      • When resolving (SnapsRegistry:resolveVersion), filter allowlisted versions to those compatible with the provided client before selecting with getTargetVersion.
    • Tests:
      • Add compatibility scenarios for verified/unverified outcomes and version resolution preferring latest compatible.
  • Dependencies:
    • Bump @metamask/snaps-registry to ^3.3.0 in snaps-controllers and snaps-utils (lockfile updated).

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

@FrederikBolding FrederikBolding changed the title feat: Support specified clientVersions in the registry feat!: Support specified clientVersions in the registry Nov 12, 2025
@socket-security
Copy link

socket-security bot commented Nov 12, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​snaps-registry@​3.2.3 ⏵ 3.3.0100 +2100100 +12100 +19100

View full report

@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.28%. Comparing base (c8affd0) to head (9176886).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3737   +/-   ##
=======================================
  Coverage   98.28%   98.28%           
=======================================
  Files         418      418           
  Lines       12163    12175   +12     
  Branches     1881     1886    +5     
=======================================
+ Hits        11954    11966   +12     
  Misses        209      209           

☔ 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 marked this pull request as ready for review November 12, 2025 13:16
@FrederikBolding FrederikBolding requested a review from a team as a code owner November 12, 2025 13:16
expect(result).toBe('1.0.0');
});

it('resolves to a compatible allowlisted version', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test to make sure we resolve to 1.1.0 if the client version allows for it?

Copy link
Member Author

Choose a reason for hiding this comment

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

@FrederikBolding FrederikBolding added this pull request to the merge queue Nov 12, 2025
Merged via the queue into main with commit 7ad4e66 Nov 12, 2025
121 checks passed
@FrederikBolding FrederikBolding deleted the fb/support-specifying-client-versions branch November 12, 2025 13:54
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.

3 participants