Data clearing exceptions should apply to cookie jars when dFPI is enabled
Categories
(Toolkit :: Data Sanitization, defect, P3)
Tracking
()
People
(Reporter: bugzilla, Unassigned)
Details
Attachments
(3 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0
Steps to reproduce:
- Set "Delete cookies and site data when Firefox is closed" at about:preferences#privacy
- Ensure kinopoisk.ru is not whitelisted at "Manage exceptions"
- Go https://kinopoisk.ru
- Restart browser to trigger cookie auto delete cookies
- Go about:preferences#privacy, open "Manage data"
Actual results:
Cookie "kinopoisk.ru" is persisted
Expected results:
Cookie "kinopoisk.ru" deleted
Comment 2•3 years ago
|
||
Can you reproduce this in safe mode? Though I'm not sure how an addon would mess with cookies like that.
This is more of a privacy issue for a non-standard feature than a sec issue, so I'm going to unhide it.
Comment 3•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Graphics: WebRender' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 4•3 years ago
|
||
I'm not sure if this should live under a toolkit storage kind of component or networking cookies. Probably the former. Of course, it depends on what exactly is happening.
(In reply to Andrew McCreight [:mccr8] from comment #2)
Can you reproduce this in safe mode? Though I'm not sure how an addon would mess with cookies like that.
This is more of a privacy issue for a non-standard feature than a sec issue, so I'm going to unhide it.
succesfully reproduced in safe mode
Comment 6•3 years ago
|
||
How are you restarting Firefox to clear cookies, and do you have session restore ("Startup - open previous windows and tabs") enabled?
(In reply to :Gijs (he/him) from comment #6)
How are you restarting Firefox to clear cookies, and do you have session restore ("Startup - open previous windows and tabs") enabled?
How are you restarting Firefox to clear cookies
i have "Delete cookies and site data when Firefox is closed" checked on, open only tab kinopoisk.ru, and then close the only tab with "kinopoisk.ru"
do you have session restore ("Startup - open previous windows and tabs") enabled
no
you can reproduce the bug in your own in about 10 sec, come on
(In reply to :Gijs (he/him) from comment #6)
How are you restarting Firefox to clear cookies, and do you have session restore ("Startup - open previous windows and tabs") enabled?
How are you restarting Firefox to clear cookies
to be more verbose:
- i ensure that no tabs open
- i ensure that there is no cookie "kinopoisk.ru" at about:preferences#privacy -> "Manage data"
- i ensure that "Clear history when Firefox closes" is checked on at about:preferences#privacy -> "History" section
- i ensure that "Cookies" is checked on in setting of "Clear history when Firefox closes" setting at about:preferences#privacy -> "History" section
- i open kinopoisk.ru in new tab
- i close kinopoisk.ru tab
- i close browser using "x" icon in top right corner of the firefox window
- i ensure firefox browser is closed using "ps -ef | grep firefox"
- i open firefox browser
is it clear enough?
Comment 10•3 years ago
|
||
Hey Vladislav,
You have experienced this issue for kinopoisk.ru/yandex.ru and the cookies of other sites are properly deleted right?
I have not managed to reproduce this yet, cookies for kinopoisk.ru are deleted after a restart for me.
The about support data also looks fine, though it says that you have a User.js, could you share this with us so we can make sure there is nothing in there that could be triggering this?
Thank you!
Comment 12•3 years ago
|
||
(In reply to Vladislav from comment #8)
you can reproduce the bug in your own in about 10 sec, come on
The problem is that we can't (ie we've tried and we aren't able to reproduce the problem, cf. comment 10), so we need to figure out what is different between your environment and the one we're using.
Comment 13•3 years ago
|
||
Thank you for that user.js. On first sight the user.js does not look suspicious. Are the cookies only persisted if you do the cleaning on shutdown or are they also persisted if you clear without shutting Firefox down, via clear history or clear data ?
| Reporter | ||
Comment 14•3 years ago
|
||
(In reply to hpeuckmann from comment #13)
Thank you for that user.js. On first sight the user.js does not look suspicious. Are the cookies only persisted if you do the cleaning on shutdown or are they also persisted if you clear without shutting Firefox down, via
clear historyorclear data?
if i manually clear history/data they, and all the cookies added to "exceptions" are removed
Comment 15•3 years ago
|
||
Ok, interesting. Something that we can try is to get the logs from the sanitizer, to see if we fail there. But this is a bit laborious:
First of all you need to set the right log level:
- Go to about:config and set
browser.sanitizer.logleveltoAll
Open the browser toolbox:
- Open the web developer tools, click on the three dots menu
...and open the settings.
underAdvanced settingsenable the check boxes forEnable browser chrome and add-on debuging toolboxandenable remote debugging.
After that you should be able to open the browser toolbox, for example via theapplication menuundermore tools.
Run the shutdown cleaning:
- In the browser toolbox open the console.
Type in and press enter:
var { Sanitizer } = ChromeUtils.import(
"resource:///modules/Sanitizer.jsm"
);
- Type in:
Sanitizer.runSanitizeOnShutdown();
hit enter and the sanitizer will run the code that is usually run on shutdown.
You can also find instructions on how to enable/open/use the browser toolbox here
Please share the logs you see with us.
| Reporter | ||
Comment 16•3 years ago
|
||
added santizier log.
cookie "kinopoisk.ru" still persists after i run sanitizer manually following your instuctions.
| Reporter | ||
Comment 17•3 years ago
|
||
all the cookies i see in sanitizer log are from websites that i added to exceptions (about:preferences#privacy -> cookies and site data -> manage exceptions).
as for example: i added exception for sports.ru, and in log i see both senoval.sports.ru and sports.ru.
i see no kinopoisk.ru cookie in the log, so i can conclude it is ignored by sanitizer, and it is not removed.
Comment 18•3 years ago
•
|
||
Thank you for making that effort!
So, let me summarize what we know so far:
- this only happens for the shutdown cleaning not for the cleaning processes during a running session
-- for the most part the same code is running with the difference that we do not clear per principal during a session. - on shutdown, all exceptions are considered and all cookies are deleted, except for that one site "kinopoisk.ru"
- The site does not show up in the logs, the sanitizer could be failing silently, but I don't think so. If its a bug in the code we should be experiencing this as well. I think its more likely that the principal for that site is somehow not provided to the sanitizer, also indicated by the fact that the cookies are cleared if we do not clear per principal.
Me and Paul were also thinking maybe those are session cookies that are restored somehow, if so they shouldn't show up in the sanitizer log, but they do show up in my log.
@Gijs any idea? Do you see anything in the about:support or user.js that looks suspicious?
Comment 19•3 years ago
|
||
Also, @Vladislav can you reproduce this with a fresh profile? I know you already tested this in safe mode but, to know if it is also reproducible with a fresh profile will be valuable.
You can create and launch a fresh profile via about:profiles.
| Reporter | ||
Comment 20•3 years ago
|
||
(In reply to hpeuckmann from comment #19)
Also, @Vladislav can you reproduce this with a fresh profile? I know you already tested this in safe mode but, to know if it is also reproducible with a fresh profile will be valuable.
You can create and launch a fresh profile viaabout:profiles.
hmm, couldn't reproduce with a new profile. all cookies are deleted as expected
Comment 21•3 years ago
|
||
I think its more likely that the principal for that site is somehow not provided to the sanitizer, also indicated by the fact that the cookies are cleared if we do not clear per principal.
This seems like a reasonable explanation to me. What I'm less clear on is why we wouldn't get the principal for these cookies... I guess logging the hosts + origin attributes for Services.cookies.cookies where the host contains either yandex or kinopoisk might help figure that out?
| Reporter | ||
Comment 22•3 years ago
|
||
i found out the reason.
i have music.yandex.ru in exceptions.
if i delete it, and then restart browser - kinopoisk.ru and yandex.ru cookies are deleted as expected.
yandex uses some tricky way to authenticate user, that bypasses total cookie protection too: if i login with my account at music.yandex.ru i get recognized at yandex.ru, kinopoisk.ru, and the rest of yandex products.
btw i can't still understand what relation between exception "music.yandex.ru" and "kinopoisk.ru" (except both are products of yandex ecosystem): if kinopoisk is not added in exceptions, its cookie expected to be deleted.
Comment 23•3 years ago
|
||
Interesting, thank you for letting us know.
I can reproduce this behavior with an allow exception for yandex.
Comment 24•3 years ago
•
|
||
Total cookie protection built into Firefox uses cookie jars per top-level site. This also changes our site data UI. That means all cookies that are set for and under kinopoisk.ru will be listed under the kinopoisk.ru entry. I haven't verified this yet, but I assume that kinopoisk.ru embeds music.yandex.ru. If you add an a exception for this Yandex domain its cookies won't be cleared on shutdown and will still show up in the manage data UI as kinopoisk.ru.
Once we confirm that this is happening we can either close the bug since this works as intended, or keep it for improving the UX. There is a bit a disconnect now that exceptions are still per-site but the data management UI groups per top level (what you see in the URL-bar).
| Reporter | ||
Comment 25•3 years ago
|
||
B(In reply to Paul Zühlcke [:pbz] from comment #24)
If you add an a exception for this Yandex domain its cookies won't be cleared on shutdown and will still show up in the manage data UI as kinopoisk.ru
I dont get it, let's go through a few examples.
Environment:
- I have "Delete cookies and site data when Firefox is closed" enabled
- I have music.yandex.ru in exceptions
Example #1:
I log in to my account at music.yandex.ru, and go kinopoisk.ru in separate tab.
I get these cookies:
- kinopoisk.ru (top-level)
1.1. music.yandex.ru (third-party) - music.yandex.ru (top-level)
My expectations:
a) 1.1 is isolated until restart (because total cookie protection should isolate 3rd-party cookies)
b) 1 and 1.1 are removed on restart (1 is not whitelisted through exceptions)
c) 2 is persisted
Example #2:
I log in to my account at music.yandex.ru, and go yandex.ru in separate tab.
I get these cookies:
- yandex.ru (top-level)
1.1. music.yandex.ru (third-party)
1.2. kinopoisk.ru (third-party)
My expectations:
a) 1.1 and 1.2 are isolated until restart (because total cookie protection should isolate 3rd-party cookies)
b) 1, 1.1 and 1.2 are removed on restart (not whitelisted through exceptions)
Do i have wrong expectations?
Comment 26•3 years ago
|
||
I don't know how yandex or kinopoisk sets cookies exactly, but let's assume they all set cookies in all contexts:
Example 1 seems accurate given music.yandex.ru is embedded and you also open both sites in the top level context. Cookie clearing exceptions currently do not take state partitioning (Total Cookie Protection) into account. That means your exception for music.yandex.ru will exempt any cookies from music.yandex.ru from being cleared, whether that's the in first-party or as an embedded third-party.
Your expectation a) generally applies given Total Cookie Protection is enabled..
Concerning b) whether this is expected behavior isn't clear. You could argue both ways:
Perhaps you have some settings stored for music.yandex.ru in the third-party context too and you don't want those to get cleared, thus you want to exempt music.yandex.ru anywhere.
At the same time I see how this is unintuitive to users especially since the data management UI only shows cookie jars now (like how you structured your example). Users may expect exceptions to only apply to the cookie jars.
Ben, when you're back in the office, do you think we should change our exceptions to apply to cookie jars, taking partitionKey into account, rather than the individual cookie hosts?
Comment 27•3 years ago
|
||
(In reply to Paul Zühlcke [:pbz] from comment #26)
I don't know how yandex or kinopoisk sets cookies exactly, but let's assume they all set cookies in all contexts:
Example 1 seems accurate given
music.yandex.ruis embedded and you also open both sites in the top level context. Cookie clearing exceptions currently do not take state partitioning (Total Cookie Protection) into account. That means your exception formusic.yandex.ruwill exempt any cookies frommusic.yandex.rufrom being cleared, whether that's the in first-party or as an embedded third-party.Your expectation a) generally applies given Total Cookie Protection is enabled..
Concerning b) whether this is expected behavior isn't clear. You could argue both ways:
Perhaps you have some settings stored for music.yandex.ru in the third-party context too and you don't want those to get cleared, thus you want to exempt music.yandex.ru anywhere.
At the same time I see how this is unintuitive to users especially since the data management UI only shows cookie jars now (like how you structured your example). Users may expect exceptions to only apply to the cookie jars.Ben, when you're back in the office, do you think we should change our exceptions to apply to cookie jars, taking partitionKey into account, rather than the individual cookie hosts?
If I understand correctly, would this potentially break SSO style cookie uses unless you created exceptions for every site using the SSO identity provider? That would seem not great for that usecase...
Could a different solution be to show the second associated domain in the site data manager, perhaps in parens or something? I think this would alleviate the "surprise" here around why the yandex / kinopoisk cookies persist.
Comment 28•3 years ago
|
||
(In reply to :Gijs (he/him) from comment #27)
(In reply to Paul Zühlcke [:pbz] from comment #26)
I don't know how yandex or kinopoisk sets cookies exactly, but let's assume they all set cookies in all contexts:
Example 1 seems accurate given
music.yandex.ruis embedded and you also open both sites in the top level context. Cookie clearing exceptions currently do not take state partitioning (Total Cookie Protection) into account. That means your exception formusic.yandex.ruwill exempt any cookies frommusic.yandex.rufrom being cleared, whether that's the in first-party or as an embedded third-party.Your expectation a) generally applies given Total Cookie Protection is enabled..
Concerning b) whether this is expected behavior isn't clear. You could argue both ways:
Perhaps you have some settings stored for music.yandex.ru in the third-party context too and you don't want those to get cleared, thus you want to exempt music.yandex.ru anywhere.
At the same time I see how this is unintuitive to users especially since the data management UI only shows cookie jars now (like how you structured your example). Users may expect exceptions to only apply to the cookie jars.Ben, when you're back in the office, do you think we should change our exceptions to apply to cookie jars, taking partitionKey into account, rather than the individual cookie hosts?
If I understand correctly, would this potentially break SSO style cookie uses unless you created exceptions for every site using the SSO identity provider? That would seem not great for that usecase...
Could a different solution be to show the second associated domain in the site data manager, perhaps in parens or something? I think this would alleviate the "surprise" here around why the yandex / kinopoisk cookies persist.
Usually SSO logins use popups or top level redirects which grants them either first party cookie access because they're top level, or they automatically get storage access per our state partitioning heuristics. So I'm not too worried about this specific case.
We could update our site data manager to show partitioned data in some sort of hierarchy, but I think that's very hard to get right without confusing users. The current way we display storage is nice because it directly reflects the site the user has visited in the top level / what they saw in the urlbar.
Updated•3 years ago
|
Comment 29•3 years ago
|
||
Ben, when you're back in the office, do you think we should change our exceptions to apply to cookie jars, taking partitionKey into account, rather than the individual cookie hosts?
Can you clarify what you mean by "taking partitionKey into account"?
My intuition reading the scrollback is that this is not obvious to users (or us) what the right thing to do for a singly-keyed UI element to do in the face of double-keying. My gut says that we should just use the domain the user provides as a list of top-level domains to permit to keep storage, clearing that same domain in third-party contexts since iframes appear to the user to be a part of the embedder origin's content.
Comment 30•3 years ago
|
||
(In reply to Paul Zühlcke [:pbz] from comment #24)
Total cookie protection built into Firefox uses cookie jars per top-level site. This also changes our site data UI. That means all cookies that are set for and under
kinopoisk.ruwill be listed under thekinopoisk.ruentry. I haven't verified this yet, but I assume thatkinopoisk.ruembedsmusic.yandex.ru. If you add an a exception for this Yandex domain its cookies won't be cleared on shutdown and will still show up in the manage data UI askinopoisk.ru.
Once we confirm that this is happening we can either close the bug since this works as intended, or keep it for improving the UX. There is a bit a disconnect now that exceptions are still per-site but the data management UI groups per top level (what you see in the URL-bar).
looking at the partitionKey of the cookies that are persisted, we can confirm that kinopoisk.ru is indeed partitioned under .yandex.ru
Services.cookies.cookies.map(c => ({partitionKey: c.originAttributes.partitionKey, host: c.host}))
Array(16) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
0: Object { partitionKey: "", host: "addons.mozilla.org" }
1: Object { partitionKey: "", host: "addons.mozilla.org" }
2: Object { partitionKey: "(https,kinopoisk.ru)", host: ".yandex.ru" }
3: Object { partitionKey: "(https,kinopoisk.ru)", host: ".yandex.ru" }
4: Object { partitionKey: "(https,kinopoisk.ru)", host: ".yandex.ru" }
5: Object { partitionKey: "(https,kinopoisk.ru)", host: ".yandex.ru" }
6: Object { partitionKey: "", host: "addons.mozilla.org" }
7: Object { partitionKey: "", host: ".yandex.ru" }
8: Object { partitionKey: "", host: ".yandex.ru"
Comment 31•3 years ago
|
||
(In reply to hpeuckmann from comment #30)
looking at the partitionKey of the cookies that are persisted, we can confirm that
kinopoisk.ruis indeed partitioned under.yandex.ru
Thank you for testing this! Just a small correct: It's the other way around, .yandex.ru cookies are partitioned under kinopoisk.ru. That's why kinopoisk.ru shows in the data management UI.
(In reply to bvandersloot from comment #29)
Ben, when you're back in the office, do you think we should change our exceptions to apply to cookie jars, taking partitionKey into account, rather than the individual cookie hosts?
Can you clarify what you mean by "taking partitionKey into account"?
My intuition reading the scrollback is that this is not obvious to users (or us) what the right thing to do for a singly-keyed UI element to do in the face of double-keying. My gut says that we should just use the domain the user provides as a list of top-level domains to permit to keep storage, clearing that same domain in third-party contexts since iframes appear to the user to be a part of the embedder origin's content.
Thanks! Yes, that does sound like the more intuitive solution and it would match our existing data UI + how we clear data better. Let's keep this bug for this work then. It's probably backlog though.
Updated•3 years ago
|
| Reporter | ||
Comment 32•3 years ago
|
||
(In reply to bvandersloot from comment #29)
My intuition reading the scrollback is that this is not obvious to users (or us) what the right thing to do for a singly-keyed UI element to do in the face of double-keying. My gut says that we should just use the domain the user provides as a list of top-level domains to permit to keep storage, clearing that same domain in third-party contexts since iframes appear to the user to be a part of the embedder origin's content.
as a user i'd prefer this behavior to be configurable and well documented for end user.
i see it as radio/select box with 2 options
- current behavior
- behavior you described in quoted comment
a link "learn more" (as the most "lean" option) to see the details (and side effects) of each option right in the exceptions UI is necessary.
| Reporter | ||
Comment 33•3 years ago
|
||
(In reply to Vladislav from comment #32)
(In reply to bvandersloot from comment #29)
My intuition reading the scrollback is that this is not obvious to users (or us) what the right thing to do for a singly-keyed UI element to do in the face of double-keying. My gut says that we should just use the domain the user provides as a list of top-level domains to permit to keep storage, clearing that same domain in third-party contexts since iframes appear to the user to be a part of the embedder origin's content.
as a user i'd prefer this behavior to be configurable and well documented for end user.
i see it as radio/select box with 2 options
- current behavior
- behavior you described in quoted comment
a link "learn more" (as the most "lean" option) to see the details (and side effects) of each option right in the exceptions UI is necessary.
good effect: in this case you can set current behavior as default option for users who has at least one exception, to avoid breaking his expectations/experience on browser update.
Description
•