-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(oidc): ensure unique tabIds when page is duplicated (release) #1448
Conversation
9622f28
to
38bf10f
Compare
Hi @guillaume-chervet ! Could you take a look at this? |
Hi @krzempekk , I test it as soon as possible (like today) Thank you again. I did not know that tab clon can bring some problems. Thank you! |
I do not know how but it would be awesome to move the main part of the code in initWorker.js . |
Hi @guillaume-chervet! I tried to put this code in |
Let ='s try it as a beta. Thank you @krzempekk :) again ! |
Hi @guillaume-chervet ! Thanks for merging! Can you trigger release with this fix? I see that it was not triggered |
It was published yesterdays as a beta. I prefer to test it well before release it! @krzempekk |
Sure, totally understand! Could you share beta version so I can test it as well? |
Version 7.22.25-beta.1555 is already on npm @krzempekk |
Hi @guillaume-chervet, I noticed this PR didn't end up in any released version, looks like it was removed from |
This is a follow-up for #1423. Mechanism introduced in #1402 works under assumption that session storage for each tab is independent and opening new tab creates fresh instance of it. Which is generally true, except for one browser gimmick - if page is duplicated (in Chrome -> right click on tab name then "Duplicate") session storage is copied to duplicated tab (see https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage). This creates an issue in following scenario:
This scenario can cause various issues, depending on specific IDP, which are caused by two tabs having the same id.
A picture tells a thousand words
Before this PR
After this PR
This PR introduces solution inspired by https://github.com/haricane8133/unique-tabid/tree/master, which is based on BroadcastChannel. Idea is that each
Oidc
class instance has channel listening for messages. When new instance is created (either in duplicated tab, if app url was opened in empty tab or if page was refreshed), following steps are done:SEARCH
message is sent via channelSEARCH
message and comparing it with their own ID. If there is a match,FOUND
message is sent.FOUND
message is received, new ID is generated. Otherwise, if no message is received after some timeout (assumed 500ms here), ID from session storage is used.