Skip to content

feat(tron): use resolveOrigin shared util - #280

Draft
mikesposito wants to merge 5 commits into
me/origin/shared-utilfrom
me/origin/tron
Draft

mikesposito wants to merge 5 commits into
me/origin/shared-utilfrom
me/origin/tron

Conversation

@mikesposito

@mikesposito mikesposito commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Depends on

Explanation

For remote transports (WalletConnect), the origin of a request cannot be verified: mobile passes the unspoofable per-session channel ID (a UUID) as the snap request origin, and the dapp's URL travels separately in originMetadata ({ transport, selfReportedOrigin }). The Tron snap did not account for this: it displayed whatever origin it received verbatim — so Tron-over-WalletConnect confirmations show the raw UUID as the "Request from" site, and forwarded the raw origin to the security alerts API, where the URL is a core heuristic that can flip a Blockaid verdict. A self-reported URL fed to the scan would let a dapp influence the very check meant to catch it.

This PR adopts the shared resolveOrigin util (#275):

  • The sign-transaction and sign-message confirmations now render a shared OriginRow component: the hostname for verifiable HTTP(S) origins, the MetaMask label for the internal origin, the dapp's self-reported URL marked "Not verified" (warning label + tooltip), and no row at all when there is nothing meaningful to show (a channel ID with no metadata). Showing a self-reported origin bare would imply a verification we never made.
  • TransactionScanService only forwards resolveOrigin(origin).verifiedOrigin to the security alerts API. Unverifiable origins (a channel ID or a self-reported URL) are reported as wallet-initiated (https://metamask.io) so they cannot influence a scan verdict.
  • The snap-local formatOrigin util is removed (dead after the migration), and new "Not verified" locale strings are added.

References

Related to https://consensyssoftware.atlassian.net/browse/WPN-2165

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

The rebase onto main added a fourth constructor parameter
(analyticsService) to TransactionScanService; the origin-forwarding
tests added in this PR still constructed the service with three
arguments, failing the TypeScript check in CI.
@sonarqubecloud

Copy link
Copy Markdown

snap-networks-utils no longer re-exports the metadata type under a
distinct name: import OriginMetadata from @metamask/snaps-sdk instead.

This branch has not been deployed

No deployments
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