Repository navigation
fix(money-account-api-data-service): validate SIWE challenge before signing - #11112
Merged
Merged
Conversation
ffmcgee725
marked this pull request as ready for review
October 27, 2026 10:17
ffmcgee725
temporarily deployed
to
default-branch
October 27, 2026 10:17 — with
GitHub Actions
Inactive
Jwhiles
approved these changes
Oct 27, 2026
Merged
gaohan1994
pushed a commit
to gaohan1994/core
that referenced
this pull request
Oct 28, 2026
## Packages - [`@metamask/money-account-api-data-service@2.3.1`](https://github.com/MetaMask/core/blob/release/1370.0.0/packages/money-account-api-data-service/CHANGELOG.md#231) (patch) ### `@metamask/money-account-api-data-service` #### Changed - Bump `@metamask/utils` from `^12.0.0` to `^12.0.1` ([MetaMask#11107](MetaMask#11107)) #### Fixed - Validate VBA SIWE challenge messages against the expected Money Account template before signing, rejecting a message whose domain, URI, address, statement, version, chain ID, nonce, or timestamps do not match ([MetaMask#11112](MetaMask#11112)) ### Dependency notes Other changed packages (`@metamask/base-data-service`, `@metamask/controller-utils`, `@metamask/messenger`) were marked `intentionally-skip` in the release spec: their current published versions satisfy this package's dependency ranges, and their pending changes are not required by [MetaMask#11112](MetaMask#11112). The sole dependent of this package, `@metamask/money-account-balance-service`, had its dependency range updated from `^2.3.0` to `^2.3.1` in lockstep. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > The release ships SIWE pre-sign validation for VBA auth; behavior changes for invalid or tampered challenges are security-relevant even though this PR only versions and documents that fix. > > **Overview** > This PR cuts **release 1370.0.0** by bumping the root monorepo version and publishing **`@metamask/money-account-api-data-service@2.3.1`** (patch). The diff is release wiring only: package versions, changelogs, `yarn.lock`, and a dependent range update on **`@metamask/money-account-balance-service`** (`^2.3.0` → `^2.3.1`). > > **2.3.1** (documented in the changelog, not new code in this diff) includes a **`@metamask/utils`** bump to `^12.0.1` and a **security fix** that validates VBA SIWE challenge messages against the expected Money Account template before signing, rejecting mismatches in domain, URI, address, statement, version, chain ID, nonce, or timestamps ([MetaMask#11112](MetaMask#11112)). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c1fef7b. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
8 of 10 tasks
darkwing
pushed a commit
to darkwing/metamask-mobile
that referenced
this pull request
Oct 29, 2026
…38371) ## **Description** Bumps `@metamask/money-account-api-data-service` from `2.3.0` to `2.3.1`, the release that validates Money Account SIWE challenges before signing ([MetaMask/core#11112](MetaMask/core#11112), shipped in core release `1370.0.0`). `2.3.1` rebuilds the expected SIWE message from the challenge nonce and the parsed `Issued At`, and requires an exact match before the service calls `KeyringController:signPersonalMessage`. A challenge with a wrong domain, URI, address, statement, version, chain ID, nonce, or timestamp — or an expired/future challenge — now throws `MoneyAccountApiResponseValidationError` instead of producing a signature over content the user never approved. No mobile source changes are required: `moneyAccountApiDataServiceInit` already passes the `Env` derived from `MM_API_ENV`, and the service derives its SIWE domain/URI from the same `MONEY_ACCOUNT_API_URL_MAP`. The lockfile resolves a single copy of the package for both the direct dependency and `@metamask/money-account-balance-service`. ## **Changelog** CHANGELOG entry: null ## **Related issues** Refs: [MUSD-1490](https://consensyssoftware.atlassian.net/browse/MUSD-1490) Refs: [MUSD-1483](https://consensyssoftware.atlassian.net/browse/MUSD-1483) Refs: [MetaMask/core#11112](MetaMask/core#11112) ## **Manual testing steps** ```gherkin Feature: Money Account VBA transfers authenticate with a validated SIWE challenge Scenario: Valid challenge loads VBA activity Given a Money Account with VBA transfers and the VBA activity feature flags enabled When the user opens Money activity Then pending and completed VBA transfers load as before Scenario: Tampered challenge is rejected before signing Given the Money Account API returns a challenge message that does not match the SIWE template When the service requests VBA transfers Then no personal_sign request is made And the transfers query fails with MoneyAccountApiResponseValidationError ``` Automated coverage for both scenarios lives in the core package (`money-account-api-data-service`). Mobile unit tests for the service init, messenger, and Money VBA hooks pass. Not manually tested on device; this is a draft PR. ## **Screenshots/Recordings** ### **Before** N/A — dependency bump, no UI change. ### **After** N/A — dependency bump, no UI change. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. #### Performance checks (if applicable) - [x] I've tested on Android - [x] I've tested with a power user scenario - [x] I've instrumented key operations with Sentry traces for production performance metrics ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- Generated with the help of the pr-description AI skill --> [MUSD-1490]: https://consensyssoftware.atlassian.net/browse/MUSD-1490?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Pulls in stricter pre-sign SIWE validation on Money Account API auth paths; valid flows should be unchanged, but any API/challenge mismatch will fail earlier with no personal_sign prompt. > > **Overview** > Bumps **`@metamask/money-account-api-data-service`** from `2.3.0` to **`2.3.1`** in `package.json` and `yarn.lock` only—no mobile app source changes. > > The new release tightens **Money Account SIWE authentication**: before calling `KeyringController:signPersonalMessage`, the service rebuilds the expected SIWE message from the challenge nonce and `Issued At` and requires an exact match. Tampered or invalid challenges (wrong domain, URI, address, nonce, timestamps, etc.) now throw **`MoneyAccountApiResponseValidationError`** instead of signing content the user never approved. > > Existing wiring (e.g. `moneyAccountApiDataServiceInit` with `MM_API_ENV` → `Env`) stays the same; VBA transfers and other Money API flows pick up the validation automatically. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit fd76adf. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This branch was previously deployed
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.
Explanation
The service currently checks only that the challenge response has
nonceandmessage, then asks the keyring to signchallenge.messageverbatim, so a modified challenge can produce a signature over content the user never saw. This rebuilds the Money Account SIWE template from the challenge nonce and parsedissuedAtand requires an exact match, so a wrong domain, URI, address, statement, version, chain ID, nonce, or timestamp is rejected before signing. The 5-minute window, 60-second future-skew allowance, and template fields are pinned to the API'sbuildSiweMessage.References
Fixes MUSD-1490
Related: MUSD-1483
Checklist
Note
High Risk
Changes VBA SIWE authentication so invalid or tampered challenge messages are rejected before wallet signing, which is security-critical for transfer access.
Overview
Adds client-side SIWE challenge validation so VBA auth no longer signs whatever the challenge endpoint returns after a shallow shape check.
A new
siwe-messagemodule rebuilds the Money Account API SIWE template (domain/URI from env, pinned statement, chain ID 143, 5‑minute TTL, 60s future skew) and requires an exact match on domain, URI, address, statement, version, chain ID, nonce, and timestamps beforeKeyringController:signPersonalMessageruns. Mismatches, malformed nonces, expiry, or extra/missing lines throwMoneyAccountApiResponseValidationErrorwithout retrying the challenge fetch.Constants document the pinned API contract; unit and
fetchVbaTransferstests cover rejection paths and confirm signing is skipped for invalid challenges.Reviewed by Cursor Bugbot for commit cf62fcc. Bugbot is set up for automated code reviews on this repo. Configure here.