Skip to content

fix: add origin check#2183

Open
mateuszpiatkowski-da wants to merge 1 commit into
mainfrom
mateuszpiatkowski-da/add-origin-check
Open

fix: add origin check#2183
mateuszpiatkowski-da wants to merge 1 commit into
mainfrom
mateuszpiatkowski-da/add-origin-check

Conversation

@mateuszpiatkowski-da

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Mateusz Piątkowski <mateusz.piatkowski@digitalasset.com>
@mateuszpiatkowski-da
mateuszpiatkowski-da requested a review from a team as a code owner July 21, 2026 17:37
@mateuszpiatkowski-da mateuszpiatkowski-da self-assigned this Jul 21, 2026
if (
event.origin !== window.location.origin ||
!isSpliceMessageEvent(event)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm aren't these always non-matching though? supposing the WG popup is loaded on https://wg.com origin and the dapp is loaded on https://mydapp.com origin. A message emitted from the popup is always a separate origin from the dapp (and vice versa)

I ran into basically the same issue with the multi-session PR, and came up with a sort of two-way handshake (request + ack back) to establish the expected origin: https://github.com/canton-network/wallet/pull/2161/changes#diff-996a6861dc1de45e9046316868d78c3584267529d4a02e513e9151da2a2b7e13R141

maybe we need to extend something like this so that the popup maintains a list of known dapp origins in LocalStorage, and reject if the event comes from an origin outside that list

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good! I'll make the changes :)

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.

2 participants