stoically / temporary-containers

Firefox Add-on that lets you open automatically managed disposable containers
https://addons.mozilla.org/firefox/addon/temporary-containers/
MIT License
846 stars 57 forks source link

Microsoft Answers results in infinite loop #585

Open Gitoffthelawn opened 2 years ago

Gitoffthelawn commented 2 years ago

Actual behavior

When site isolation is enabled, going to any Microsoft Answers URL (https://answers.microsoft.com/ is the root of the host), Temporary Containers will cause Firefox to go into an infinite loop of opening more and more tabs.

Expected behavior

No infinite loops. :)

Steps to reproduce

  1. Create a fresh Firefox profile.
  2. Install Temporary Containers.
  3. Set Isolation to Different from Tab Domains & Subdomains
  4. Go to any Microsoft Answers URL (e.g. https://answers.microsoft.com/)
  5. Watch the magic happen!

Notes

I haven't had time to play with it yet, but I'm guessing a little manual configuration will resolve this issue. The 2 big questions are:

  1. What exactly is causing this issue?
  2. Since that site is fairly popular (for better or worse!), should Temporary Containers include any built-in logic to handle this case?
mhtrinh commented 2 years ago

This is because answers.microsoft.com will redirect you to login.microsoftonline.com then bounce back (once a cookie is created) back to answers.microsoft.com

With TC active, every bounce is in a separate container, so answers.microsoft.com will not see the cookie left by login.microsoftonline.com so keep redirecting forever ...

I blame microsoft for making such stupid redirection and cookie requirement !!

As for workaround, I have to disable TC when going the first time to answers.microsoft.com then turn back TC on after hope twice. Alternatively, you can force both of those website to the same container (eg: using addon Multi-account container or Containerise)

Gitoffthelawn commented 2 years ago

@mhtrinh Thanks for looking into what's going on with that site. Yes, as we see all too often, that's really dumb of Microsoft and certainly problematic.

I've only had a little time to take a close look at what's going on... is it possible to neuter the redirect?

I suppose an alternative is to hardcode an exception in TC to handle Microsoft's nonsense.

In my brief look at this issue, here's what I noticed: MS is using HTTP response status code 302 to force web browsers to redirect to https://login.microsoftonline.com.

As a quick hack, which I didn't expect to work due to the forced 302 redirect, I tried adding these rules to uBO (uBlock Origin):

||microsoft.com^$script,important
||microsoftonline.com^$script,important
||live.com^$script,important

As expected, that didn't work, likely because the redirect happens in the HTTP response which is handled before uBO can get ahold of any content. Easy enough to try, though.

mhtrinh commented 2 years ago

Hardcode is a bad idea. People may have other add-ons and your hardcoded rule may interfere with that.

Plus, Microsoft websites are notorious in term of redirection, it's just not only answers.microsoft.com. There are outlook, azure domains, etc ... they all use different domains ! When you click on a link on webUI office365, you bounce 2+ times, like on a torrent website, before you get anywhere ! You will never win that battle.

I use Containerise and every now and then, there is a new bounce that I need to add to the list !!!

gittyhub888 commented 1 year ago

I have an addition question for this subject. If answers.microsoft.com always redirects to login.microsoftonline.com, can't we add a domain pattern based rule, excluding login.microsoftonline.com to avoid opening a new container? Domain pattern "answers.microsoft.com", exclusion pattern "login.microsoftonline.com" And to allow login.microsoftonline.com to come back to answers.microsoft.com in the same container, I add a domain pattern rule "login.microsoftonline.com" with the exclusion pattern "*", which should work for any site, right? Why does this not work?