Skip to content

Conversation

TylerZeroMaster
Copy link
Contributor

@TylerZeroMaster TylerZeroMaster commented Oct 7, 2025


const handleMessage = (e: MessageEvent) => {
const { source, data: { type } } = e;
if (source !== popup.current) return;
Copy link
Member

Choose a reason for hiding this comment

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

Should we also enforce that the origin matches the popup origin?

Copy link
Contributor Author

@TylerZeroMaster TylerZeroMaster Oct 9, 2025

Choose a reason for hiding this comment

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

@jivey I am not sure we can check that if the popup is cross-origin. I am getting this error when I try :

Uncaught SecurityError: Failed to read a named property 'origin' from 'Window': Blocked a frame with origin "..." from accessing a cross-origin frame.

Granted, I think this would share the same origin as the chat embed popup in a real situation (but there's no guarantee of that since the path is passed in).

Is there a reason to compare the origin too? I would have thought that comparing the objects directly would be most secure. It's effectively checking if the message is from the window the help menu opened, right?

@TylerZeroMaster TylerZeroMaster requested a review from jivey October 13, 2025 14:33
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