feat(tron): use resolveOrigin shared util - #280
Draft
mikesposito wants to merge 5 commits into
Draft
mikesposito wants to merge 5 commits into
mikesposito wants to merge 5 commits into
Conversation
mikesposito
force-pushed
the
me/origin/tron
branch
from
September 22, 2026 14:19
3dd88b0 to
bcc1239
Compare
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.
|
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
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.



Depends on
resolveOriginshared util #275Explanation
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 inoriginMetadata({ transport, selfReportedOrigin }). The Tron snap did not account for this: it displayed whateveroriginit 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
resolveOriginutil (#275):OriginRowcomponent: the hostname for verifiable HTTP(S) origins, theMetaMasklabel 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.TransactionScanServiceonly forwardsresolveOrigin(origin).verifiedOriginto 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.formatOriginutil 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