Epiphany cookie whitelist HOWTO
How to configure the Epiphany web browser to ignore the expiry date of cookies, deleting them when the browser is closed, unless the cookies are from a whitelisted web site.
Instructions
These instructions apply to Epiphany using the gecko backend. Instructions for WebKit are forthcoming.
Default cookie policy
Configure Epiphany so that all cookies are expired at the end of the browser session:
'Edit' → 'Preferences' → 'Privacy' → 'Cookies': Only from sites you visit
In about:config, set network.cookie.lifetimePolicy to 2
If you want to totally ignore cookies instead, you could try setting network.cookie.lifetimePolicy to 3 and network.cookie.lifetime.days to 0. Please let me know if this does or does not work.
Create site-specific cookie rules
We will now create a whitelist of domains for which cookies will not have their expiry dates overridden.
Manually
The steps that you must take depend on the backend that Epiphany is using. You can discover which backend you are using by going to 'Help' → 'About' and looking for the "Powered by (engine)" text.
If you are using the gecko-1.8 backend, create ~/.gnome2/epiphany/mozilla/epiphany/hostperm.1:
# Permission File # This is a generated file! Do not edit. host cookie 1 slashdot.org host cookie 1 lwn.net host cookie 1 bugzilla.gnome.org host cookie 1 bugs.freedesktop.org
The gaps between the fields must be tabs, or the line will be ignored.
If you are using the gecko-1.9 backend, you will need to install sqlite3, and then run sqlite3 ~/.gnome2/epiphany/mozilla/epiphany/permissions.sqlite:
sqlite> INSERT INTO moz_hosts (host, type, permission) VALUES ('slashdot.org', 'cookie', 1); sqlite> INSERT INTO moz_hosts (host, type, permission) VALUES ('lwn.net, 'cookie', 1); sqlite> INSERT INTO moz_hosts (host, type, permission) VALUES ('bugzilla.gnome.org', 'cookie', 1); sqlite> INSERT INTO moz_hosts (host, type, permission) VALUES ('bugzilla.freedesktop.org', 'cookie', 1);
Cookie whitelist extension
Alternatively, you can install the extension that I wrote. It is unpolished, but usable—it certainly beats certainly beats using sqlite3 if you are using the gecko-1.9 backend!
To install the extension, drop cookie-whitelist.ephy-extension and cookie-whitelist.py in your ~/.gnome2/epiphany/extensions directory, and then restart Epiphany. Finally, go to 'Tools' → 'Extensions' and enable the 'Cookie whitelist' extension.
You can now add and remove whitelist entries by going to 'Tools' → 'Cookie Whitelist...'
Remove old cookies
Epiphany will not automatically expire non-whitelisted cookies that are already present on your system, so you must do this yourself.
- Exit Epiphany
Delete the ~/.gnome2/epiphany/mozilla/epiphany/cookies.txt file if using the gecko-1.8 backend, or ~/.gnome2/epiphany/mozilla/epiphany/cookies.sqlite. If you don't want to blow away all your cookies, edit the appropriate file instead. Obviously, editing cookies.txt in your text editor is far more convenient than running SQL queries against cookies.sqlite. I guess that is the price of progress.
Run Epiphany, and browse with privacy and style!
Whitelist API
It is possible to manipulate the whitelist using Epiphany's extensions mechanism. An example in Python:
1 import epiphany
2 s = epiphany.ephy_shell_get_default ().get_embed_single ()
3
4 # add an entry to the whitelist; note the first argument is a URL
5 s.add_permission ("http://lwn.net", "cookie", epiphany.PERMISSION_ALLOWED)
6
7 s.list_permissions ("cookie");
8
9 # remove an entry from the whitelist; note the first argument is a host name
10 s.remove_permission ("lwn.net", "cookie")
This is how my cookie whitelist extension (above) works.