Skip to content

fix: handle non-url origins#137

Closed
0xEdouardEth wants to merge 1 commit into
MetaMask:mainfrom
0xEdouardEth:fix/validate-origin-url
Closed

fix: handle non-url origins#137
0xEdouardEth wants to merge 1 commit into
MetaMask:mainfrom
0xEdouardEth:fix/validate-origin-url

Conversation

@0xEdouardEth

Copy link
Copy Markdown
Collaborator

Explanation

This PR updates the Stellar Snap confirmation origin helpers to handle non-URL origins such as the stable wallet-connect origin used by MetaMask Mobile WalletConnect multichain requests.

Valid HTTP(S) URL origins continue to be displayed as hostnames. Known non-URL origins are displayed with friendly labels, currently MetaMask and WalletConnect. Unknown invalid origins, including WalletConnect channel IDs, now format to an empty string so confirmation UI can avoid showing meaningless identifiers.

Tests were added for known origins, URL origins, non-http URLs, WalletConnect channel IDs, invalid origin strings, and the existing confirmation utility behavior.

References

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
    • N/A - no package changelog update needed for this internal behavior fix.
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
    • N/A - this does not introduce a breaking API change.

Validation

ENVIRONMENT=test LOG_LEVEL=error ... yarn workspace @metamask/stellar-wallet-snap jest packages/snap/src/ui/confirmation/utils.test.ts --runInBand --coverage=false

Result: 1 test suite passed, 23 tests passed.

yarn eslint packages/snap/src/ui/confirmation/utils.ts packages/snap/src/ui/confirmation/utils.test.ts

Result: passed.

@0xEdouardEth 0xEdouardEth marked this pull request as ready for review June 25, 2026 13:58
@0xEdouardEth 0xEdouardEth requested a review from a team as a code owner June 25, 2026 13:58
@0xEdouardEth 0xEdouardEth force-pushed the fix/validate-origin-url branch from e88b029 to 5a1e6d5 Compare June 25, 2026 14:04
@0xEdouardEth 0xEdouardEth force-pushed the fix/validate-origin-url branch from 5a1e6d5 to 1548105 Compare June 26, 2026 13:42
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