Skip to content

Conversation

@vinistevam
Copy link
Contributor

@vinistevam vinistevam commented Dec 3, 2025

Description

This PR updates the transaction validation logic to bypass Blockaid security checks when transferring assets between internal accounts. This ensures that the Security Alerts API is not called unnecessarily for trusted self token transfers.

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Fixed an issue where Blockaid validation was unnecessarily triggered for transfers between internal accounts

Related issues

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

Manual testing steps

  1. Perform a token (USDC) transfer using an internal account
  2. Open chrome dev tools > network
  3. Should not call Security Alerts API

Screenshots/Recordings

security.webm

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

Skips PPOM validation for zero-value token transfers between internal accounts by extracting the recipient from transaction data, with supporting helpers and tests.

  • Security validation (PPOM/Blockaid):
    • Skip PPOM validation when:
      • type is a token transfer (tokenMethodTransfer|TransferFrom|SafeTransferFrom), value is 0x0, and recipient is an internal account.
    • Parse transfer recipient from txParams.data via new getTransactionDataRecipient to detect self/internal transfers.
    • Add helpers: TRANSFER_TYPES, normalizeAddress, isInternalAccount and import getTransactionDataRecipient.
  • Shared utils:
    • Add getTransactionDataRecipient(data) using parseStandardTokenTransactionData to extract _to/to address.
  • Tests:
    • Add test to ensure PPOM is not called for zero-value transfers to self in app/scripts/lib/transaction/util.test.ts.
    • Add comprehensive tests for getTransactionDataRecipient and adjust Permit2 decoding expectations in shared/modules/transaction.utils.test.js.

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

@vinistevam vinistevam added the team-confirmations Push issues to confirmations team label Dec 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

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
Copy link
Collaborator

✨ Files requiring CODEOWNER review ✨

@MetaMask/confirmations (2 files, +71 -5)
  • 📁 app/
    • 📁 scripts/
      • 📁 lib/
        • 📁 transaction/
          • 📄 util.test.ts +34 -0
          • 📄 util.ts +37 -5

@github-actions github-actions bot added the size-M label Dec 3, 2025
@vinistevam vinistevam changed the title fix: skip blockaid validation for internal accounts transfer fix: skip blockaid validation for internal accounts (transfer) Dec 3, 2025
@vinistevam vinistevam changed the title fix: skip blockaid validation for internal accounts (transfer) fix: skip Blockaid validation for token transfers between internal accounts Dec 3, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [c67d928]
UI Startup Metrics (1263 ± 138 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1263993173313813571469
load1056861152811711331251
domContentLoaded1047851151711411201239
domInteractive2816194252284
firstPaint63685157543910861238
backgroundConnect21018226515221236
firstReactRender291866103251
getState38141362341107
initialActions105113
loadScripts84765613131129231029
setupStore1275161421
numNetworkReqs1257720573
BrowserifyPower User HomeuiStartup20511726265420421302441
load1028887164313210311357
domContentLoaded1014877162413110121338
domInteractive3317145223392
firstPaint60410016334209971375
backgroundConnect24521077781235420
firstReactRender5936110146293
getState19714168272206233
initialActions106112
loadScripts80167114131307841128
setupStore2095482539
numNetworkReqs1596639663208268
WebpackStandard HomeuiStartup83670213081118631044
load6575631143109686879
domContentLoaded6515581135108679873
domInteractive27151432622104
firstPaint25273846195205745
backgroundConnect1066261119
firstReactRender2820130123138
getState261354113647
initialActions103112
loadScripts6485561133107677864
setupStore1173141418
numNetworkReqs1257720572
WebpackPower User HomeuiStartup14821073204819515281930
load641559111797644860
domContentLoaded632553110696632850
domInteractive32161352530109
firstPaint303941157227316850
backgroundConnect40755411216437
firstReactRender56428586073
getState18114575559185204
initialActions103112
loadScripts629551109395629848
setupStore17858101848
numNetworkReqs1616838461212292
FirefoxBrowserifyStandard HomeuiStartup13151096180413813921592
load109295313439011571255
domContentLoaded109295313429011561255
domInteractive58301362683110
firstPaint------
backgroundConnect50211933467109
firstReactRender22183432326
getState147140211046
initialActions103122
loadScripts105994013207911181229
setupStore14599161236
numNetworkReqs1156616658
BrowserifyPower User HomeuiStartup26341953503758026674214
load1246981262134112352375
domContentLoaded1246981262134112292375
domInteractive1203448599124367
firstPaint------
backgroundConnect168301252223147696
firstReactRender5733255245988
getState297731114251361812
initialActions207123
loadScripts1178964232824011801536
setupStore1596819206155684
numNetworkReqs92602394395227
WebpackStandard HomeuiStartup15161292205714216021800
load12491064159510913181442
domContentLoaded12491064159510913161442
domInteractive60271433481133
firstPaint------
backgroundConnect47211532751120
firstReactRender26197192839
getState1368291327
initialActions104123
loadScripts12231047157710312911401
setupStore167195211436
numNetworkReqs1257217762
WebpackPower User HomeuiStartup30412249533681030104905
load15301141298045215812757
domContentLoaded15301140298045315812756
domInteractive1062941091107370
firstPaint------
backgroundConnect2123212562921711117
firstReactRender65372113062135
getState29666990240442796
initialActions208123
loadScripts14211114281329515381997
setupStore1327115820497600
numNetworkReqs925623838106177
📊 Page Load Benchmark Results

Current Commit: c67d928 | Date: 12/3/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±42ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 718ms (±38ms) 🟢 | historical mean value: 726ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 75ms (±11ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 42ms 1.01s 1.35s 1.06s 1.35s
domContentLoaded 718ms 38ms 698ms 1.01s 740ms 1.01s
firstPaint 75ms 11ms 60ms 168ms 84ms 168ms
firstContentfulPaint 75ms 11ms 60ms 168ms 84ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 868 Bytes (0.02%)
  • ui: -542 Bytes (-0.01%)
  • common: 198 Bytes (0%)

@vinistevam vinistevam marked this pull request as ready for review December 3, 2025 12:49
@vinistevam vinistevam requested a review from a team as a code owner December 3, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants