Commit Graph

118 Commits

Author SHA1 Message Date
Benjamin VanderSloot
602caa8882 Bug 1765309, part 1 - Create helper functions for common logic between hSA and rSA, r=anti-tracking-reviewers,timhuang
I also had to pull a helper function for determining if a document is "third-party" out.
Much of this will be useful for Bug 1765307 as well.

Differential Revision: https://phabricator.services.mozilla.com/D146343
2022-05-20 11:46:04 +00:00
Paul Zuehlcke
bf0de26e78 Bug 1755209 - Only store 3rdPartyStorage permissions for supported principal types. r=anti-tracking-reviewers,bvandersloot
Depends on D139011

Differential Revision: https://phabricator.services.mozilla.com/D139012
2022-02-17 16:38:19 +00:00
Paul Zuehlcke
72f1748918 Bug 1755209 - Update SaveAccessForOriginOnParentProcess to only accept principal instead of origin string. r=anti-tracking-reviewers,bvandersloot
Passing in an nsIPrincipal gives us more control over the origin. We can ensure that it's valid and contains no origin attributes
Also, it allows us validate the principal type.
Previously some consumers would pass in a full origin with OA suffix. This patch changes it so we only use OriginNoSuffix.

Differential Revision: https://phabricator.services.mozilla.com/D139011
2022-02-17 16:38:19 +00:00
Benjamin VanderSloot
fd81e05f0c Bug 1680844 - requestStorageAccess grants for cross-site iframes should give out storageAccessAPI permissions, r=anti-tracking-reviewers,pbz
- Add observation of user interaction (for purpose of handing out storageAccessAPI permission) during grants of requestStorageAccess
	- This will not observe user interaction when a page requests the permission when they already have it, by design
	- This should also not observe user interaction when the grant is due to a heuristic.
- Add tests that verify adding user interaction on grant and autogrant. Plus one more test to verify that we do not add user interaction on deny

Differential Revision: https://phabricator.services.mozilla.com/D132025
2021-12-08 12:10:52 +00:00
Benjamin VanderSloot
1793417017 Bug 1731739 part 2 - Use site as key for 3rdPartyStorage permissions, rather than origin r=anti-tracking-reviewers,pbz,timhuang
- Adding browser tests to verify correct behavior in integration
    - New test that fails on previous version: toolkit/components/antitracking/test/browser/browser_storageAccessScopeSameSiteWrite.js
- Add the ability to store permission by site, use 3rdPartyStorage for this
- No change is made to permission reads. These already proceed recursively, which eventually reach the site.
- When fetching all permissions for a principal, also look for site-scoped permissions on its site's principal

Differential Revision: https://phabricator.services.mozilla.com/D130675
2021-11-23 18:25:58 +00:00
Marian-Vasile Laza
88f9e0defb Backed out 3 changesets (bug 1731739) for causing build bustages on PermissionManager.cpp.
Backed out changeset 2f723b6e625b (bug 1731739)
Backed out changeset 7b053cfeab3e (bug 1731739)
Backed out changeset c4a31c29c441 (bug 1731739)
2021-11-23 19:06:14 +02:00
Benjamin VanderSloot
5ad5689e47 Bug 1731739 part 2 - Use site as key for 3rdPartyStorage permissions, rather than origin r=anti-tracking-reviewers,pbz,timhuang
- Adding browser tests to verify correct behavior in integration
    - New test that fails on previous version: toolkit/components/antitracking/test/browser/browser_storageAccessScopeSameSiteWrite.js
- Add the ability to store permission by site, use 3rdPartyStorage for this
- No change is made to permission reads. These already proceed recursively, which eventually reach the site.
- When fetching all permissions for a principal, also look for site-scoped permissions on its site's principal

Differential Revision: https://phabricator.services.mozilla.com/D130675
2021-11-23 16:18:42 +00:00
Tim Huang
8ec1ef92c2 Bug 1724376 - Part 5: Add support of calling ContentBlocking::AllowAccessFor() for the privilege request storage access API. r=dimi,pbz
To support calling ContentBlocking::AllowAccessFor() for the privilege
request storage access API, we need to make small adjustment regarding
the algorithm which is used to decided if we can run in the current
process. Also, we need to exempt the privilege API from the user interaction.

Differential Revision: https://phabricator.services.mozilla.com/D123807
2021-10-05 15:16:21 +00:00
Tim Huang
9482d0316c Bug 1724376 - Part 4: Add a ContentBlocking::AsyncShouldAllowAccessFor(). r=dimi,pbz
This patch implements a async version of the ShouldAllowAccess check.
The method will check if a principal is allowed to access storage under
a given browsing context.

Differential Revision: https://phabricator.services.mozilla.com/D123806
2021-10-05 15:16:20 +00:00
Tim Huang
039daf7814 Bug 1724376 - Part 3: Add ContentBlocking::CheckTrackerForPrincipal(). r=dimi,pbz
We add a ContentBlocking::CheckTrackerForPrincipal() which checks
whether a principal belongs to a tracker.

Differential Revision: https://phabricator.services.mozilla.com/D123805
2021-10-05 15:16:20 +00:00
Tim Huang
6a4b384047 Bug 1731557 - Part 3: Check the fact if the channel/window is allowlisted in ContentBlocking checks. r=pbz
Priviously, the ContentBlocking::ShouldAllowAccessFor() checkes don't
check if the storage permission was came from the allowList or not. This
patch changes that and it will check if the channel/window is
allowlisted at the same moment as checking the ContentBlockingAllowList.
It returns early if the channel/window is in the allowList.

Differential Revision: https://phabricator.services.mozilla.com/D126278
2021-09-27 22:50:42 +00:00
Tim Huang
9d23edef76 Bug 1731557 - Part 2: Modify the antitracking code to use the nsILoadInfo.storagePermission. r=pbz
After we change the old nsILoadInfo.hasStoragePermission, we need to
modify the code that is using it.

Differential Revision: https://phabricator.services.mozilla.com/D126277
2021-09-27 22:50:41 +00:00
Paul Zuehlcke
23f053a50d Bug 1683165 - Add a pref to control anti-tracking webcompat features. r=timhuang,twisniewski,webcompat-reviewers,dimi
Differential Revision: https://phabricator.services.mozilla.com/D123614
2021-08-26 15:13:10 +00:00
Paul Zuehlcke
a44206bcfe Bug 1658578 - Remove nsContentUtils::IsThirdPartyWindowOrChannel. r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D122272
2021-08-11 10:37:18 +00:00
Alexis Beingessner
b8b572bfa0 Bug 1686616 - make ThirdPartyUtil use Components instead of Services. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D105523
2021-02-18 13:26:29 +00:00
Tim Huang
ca38c5e66b Bug 1672649 - Part 2: Notify the observer when there is user-interaction or storage access permission added. r=dimi
We need to report when permission is added in order to wait it
explicitly. These will be put be hind a pref
'privacy.antitracking.testing' and should be only used for testing.

Differential Revision: https://phabricator.services.mozilla.com/D94979
2020-11-04 12:41:40 +00:00
Tim Huang
fff99cf645 Bug 1672649 - Part 1: Make the storage access works on nested iframes. r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D94978
2020-11-04 12:41:33 +00:00
Tim Huang
1691a32c90 Bug 1668199 - Part 1: Add telemetry probe 'STORAGE_ACCESS_GRANTED_COUNT'. r=dimi
This 'STORAGE_ACCESS_GRANTED_COUNT' telemetry probe would record the
count of gratned storage access. And it would also record the reason
why the storage access has been granted.

Differential Revision: https://phabricator.services.mozilla.com/D92555
2020-10-07 11:27:03 +00:00
Dimi Lee
bdf0b3230e Bug 1658010 - Add null pointer check before notifying content block event r=xeonchen
Differential Revision: https://phabricator.services.mozilla.com/D86421
2020-08-08 06:00:00 +00:00
Dimi Lee
7aec9f4234 Bug 1654064 - P1. Use first-party check instead of top-level check while applying storage access heuristic r=baku
Differential Revision: https://phabricator.services.mozilla.com/D85826
2020-08-06 12:52:52 +00:00
Andreea Pavel
a5fc01283e Backed out 2 changesets (bug 1654064) for failing android at test_third_party_iframes.html on a CLOSED TREE
Backed out changeset 23e5e026f179 (bug 1654064)
Backed out changeset 90bf9f23c414 (bug 1654064)
2020-08-06 01:43:29 +03:00
Dimi Lee
b633199afb Bug 1654064 - P1. Use first-party check instead of top-level check while applying storage access heuristic r=baku
Differential Revision: https://phabricator.services.mozilla.com/D85826
2020-08-05 20:58:04 +00:00
Liang-Heng Chen
1456e77945 Bug 1650512 - propagate rejected reason when storage access is sandboxed; r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D84361
2020-07-22 11:40:53 +00:00
Andrea Marchesini
50a6d0f5ed Bug 1650950 - Rename blacklist, whitelist, and skiplist in the anti-tracking and url-classifier code, r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D82497
2020-07-07 16:17:11 +00:00
Dimi Lee
d686ff88c9 Bug 1645777 - Add nullptr check after calling AntiTrackingUtils::GetPrincipal r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D82076
2020-07-03 01:30:12 +00:00
Tim Huang
3602aaebe1 Bug 1648812 - Moving ReportUnblockingToConsole to the parent process and fix the console message. r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D81842
2020-07-02 12:37:37 +00:00
Simon Giesecke
a69d79b6db Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Jean-Yves Avenard
05adafa9ef Bug 1637500 - P2. Rename methods as they are not always dealing with "threads". r=froydnj
Before P1, GetCurrentThreadSerialEventTarget would have always returned the same data as NS_GetCurrentThread, making the comment incorrect Now it will properly return the running TaskQueue if any.

This change of name more clearly exposes what they are doing, as we aren't always dealing with threads directly; but a nsISerialEventTarget

Differential Revision: https://phabricator.services.mozilla.com/D80354
2020-06-23 05:05:36 +00:00
Dimi Lee
6742da999b Bug 1642919 - Remove MOZ_ASSERT in onAllowAccessFor r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D79648
2020-06-15 08:07:16 +00:00
Dimi Lee
77f4b5b86a Bug 1643115 - P1. Propagate storage permission to same-origin frames in the same agent-cluster r=baku
Differential Revision: https://phabricator.services.mozilla.com/D78135
2020-06-12 07:28:00 +00:00
Dimi Lee
468bb65847 Bug 1643128 - Add log in AllowAccessFor r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D78137
2020-06-10 09:31:27 +00:00
Dimi Lee
c1b1db6933 Bug 1644266 - Check whether inner window has extant document before using r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D78872
2020-06-09 10:51:11 +00:00
Andrea Marchesini
4486d794a5 Bug 1639833 - IntrisincStoragePrincipal should always be partitioned - part 4 - Renaming storage access permission methods, r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D76917
2020-06-03 06:12:06 +00:00
Andrea Marchesini
bd6a9308f6 Bug 1639833 - IntrisincStoragePrincipal should always be partitioned - part 3 - Cleanup storage access methods, r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D76916
2020-06-03 06:10:58 +00:00
Csoregi Natalia
ed3350ab9b Backed out 5 changesets (bug 1639833) for failures on browser_blockingIndexedDbInWorkers.js. CLOSED TREE
Backed out changeset 6b4f76d65540 (bug 1639833)
Backed out changeset c77acba1aacb (bug 1639833)
Backed out changeset 30c97666919e (bug 1639833)
Backed out changeset d769b313441a (bug 1639833)
Backed out changeset ed41b41d1b03 (bug 1639833)
2020-06-02 15:02:31 +03:00
Andrea Marchesini
f8cb8a47f6 Bug 1639833 - IntrisincStoragePrincipal should always be partitioned - part 4 - Renaming storage access permission methods, r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D76917
2020-06-02 08:30:24 +00:00
Andrea Marchesini
94eab0e791 Bug 1639833 - IntrisincStoragePrincipal should always be partitioned - part 3 - Cleanup storage access methods, r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D76916
2020-06-02 08:29:15 +00:00
Noemi Erli
2b060384fc Backed out 5 changesets (bug 1639833) for causing sessionstorage related failures CLOSED TREE
Backed out changeset b36af8d9db34 (bug 1639833)
Backed out changeset 712c11904dbe (bug 1639833)
Backed out changeset 14f1e4783582 (bug 1639833)
Backed out changeset b7f14c4cfe5d (bug 1639833)
Backed out changeset b4b25034dd83 (bug 1639833)
2020-06-01 19:31:50 +03:00
Andrea Marchesini
a8fe277146 Bug 1639833 - IntrisincStoragePrincipal should always be partitioned - part 4 - Renaming storage access permission methods, r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D76917
2020-06-01 11:59:46 +00:00
Andrea Marchesini
28760b5629 Bug 1639833 - IntrisincStoragePrincipal should always be partitioned - part 3 - Cleanup storage access methods, r=dimi
Differential Revision: https://phabricator.services.mozilla.com/D76916
2020-06-01 11:07:36 +00:00
Tim Huang
6c7ea918f0 Bug 1641153 - Part 2: Add checking nested iframe in the ContentBlocking::ShouldAllowAccessFor(channel). r=dimi
We should check the nested iframe in the
ContentBlocking::ShouldAllowAccessFor(channel) as well. This patch
implements this.

Differential Revision: https://phabricator.services.mozilla.com/D77075
2020-05-28 11:39:26 +00:00
Tim Huang
7369158801 Bug 1637226 - Part 2: Make the ContentBlocking::ShouldAllowAccessFor(channel) to check sandbox flag. r=dimi
Depends on D76731

Differential Revision: https://phabricator.services.mozilla.com/D76732
2020-05-26 07:27:23 +00:00
kasun
a0010a3eb6 Bug 1626754 - ContentBlocking.cpp: removed else after return. r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D75704
2020-05-18 15:58:27 +00:00
Dimi Lee
c319633578 Bug 1624269 - P4. Not using permission manager to sync HasStorageAccess. r=timhuang,baku
We already have an architecture to sync the storage access granted
result to all 3rd-party frames with the same tracking origin.
We use the same way to sync HasStorageAccess flag instead of relying
on permission manager update permissions to child processes.

Differential Revision: https://phabricator.services.mozilla.com/D73711
2020-05-18 11:04:48 +00:00
Dimi Lee
edbae6f8d4 Bug 1624269 - P3. Inform all the windows whose storage permission is granted. r=timhuang,baku
Before this patch, we only call StorageAccessGranted on windows that
triggers the storage heuristics. So even if we sync storage permission to the
other frames, their data will not be refreshed. For example, if a document
has a worker, we don't propagate the permission to the worker.

In this patch, we call ::StorageAccessGranted as long as we update
the window's storage permission.

Differential Revision: https://phabricator.services.mozilla.com/D74321
2020-05-18 11:58:25 +00:00
Dimi Lee
0278009ca4 Bug 1624269 - P2. Cache access granted result in the 3rd-party window instead of top-level window in fission mode. r=timhuang,baku
Before this patch, in non-fission mode, we cache storage access granted result
in the top-level window so we don't have to iterate all the browsing contexts
in the same tree while syncing the storage permission granted decision.

However, since we plan to rely on the current update mechanism to sync
mHasStorageAccess flag for different documents in the same tab (instead of using
the syncing mechanism of permission manager), we will eventually need to iterate
the browsing context tree to find all the documents to sync. Base on this,
we no longer have to maintain different method for fission and non-fission.

In this patch, we store the permission granted result in the inner
window instead of using permission key and store the key in the top-level
window.

Differential Revision: https://phabricator.services.mozilla.com/D73710
2020-05-18 11:04:50 +00:00
Dimi Lee
8b7c9179ff Bug 1624269 - P1. Only get CookieBehavior once r=timhuang,baku
CookieBehavior should be the same for all the frames in the same tab,
we don't have to get its value for every browsing context in the same
browsing context tree.

Differential Revision: https://phabricator.services.mozilla.com/D73709
2020-05-18 11:04:41 +00:00
Csoregi Natalia
4b018a6d28 Backed out 5 changesets (bug 1624269) for browser-chrome failures on browser_storageAccessWithHeuristics.js. CLOSED TREE
Backed out changeset 59cdba115447 (bug 1624269)
Backed out changeset 23b5c53f4be8 (bug 1624269)
Backed out changeset be697a5bc0fd (bug 1624269)
Backed out changeset 81420bca683c (bug 1624269)
Backed out changeset 599db5acefe1 (bug 1624269)
2020-05-18 13:59:44 +03:00
Dimi Lee
5eaaf0d480 Bug 1624269 - P4. Not using permission manager to sync HasStorageAccess. r=timhuang,baku
We already have an architecture to sync the storage access granted
result to all 3rd-party frames with the same tracking origin.
We use the same way to sync HasStorageAccess flag instead of relying
on permission manager update permissions to child processes.

Differential Revision: https://phabricator.services.mozilla.com/D73711
2020-05-18 09:14:09 +00:00
Dimi Lee
079489a3d3 Bug 1624269 - P3. Inform all the windows whose storage permission is granted. r=timhuang,baku
Before this patch, we only call StorageAccessGranted on windows that
triggers the storage heuristics. So even if we sync storage permission to the
other frames, their data will not be refreshed. For example, if a document
has a worker, we don't propagate the permission to the worker.

In this patch, we call ::StorageAccessGranted as long as we update
the window's storage permission.

Differential Revision: https://phabricator.services.mozilla.com/D74321
2020-05-18 09:09:57 +00:00