Skip to content

feat: Use parent origin instead of document.referrer #2760

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

Merged
merged 4 commits into from
Apr 3, 2025

Conversation

zatteo
Copy link
Member

@zatteo zatteo commented Apr 3, 2025

We sent message from iframe to origin infered document.referrer because document.referrer, when in an iframe, is set initially to the iframe URL. But if a redirection happens in the iframe (which happens during an oauth login) document.referrer is updated. So we sent message from iframe to the wrong origin.

Here we introduce a way to ask the parent window, if it exists, his origin. We just take the origin from the parent window answer metadata. We do not trust the parent window.

By doing this, bridge will be able to work even after a reload or a redirection inside the iframe.

@zatteo zatteo force-pushed the feat/parent-location branch from 8573a34 to bcb4fed Compare April 3, 2025 06:17
zatteo added 4 commits April 3, 2025 08:18
We sent message from iframe to origin infered document.referrer
because document.referrer, when in an iframe, is set initially to the
iframe URL. But if a redirection happens in the iframe (which happens
during an oauth login) document.referrer is updated. So we sent
message from iframe to the wrong origin.

Here we introduce a way to ask the parent window, if it exists, his
origin. We just take the origin from the parent window answer
metadata. We do not trust the parent window.

By doing this, bridge will be able to work even after a reload or a
redirection inside the iframe.
@zatteo zatteo force-pushed the feat/parent-location branch from bcb4fed to c761b0c Compare April 3, 2025 06:18
@zatteo zatteo merged commit b2b3c1b into master Apr 3, 2025
2 checks passed
@zatteo zatteo deleted the feat/parent-location branch April 3, 2025 07:10
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