Skip to content

fix: regex in typed-data parsing cp-7.62.0#24550

Merged
dan437 merged 2 commits intomainfrom
regex-permit-value
Jan 16, 2026
Merged

fix: regex in typed-data parsing cp-7.62.0#24550
dan437 merged 2 commits intomainfrom
regex-permit-value

Conversation

@dan437
Copy link
Copy Markdown
Contributor

@dan437 dan437 commented Jan 15, 2026

Description

Fix regex in typed-data parsing.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/6624

Manual testing steps

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

Note

Strengthens typed-data parsing to prevent UI spoofing from nested value fields.

  • Updates REGEX_MESSAGE_VALUE_LARGE to use [^{}]* so only top-level message.value is matched, ensuring large numbers are parsed correctly from the intended field
  • Adds tests covering nested/deeply nested value fields, arrays, ordering, escaped quotes, and string-valued message.value
  • Extends e2e allowlist with https://api.hyperliquid.xyz/info

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

@dan437 dan437 requested a review from a team as a code owner January 15, 2026 13:16
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-confirmations Push issues to confirmations team label Jan 15, 2026
@sethkfman sethkfman changed the title fix: regex in typed-data parsing fix: regex in typed-data parsing cp-7.62.0 Jan 15, 2026
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
@dan437 dan437 force-pushed the regex-permit-value branch from dc6d46c to ad592b0 Compare January 16, 2026 13:37
@dan437 dan437 requested a review from a team as a code owner January 16, 2026 13:37
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmationsRedesigned, SmokePerps
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

The PR contains three changes:

  1. E2E API Mocking Allowlist (e2e/api-mocking/mock-e2e-allowlist.ts): Added https://api.hyperliquid.xyz/info to the allowlist. This is a minor addition to support HyperLiquid API calls in E2E tests for the Perps (perpetuals trading) feature. This warrants running SmokePerps tests.

  2. Signature Utility Security Fix (app/components/Views/confirmations/utils/signature.ts): A security fix to the regex REGEX_MESSAGE_VALUE_LARGE that extracts large numeric values from message.value. The change from [^}]* to [^{}]* prevents matching nested "value" fields, which could be exploited in spoofing attacks where attackers include nested objects with large "value" fields to trick the UI into displaying different amounts than what will actually be signed. This is a critical security fix for the confirmations flow.

  3. Unit Tests (app/components/Views/confirmations/utils/signature.test.ts): Added comprehensive tests for the nested value spoofing protection, covering various attack scenarios.

The signature utility is imported by 20+ files in the confirmations flow including typed sign components, personal sign, permit simulations, and blockaid banner. This warrants running SmokeConfirmationsRedesigned tests to verify the signature parsing and display functionality works correctly with the security fix.

Risk is medium because:

  • The signature utility change is a targeted regex fix with good test coverage
  • The change is security-focused but the fix is straightforward
  • The allowlist change is additive and low-risk

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@dan437 dan437 enabled auto-merge January 16, 2026 14:49
@dan437 dan437 added this pull request to the merge queue Jan 16, 2026
Merged via the queue into main with commit 853a5e1 Jan 16, 2026
89 checks passed
@dan437 dan437 deleted the regex-permit-value branch January 16, 2026 15:24
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2026
@metamaskbot metamaskbot added the release-7.63.0 Issue or pull request that will be included in release 7.63.0 label Jan 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.63.0 Issue or pull request that will be included in release 7.63.0 size-S team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants