Lusito / forget-me-not

Make the browser forget website data, except for the data you want to keep.
zlib License
227 stars 25 forks source link

Local Cookies Aren't Removed #42

Open Joel889 opened 6 years ago

Joel889 commented 6 years ago

Download a page that uses cookies onto your desktop. Open it from your desktop. Close tab. Cookies remain and cannot be cleaned even using manual cleaning.

Joel889 commented 6 years ago

Is this referring to bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1440263

Regardless, I know there is a solution, because another addon had a similar issue but resolved it. I'm sure you are familiar with the extension, it ends in auto delete.

Lusito commented 6 years ago

Perhaps bug was the wrong label to give this.. since this is more of an enhancement. Cookies from stored pages are not bound to a domain.. They only have a file path. Cookies that are not bound to a domain are currently not handled. It's not like it's hard to solve.. I've just been very busy lately with moving to a new city.. I finally got internet hooked up today in my new apartment, but there are more important issues right now.

Joel889 commented 6 years ago

I started noticing domainless cookies frequently, even without opening a webpage from the hard drive. I'm sure how these cookies are set and where they are coming from, but I got them.

Lusito commented 6 years ago

Domainless cookies that are from local files always have the path set to where the html file was stored. Try to inspect the cookie details and see if a path has been set for those cookies, that matches some path on your hard-drive.

If it doesn't have such a path, then it is probably not a cookie related to local html files. More likely is, that either Firefox or some extension sets these cookies for some reason.

practik commented 6 years ago

another addon had a similar issue but resolved it

It would be nice if that were true, but given that both https://github.com/Cookie-AutoDelete/Cookie-AutoDelete/issues/282 and https://github.com/Cookie-AutoDelete/Cookie-AutoDelete/issues/301 are still open, I don't think it's been resolved there either yet.

Lusito commented 6 years ago

The next version will improve the situation a bit: local cookies can then be cleaned by manual cleanup or on startup. This will however act as if all cookies from the users filesystem are from the same domain. There will be a checkbox under rules (default: checked), which allows you to whitelist files from your computer.

Cleanup on tab close will come at a different time, since this would require some rewriting of existing code.

practik commented 6 years ago

FYI, this doesn't seem to be working yet in 1.0.5, even though the release notes for 1.0.4. say that it should be. I tried clearing local cookies manually and on restart, but it didn't work either time. The checkbox to whitelist local files is unchecked. Am I doing something wrong?

Lusito commented 6 years ago

Well, the only thing I can think of, that might protect these cookies is the rule, that if a domain of the same name is still open (i.e. other local pages), then these cookies are protected. If you are running manual cleanup, you can disable this behavior by unchecking "Protect currently open domains..."

practik commented 6 years ago

Thanks for the suggestion. I did some testing, just of the manual cleanup function:

1. Set up a fresh Firefox profile and set new tabs to open blank pages (just to eliminate the default FF start page as a source of cached data). 2. Add FMN and don’t change any of its settings. 3. Open about:prefs#privacy, go to Cookies and Site Data, clear all data. 4. Open a local webpage in a new tab. 5. Refresh prefs tab and click Manage Data to verify that cookies have been set. 6. Close tab of local webpage and do a manual cleanup with FMN. Check cookies as in step 5: Not deleted. 7. In FMN, uncheck “Protect currently open domains…” and clean again. Check cookies: Still not deleted. 8. In FMN, uncheck “Apply Rules” for cookies and clean again. Check cookies: Finally gone.

I repeated 10 times, alternating between two different local webpages stored on my system, and not once did FMN clear the local cookies on default settings.

EDIT: Ignore this post and see the one below. Sorry for the confusion, I shouldn't test when I'm tired :-\

practik commented 6 years ago

I just realized that I posted the wrong STR above (I did a few different tests with different preferences). Of course those steps produced the result they did, because FMN's default settings include "Add files from your computer to whitelist." So try these steps instead:

  1. Set up a fresh Firefox profile and set new tabs to open blank pages (just to eliminate the default FF start page as a source of cached data).
  2. Add FMN and don’t change any of its settings, except uncheck "Add files from your computer to whitelist."
  3. Open about:prefs#privacy, go to Cookies and Site Data, clear all data.
  4. Open a local webpage in a new tab.
  5. Refresh prefs tab and click Manage Data to verify that cookies have been set.
  6. Close tab of local webpage and do a manual cleanup with FMN. Check cookies as in step 5: Not deleted.
  7. In FMN, uncheck “Protect currently open domains…” and clean again. Check cookies: Now they're gone.

I tested this way several times too (don't remember how many), and FMN was never able to clear the local cookies with “Protect currently open domains…” checked.

Could it be that FMN is treating the open about: tab as the same domain as local webpages?

Lusito commented 6 years ago

yes, every tab that doesn't have a domain name is treated as a local page. This is indeed a bit problematic.

Lusito commented 6 years ago

Thanks for the investigation

Joel889 commented 5 years ago

Well, the only thing I can think of, that might protect these cookies is the rule, that if a domain of the same name is still open (i.e. other local pages), then these cookies are protected. If you are running manual cleanup, you can disable this behavior by unchecking "Protect currently open domains..."

I don't think this working yet.