Skip to content

fix: preserve NFT token IDs in Blockaid scan previews#8027

Open
clarion-by-cantina[bot] wants to merge 1 commit into
mainfrom
fix/nft-token-id-preview
Open

fix: preserve NFT token IDs in Blockaid scan previews#8027
clarion-by-cantina[bot] wants to merge 1 commit into
mainfrom
fix/nft-token-id-preview

Conversation

@clarion-by-cantina
Copy link
Copy Markdown

Summary

The Blockaid-backed approval flow for eth_sendTransaction and wallet_sendCalls dropped ERC721/ERC1155 token-specific identifiers (token_id, summary) from simulated asset transfers before rendering the approval UI. This caused the preview to collapse a specific token like "BAYC #8817" into a generic collection row like "Bored Ape Yacht Club", while the signed calldata still contained the attacker-chosen tokenId.

A malicious dapp could exploit this to obtain user approval for transferring a specific high-value NFT while showing only collection-level metadata in the approval surface.

Changes

  • TransactionAsset interface — added optional tokenId and summary fields
  • parseSendingAssets / parseReceivingAssets — populate tokenId/summary from Blockaid amount objects when asset type is ERC721 or ERC1155
  • formatAmountWithLocale — updated to render token-specific labels, preferring Blockaid summary, then symbol/name + #tokenId, with ERC1155 quantity support
  • Tests — added 5 new test cases covering ERC721 token ID + summary parsing, ERC1155 with quantity, ERC20 non-leakage, and receiving-side NFT parsing

Affected paths

  • eth_sendTransaction scanned preview
  • wallet_sendCalls scanned preview
  • Extension dapp request approval flow

Finding reference

View in Clarion

The Blockaid scan parser dropped ERC721/ERC1155 token_id and summary
fields when building TransactionAsset objects, causing the approval UI
to display only collection-level metadata (e.g. "Bored Ape Yacht Club")
instead of specific token identifiers (e.g. "BAYC #8817"). This allowed
a malicious dapp to obtain approval for a specific high-value NFT while
showing the user only a generic collection label.

Changes:
- Add tokenId and summary fields to TransactionAsset interface
- Populate tokenId/summary from Blockaid amount objects in both
  parseSendingAssets and parseReceivingAssets for ERC721/ERC1155 types
- Update formatAmountWithLocale to render token-specific labels,
  preferring Blockaid summary, then symbol/name + tokenId
- Add test coverage for ERC721 and ERC1155 token ID parsing

Co-Authored-By: Clarion <noreply@clarion.sh>
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.

1 participant