Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Tweak UIA postMessage check to work cross-origin (#12878)
Browse files Browse the repository at this point in the history
* Soften UIA fallback postMessage check to work cross-origin

Signed-off-by: Michael Telatynski <[email protected]>

* Do the same for the SSO UIA flow

Signed-off-by: Michael Telatynski <[email protected]>

* Check against MessageEvent::source instead

Signed-off-by: Michael Telatynski <[email protected]>

---------

Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy authored Aug 16, 2024
1 parent 7a91e3e commit 88cf643
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/views/auth/InteractiveAuthEntryComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ export class SSOAuthEntry extends React.Component<ISSOAuthEntryProps, ISSOAuthEn
};

private onReceiveMessage = (event: MessageEvent): void => {
if (event.data === "authDone" && event.origin === this.props.matrixClient.getHomeserverUrl()) {
if (event.data === "authDone" && event.source === this.popupWindow) {
if (this.popupWindow) {
this.popupWindow.close();
this.popupWindow = null;
Expand Down Expand Up @@ -950,7 +950,7 @@ export class FallbackAuthEntry extends React.Component<IAuthEntryProps> {
};

private onReceiveMessage = (event: MessageEvent): void => {
if (event.data === "authDone" && event.origin === this.props.matrixClient.getHomeserverUrl()) {
if (event.data === "authDone" && event.source === this.popupWindow) {
this.props.submitAuthDict({});
}
};
Expand Down

0 comments on commit 88cf643

Please sign in to comment.