gecko-dev/netwerk
Tom Ritter 502de3fe32 Bug 1830070: Correctly apply RFP Checks to about: documents and deal with pop-ups r=smaug,necko-reviewers,emilio
This patch has three parts to it:

1) Use NS_IsContentAccessibleAboutURI to ensure that only safe
   about: documents get exempted.

   With this change, we will no longer allow about:blank or
   about:srcdoc to be exempted base on URI.  If they are to be
   exempted, it will need to be base on other information.

2) In Document::RecomputeResistFingerprinting we previously
   deferred to a Parent Document if we had one, and either the
   principals matched or we were a null principal.

   We will do the same thing, except we will also defer to our
   opener as well as the parent document.  Now about:blank
   documents can be exempted.

   However, this deferral only works if the opener is
   same-process. For cross-process openers, we make the decision
   ourselves.

We can make the wrong decision though. CookieJarSettings is
inherited through iframes but it is _not_ inherited through popups.
(Yet. There's some discussion there, but it's not implemented.)

Conceptually; however, we do want CJS to inherit, and we do want
RFP to inherit as well.  Because a popup can collude with its
opener to bypass RFP and Storage restrictions, we should propagate
the CJS information.

This does lead to an unusual situation: if you have exempted
b.com, and a.com (which is not exempted) creates a popup for b.com
then that popup will not be exempted.  But an open tab for b.com
would be.  And it might be hard to tell those two apart, or why
they behave differently.

The third part of the patch:

3) In LoadInfo we want to populate information down from the
   opener to the popup.  This is needed because otherwise a
   cross-origin popup will not defer to its opener (because in
   Fission they're in different processes) and will decide if
   it should be exempted itself. It's the CookieJarSettings
   object that prevents the cross-origin document from thinking
   it should be exempted - CJS tells it 'No, you're a child
   (either a subdocument or a popup) and if I say you don't get
   an exemption, you don't.'


Finally, there is one more caveat: we can only defer to a parent
document or opener if it still exists.  A popup may outlive its
opener. If that happens, and something induces a call to
RecomputeResistFingerprinting, then (e.g.) an about:blank popup
may lose an RFP exemption that it had received from its parent.
This isn't expected to happen in practice -
RecomputeResistFingerprinting is only called on document creation
and pref changes I believe.

It is not possible for a popup to _gain_ an exemption though,
because even if the parent document is gone, the CJS lives on and
restricts it.

Differential Revision: https://phabricator.services.mozilla.com/D178866
2023-06-27 03:31:02 +00:00
..
base Bug 1830070: Correctly apply RFP Checks to about: documents and deal with pop-ups r=smaug,necko-reviewers,emilio 2023-06-27 03:31:02 +00:00
build Bug 1760018 - Clean up networking registrars earlier to avoid leaks. r=necko-reviewers,kershaw 2023-05-05 15:04:46 +00:00
cache2 Bug 1677718 - Completely remove AppCache API implementation r=necko-reviewers,emilio,jesup 2023-06-02 07:55:23 +00:00
cookie Bug 1832461 - Remove COOKIE_RETRIEVAL_SAMESITE_PROBLEM telemetry probe. r=cookie-reviewers,valentin 2023-06-19 09:25:06 +00:00
dns Bug 1838240 - Migrate these probes to glean: DNS_LOOKUP_TIME, DNS_RENEWAL_TIME, DNS_RENEWAL_TIME_FOR_TTL, DNS_FAILED_LOOKUP_TIME r=necko-reviewers,valentin 2023-06-22 16:02:57 +00:00
docs Bug 1838211 - Add presets for cookie, websocket, and Http3 logging, r=necko-reviewers,fluent-reviewers,valentin,flod 2023-06-26 12:13:02 +00:00
ipc Bug 1839325 - Add missing header dependency on mozilla/PSandboxTestingChild.h r=bobowen,necko-reviewers,jesup 2023-06-22 12:40:14 +00:00
locales Bug 1676651 - don't warn to console if a cookie is deleted r=dveditz 2023-04-28 14:33:34 +00:00
mime Bug 1838052 - Allow audio/aacp to always bypass the ORB check r=farre,necko-reviewers,valentin 2023-06-13 16:51:53 +00:00
protocol Bug 1659763 - Fix failing x-frame-options web platform tests; r=freddyb,necko-reviewers,valentin 2023-06-26 11:58:47 +00:00
sctp Bug 1826339 - Update to latest libusrsctp. r=bwc 2023-04-04 14:35:25 +00:00
socket Bug 1839762 - Cast scoped enums to their underlying type when printing them. r=media-playback-reviewers,necko-reviewers,application-update-reviewers,geckoview-reviewers,handyman,emilio,valentin,bytesized,owlish,karlt 2023-06-24 20:14:31 +00:00
streamconv Bug 1838415 - Use RFPTarget::JSDateTimeUTC for IndexedToHTML date/time formatting. r=tjr,necko-reviewers,valentin 2023-06-26 07:17:39 +00:00
system Bug 1839762 - Cast scoped enums to their underlying type when printing them. r=media-playback-reviewers,necko-reviewers,application-update-reviewers,geckoview-reviewers,handyman,emilio,valentin,bytesized,owlish,karlt 2023-06-24 20:14:31 +00:00
test Backed out 2 changesets (bug 1838829) for causing perma mochitest failure with dom/websocket/tests being skipped CLOSED TREE 2023-06-27 02:52:52 +03:00
url-classifier Bug 1826418 - Part 2: Added a clause to check for replaced shims scripts when classifying for other event types. r=timhuang 2023-05-26 08:10:50 +00:00
wifi Bug 1833020: Fix TestWifiMonitor async mock objects r=necko-reviewers,valentin 2023-06-26 19:54:41 +00:00
metrics.yaml Bug 1838240 - Migrate these probes to glean: DNS_LOOKUP_TIME, DNS_RENEWAL_TIME, DNS_RENEWAL_TIME_FOR_TTL, DNS_FAILED_LOOKUP_TIME r=necko-reviewers,valentin 2023-06-22 16:02:57 +00:00
moz.build Bug 1827504 - Remove last files of netwerk/cache/ r=sunil,geckoview-reviewers,zeid,m_kato 2023-04-13 09:04:24 +00:00