stoically / temporary-containers

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

Need help: login to bing isolation per domain rules #454

Closed crssi closed 4 years ago

crssi commented 4 years ago

Hi,

I have working rules for google, but have troubles to make similar for bing.

Let me first explain for google. Goal is:

  1. to isolate google so any click on a link open in a new tab/container except the target is google itself.
  2. but also to make possible to login to accounts at google services (account.google.com, accounts.youtube.com) from any site when needed

Here is my configuration (to simplify I have drop out everything that has nothing to with this case): https://github.com/crssi/Firefox/blob/master/.Archive/temporary_containers_preferences_demo.json

As you can see in the per domain isolation rules 1, 3 and 4 are doing it and it works as intended.

For the bing, I am tried whatnot variants, but none successful and I cannot figure out why. The lines 2 and 5 should do it, but are not.

STR:

  1. Visit https://www.bing.com
  2. Click Sign in, which leads you to login.live.com where line 2 kicks in successful.
  3. Go over sign in process and when the site returns back to https://www.bing.com creates new tab/container instead staying in current one.

Thank you for any hint and cheers

stoically commented 4 years ago

Did you check which domains are involved in the redirect back from the login? Since #228 isn't available, a workaround would be to use uBlock's logger and set it to "All" - that should show all involved domains.

crssi commented 4 years ago

Thank you for quick response.

Sure I did. 😉 I always use uBO logger they way you described.

stoically commented 4 years ago

And what's the domain chain?

crssi commented 4 years ago

www.bing.com -> www.bing.com -> login.live.com -> login.live.com -> login.live.com -> www.bing.com -> www.bing.com -> www.bing.com

stoically commented 4 years ago

Well, in that case I'd need a debug log since the rules seem to cover that

crssi commented 4 years ago

Here is the log: bing.log

Thank you again 😄

stoically commented 4 years ago

Ah, I see, here the isolation kicks in

Thu, 06 Aug 2020 12:37:37 GMT "[shouldIsolateAlways] found pattern for incoming request url" "*.bing.com" {"action":"enabled","allowedInPermanent":false,"allowedInTemporary":false} background.js:468:25 Thu, 06 Aug 2020 12:37:37 GMT "[shouldIsolateAlways] isolating because the tab/opener url doesnt match the pattern" "https://login.live.com/ppsecure/post.srf?wa=wsignin1.0&rpsnv…94&bk=1596717452&uaid=3678045f2ee243b7a0f23bd46bf26d83&pid=0" undefined "*.bing.com" background.js:468:25

That's because "Always open in" is "Enabled" for the pattern *.bing.com

Will reopen Tabs in a new Temporary Container if: The active Tab URL doesn't match the Domain Pattern and then tries to navigate to an URL that matches the Domain Pattern

crssi commented 4 years ago

Hmmm... I guess I will have to get back to drawing board.

  1. Have to check now again, but the google part looks like it works fine, or its just a luck. Need some time to clear the things up in my head. UPDATE: It was just a "luck"... test was done where I didn't even leave google environment. It does not work ether.
  2. To avoid what you are saying I have put * on the exclude target domain to the rule 2. I guess that I got this setting all wrong. What exactly for is used exclude target domain ?

Cheers

crssi commented 4 years ago

Thinking more and more and I guess this is actually the case for https://github.com/stoically/temporary-containers/issues/397?

So, in this case I would like always to isolate bing (and separatelly the google and fb and some more) in a separate container, except when returning from specific domains (used for login in this case).

So the #397 rule should say something like: if origin=login.live.com and target=bing.com leave it be as is for BING case and... if origin=accounts.google.com and target=* leave it be as is for GOOGLE case.

Or for https://github.com/stoically/temporary-containers/issues/432#issuecomment-665168500 and the first post after.

Cheers

stoically commented 4 years ago

Yeah, #397 would make stuff like this easier.

Depending on how you're using "Always open in" currently, you could tick the "Disable if Navigation in Temporary Containers" checkbox for the *.bing.com rule. This would make it so that the isolation doesn't happen while you're in a TC when the redirection happens from live.com to bing.com.

stoically commented 4 years ago

To avoid what you are saying I have put * on the exclude target domain to the rule 2. I guess that I got this setting all wrong. What exactly for is used exclude target domain ?

Pretty sure you got it right. But, yeah, now that you mention it. I think it could actually be classified as a bug that isolation happens with rule 2, since exclusion maybe should also encompass the "Always open in" behavior. Scratch that. It's rule 5 triggering the isolation in this case - and there's nothing another rule could do about it.

crssi commented 4 years ago

Depending on how you're using "Always open in" currently, you could tick the "Disable if Navigation in Temporary Containers" checkbox for the *.bing.com rule.

Yes, but in that case I cannot enforce isolation when coming to bing (or google or...) domain from somewhere else... or am I wrong?

What exactly is exclude target domain meant for?

Cheers

stoically commented 4 years ago

Yes, but in that case I cannot enforce isolation when coming to bing (or google or...) domain from somewhere else... or am I wrong?

Not if currently in a TC, correct.

What exactly is exclude target domain meant for?

If the target domain you're navigating to matches the exclusion pattern (and in case of per domain rules, the origin must match the per domain rule pattern), then no isolation takes place.

crssi commented 4 years ago

If the target domain you're navigating to matches the exclusion pattern (and in case of per domain rules, the origin must match the per domain rule pattern), then no isolation takes place.

Why then even gets to the next rule, shouldn't it stop processing in that case on a rule 2 if there is exclude target domain = * ? In that case, "my approach" should work.

stoically commented 4 years ago

No, because the rule depends on the per domain rule pattern matching

stoically commented 4 years ago

Like, if you're navigating from live.com to bing.com, only the *.bing.com rule is used at all.

crssi commented 4 years ago

Will pretend that I understand. 😄

So... exclude target domain = * would work if there were no *.bing.com defined?

stoically commented 4 years ago

All options defined per rule in "per domain isolation" only have an effect if the origin or target domain matches the domain pattern, so, no

crssi commented 4 years ago

Thank you again... I really appreciate your commitment. Will humble wait for #397

Cheers ❤️