Implement a new cookie policy: block storage from trackers and partition all other third-party contexts
Categories
(Core :: Privacy: Anti-Tracking, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox69 | --- | fixed |
People
(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)
References
(Blocks 1 open bug)
Details
Attachments
(12 files)
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review |
STR:
- Set privacy.storagePrincipal.enabledForTrackers to true.
- Browse around.
- Look inside your cookie db:
sqlite3 /path/to/profile/cookies.sqlite.
This is because this code https://searchfox.org/mozilla-central/rev/b756e6d00728dda4121f8278a744381d8643317a/netwerk/cookie/nsCookieService.cpp#4045 isn't exactly correct, it accepts cookies which the anti-tracking backend tells us to reject!
| Assignee | ||
Comment 1•6 years ago
|
||
I think it would be nice to have a testing pref that applies the current cookie policy but uses storagePrincipal for all third-party loads.
| Assignee | ||
Comment 2•6 years ago
|
||
The thing that should really happen here is to implement a new cookie policy where we keep blocking trackers like we do today, but switch to partitioning everything else.
Here is a rough plan I've started to work on:
- define cookie policy value 5 in nsICookieService.idl
- modify the IsFirstPartyStorageGranted algorithms to work with it:
2.1 mostly follow BEHAVIOR_REJECT_TRACKER
2.2 if you're a third-party but not a tracker, return false with a new error code
(let's call it STATE_COOKIES_BLOCKED_FOREIGN_TO_PARTITION for now)
otherwise things will work mostly the same as BEHAVIOR_REJECT_TRACKER at the antitracking level - Rename ePartitionedOrDeny to ePartitionTrackersOrDeny
- introduce ePartitionForeignOrDeny = -2
- here, connect our new error code to ePartitionForeignOrDeny: https://searchfox.org/mozilla-central/source/dom/base/nsContentUtils.cpp#8564
- triage this list: https://searchfox.org/mozilla-central/search?q=symbol:E_%3CT_nsContentUtils%3A%3AStorageAccess%3E_ePartitionedOrDeny&redirect=false
most of the occurrences are cases where you're also checking the current storagePrincipal pref - in those cases, introduce a new branch to allow partitioning third-party contexts where we have ePartitionForeignOrDeny and cookie policy is BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN
Updated•6 years ago
|
| Assignee | ||
Comment 3•6 years ago
|
||
This new code designates our new cookie policy for blocking cookies and
storage access from third-party trackers and partitioning the cookie jar
of the rest of third-party resources.
| Assignee | ||
Comment 4•6 years ago
|
||
This error code indicates the specific case where the antitracking backend
rejects a particular access request because the resource is third-party and
the cookie policy mandates that third-party resources must be partitioned.
| Assignee | ||
Comment 5•6 years ago
|
||
The policy that this patch implements in the antitracking backend is to treat
third-party trackers exactly the same way as BEHAVIOR_REJECT_TRACKER, and
additionally partition all third-party contexts as well.
| Assignee | ||
Comment 6•6 years ago
|
||
| Assignee | ||
Comment 7•6 years ago
|
||
This StorageAccess code tells callers that they must partition third-party
storage, or deny storage access if that is not possible.
| Assignee | ||
Comment 8•6 years ago
|
||
| Assignee | ||
Comment 9•6 years ago
|
||
This API abstracts away the details of the decision on what context should be
partitioned away from the consumers and centralizes the decision making into
the same location in the code base.
| Assignee | ||
Comment 10•6 years ago
|
||
I still have some try failures: https://treeherder.mozilla.org/#/jobs?repo=try&revision=61f650214eb2564247708fb4f180f29c32429b28
I decided to hold off posting patches for now until this is fully green, but if you'd like to try things out the patches are available from the try push!
| Assignee | ||
Comment 11•6 years ago
|
||
OK, my patches are now ready for review and landing. I'll upload them now.
| Assignee | ||
Comment 12•6 years ago
|
||
| Assignee | ||
Comment 13•6 years ago
|
||
| Assignee | ||
Comment 14•6 years ago
|
||
| Assignee | ||
Comment 15•6 years ago
|
||
| Assignee | ||
Updated•6 years ago
|
| Assignee | ||
Updated•6 years ago
|
| Assignee | ||
Comment 16•6 years ago
|
||
This patch doesn't port all of the existing tests because some of them
do not pass yet and some others need more work to be ported. This will
happen in follow-up bugs.
Comment 17•6 years ago
|
||
Comment 18•6 years ago
|
||
Backed out for failures in browser_partitionedIndexedDB.js
Backout link: https://hg.mozilla.org/integration/autoland/rev/8fea661662875f667e79d9204438ce3cbfacbb46
Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=245572200&repo=autoland&lineNumber=4215
Comment 19•6 years ago
|
||
Comment 20•6 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/b26c4b43e858
https://hg.mozilla.org/mozilla-central/rev/a65a40d02a83
https://hg.mozilla.org/mozilla-central/rev/01ed57a466b7
https://hg.mozilla.org/mozilla-central/rev/230cca204ae1
https://hg.mozilla.org/mozilla-central/rev/c8636d91f3bd
https://hg.mozilla.org/mozilla-central/rev/56d3c90d31dd
https://hg.mozilla.org/mozilla-central/rev/e016de0230b1
https://hg.mozilla.org/mozilla-central/rev/ae4c8556193a
https://hg.mozilla.org/mozilla-central/rev/014736b1491c
https://hg.mozilla.org/mozilla-central/rev/fc834315384d
https://hg.mozilla.org/mozilla-central/rev/e646f2b47472
https://hg.mozilla.org/mozilla-central/rev/f481cd618aa1
| Assignee | ||
Updated•6 years ago
|
Description
•