Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove wildcard from Postmessage #4

Closed
HunnySajid opened this issue Apr 4, 2024 · 2 comments
Closed

Remove wildcard from Postmessage #4

HunnySajid opened this issue Apr 4, 2024 · 2 comments

Comments

@HunnySajid
Copy link
Contributor

Currently we are using wildcard '*' while communicating with postMessage. It is not correct as it broadcasts messages to all.
We need to fix it so that communication can only be between out content script and webpage.

Relevant links:
https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#using_window.postmessage_in_extensions_non-standard

Linked Issue on signify-extension:
WebOfTrust/signify-browser-extension#159

@lenkan
Copy link
Contributor

lenkan commented Aug 16, 2024

This is now implemented as an option:

targetOrigin?: string;

window.postMessage({ requestId, type, ...(payload ?? {}) }, this.options.targetOrigin ?? "/");

Is that sufficient to be able to close this? The default behavior is that the target origin is "/", which means same origin according to spec.

@HunnySajid
Copy link
Contributor Author

@lenkan thanks for looking into it, can be closed now.

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

No branches or pull requests

2 participants