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

Insecure postMessage window handlers #296

Open
chaitanyapotti opened this issue Sep 1, 2021 · 1 comment · May be fixed by #297
Open

Insecure postMessage window handlers #296

chaitanyapotti opened this issue Sep 1, 2021 · 1 comment · May be fixed by #297

Comments

@chaitanyapotti
Copy link

Describe the bug
The window handler receives messages from any domain and resolves it as the RPC response.

Expected behavior
To check the message origin and act accordingly

https://github.com/open-rpc/client-js/blob/master/src/transports/PostMessageWindowTransport.ts#L49
Should check for message origin.

Security link: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#security_concerns

if (event.origin !== "http://example.com")
    return;
@chaitanyapotti chaitanyapotti linked a pull request Sep 1, 2021 that will close this issue
@zcstarr
Copy link
Member

zcstarr commented Sep 3, 2021

Hey thanks for the PR awesome and the issue! I think maybe we should add targetOrigin or an origin option to the constructors for post message, and then use that to filter. leaving a comment on the PR then, we'll get this merged in :D

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 a pull request may close this issue.

2 participants