Commit Graph

25078 Commits

Author SHA1 Message Date
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
Norisz Fay
07a91b8c6a Backed out 2 changesets (bug 1838829) for causing perma mochitest failure with dom/websocket/tests being skipped CLOSED TREE
Backed out changeset 19a5d4f1850a (bug 1838829)
Backed out changeset 97cd8a256954 (bug 1838829)
2023-06-27 02:52:52 +03:00
Kershaw Chang
db61659980 Bug 1840300 - cancel async copy with NS_BASE_STREAM_CLOSED during shutdown, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181986
2023-06-26 20:59:05 +00:00
Butkovits Atila
fdecfc4373 Backed out 9 changesets (bug 1830070) for causing failures at browser_hwconcurrency_popups_blob_noopener.js. CLOSED TREE
Backed out changeset 62f439f5b2ad (bug 1830070)
Backed out changeset 92b5f8af326f (bug 1830070)
Backed out changeset ae685d3825b7 (bug 1830070)
Backed out changeset 4800b1312e99 (bug 1830070)
Backed out changeset 7ea9676f22ae (bug 1830070)
Backed out changeset 7a86f85ae0e8 (bug 1830070)
Backed out changeset 0a2d5f339e41 (bug 1830070)
Backed out changeset 7e5b72c73304 (bug 1830070)
Backed out changeset e4490bf3d040 (bug 1830070)
2023-06-27 00:12:07 +03:00
David Parks
96bc62185d Bug 1833020: Fix TestWifiMonitor async mock objects r=necko-reviewers,valentin
gMock objects cannot be reused after they receive calls to the mocked functions.  This patch changes the test to establish all of the mock expectations upfront for each network-change notification before running it.  It uses gMock Sequence objects and a checkpoint to maintain (partial) temporal order.

Differential Revision: https://phabricator.services.mozilla.com/D180622
2023-06-26 19:54:41 +00:00
Tom Ritter
78fae782d0 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-26 17:04:40 +00:00
Kershaw Chang
75c68b6864 Bug 1838829 - Skip failed tests, r=necko-reviewers,extension-reviewers,credential-management-reviewers,devtools-reviewers,dimi,valentin,robwu
Differential Revision: https://phabricator.services.mozilla.com/D181251
2023-06-26 14:22:14 +00:00
Kershaw Chang
bf87e869ec Bug 1838211 - Add presets for cookie, websocket, and Http3 logging, r=necko-reviewers,fluent-reviewers,valentin,flod
Differential Revision: https://phabricator.services.mozilla.com/D181993
2023-06-26 12:13:02 +00:00
june wilde
7b8235affc Bug 1659763 - Fix failing x-frame-options web platform tests; r=freddyb,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D180234
2023-06-26 11:58:47 +00:00
Stanca Serban
afe1b342fe Backed out changeset d925c8d667f1 (bug 1840300) for causing xpcshell failures in test_unix_domain.js. CLOSED TREE 2023-06-26 15:01:19 +03:00
Kershaw Chang
93af2179ad Bug 1840300 - cancel async copy with NS_BASE_STREAM_CLOSED during shutdown, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181986
2023-06-26 11:01:45 +00:00
Em Zhan
b6b6fe577b Bug 1798319 - Implement modulepreload in early hints r=manuel,smaug,necko-reviewers,kershaw
The aEarlyHintPreloaderId parameter for StartLoad/StartLoadInternal is changed
to be a member variable of ScriptLoadRequest instead so that an initiator type
of early hints can be set for module requests. Before, ModuleLoader would always
pass in a zero value for the id since ModuleLoaderBase has no concept of early
hints when it calls StartFetch.

As a prerequisite for early hints support, this commit also implements
modulepreload in link headers (Bug 1773056).

Differential Revision: https://phabricator.services.mozilla.com/D180020
2023-06-26 10:49:53 +00:00
Tom Schuster
c2eed54197 Bug 1838415 - Use RFPTarget::JSDateTimeUTC for IndexedToHTML date/time formatting. r=tjr,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181244
2023-06-26 07:17:39 +00:00
Mike Hommey
5af31a8886 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
There is no implicit conversion for scoped enums, so using them without
an explicit conversion in varargs functions is undefined behavior. GCC
has had a warning about this for a long while, but clang only gained
this a few days ago on trunk.

Differential Revision: https://phabricator.services.mozilla.com/D181723
2023-06-24 20:14:31 +00:00
Narcis Beleuzu
7ae0c765b0 Backed out changeset dfe0fed4de68 (bug 1816677) for xpcshell failure on test_http3_dns_retry.js . CLOSED TREE 2023-06-24 00:42:37 +03:00
Kershaw Chang
818d909b26 Bug 1816677 - Allow to retry diffrent IP family for Http/3, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D180679
2023-06-23 15:00:48 +00:00
Sandor Molnar
20af0665ba Backed out changeset 5276a2dbe3d2 (bug 1839177) for causing wpt failures in /fetch/content-encoding/bad-gzip-body.any.worker.html CLOSED TREE 2023-06-23 18:11:59 +03:00
Manuel Bucher
71d6172ae6 Bug 1839177 - Always call OnStopRequest after OnStartRequest even with failures in OnDataAvailable in nsUnknownDecoder::ConvertEncodedData r=necko-reviewers,kershaw
The contract is that after calling OnStartRequest once we then MUST call OnStopRequest, once.

Differential Revision: https://phabricator.services.mozilla.com/D181387
2023-06-23 12:14:04 +00:00
Kershaw Chang
d975160933 Bug 1835430 - Cancel async copy to avoid leaks, r=necko-reviewers,valentin,jesup
Differential Revision: https://phabricator.services.mozilla.com/D181643
2023-06-23 06:51:02 +00:00
Kershaw Chang
154a3294af Bug 1838829 - Add document for mochitest with Http/2 and Http/3, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181252
2023-06-22 19:44:54 +00:00
Andrew Creskey
2cca592c2d 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
We want to collect DNS lookup times on Fenix as there is potential for improvement.

Differential Revision: https://phabricator.services.mozilla.com/D181570
2023-06-22 16:02:57 +00:00
Kershaw Chang
1fc6178253 Bug 1828537 - Use MOZ_RELEASE_ASSERT to check if HttpChannelChild is always released on main thread, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181642
2023-06-22 14:38:24 +00:00
serge-sans-paille
ab13de4ec4 Bug 1839325 - Add missing header dependency on mozilla/PSandboxTestingChild.h r=bobowen,necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D181446
2023-06-22 12:40:14 +00:00
Norisz Fay
e86f1fa0e9 Backed out 5 changesets (bug 1838829) for causing mochitest failures CLOSED TREE
Backed out changeset 693d34c8447d (bug 1838829)
Backed out changeset 903d9ff4afaa (bug 1838829)
Backed out changeset 5e51feff7467 (bug 1838829)
Backed out changeset e125be49d2a6 (bug 1838829)
Backed out changeset 1a8cf3c83dc4 (bug 1838829)
2023-06-22 03:37:07 +03:00
Norisz Fay
c009bc1dee Backed out changeset 7d29150fa9f6 (bug 1835430) for causing dt failures on nsCOMPtr.h 2023-06-22 00:47:36 +03:00
Kershaw Chang
149fad568d Bug 1838829 - Add document for mochitest with Http/2 and Http/3, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181252
2023-06-21 19:43:33 +00:00
Kershaw Chang
2cdb6b3a96 Bug 1838829 - Skip failed tests, r=necko-reviewers,extension-reviewers,credential-management-reviewers,devtools-reviewers,dimi,valentin,robwu
Differential Revision: https://phabricator.services.mozilla.com/D181251
2023-06-21 19:43:33 +00:00
Kershaw Chang
d325869b9a Bug 1835430 - Cancel async copy to avoid leaks, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181643
2023-06-21 19:18:42 +00:00
Mike Hommey
d8456fd716 Bug 1836230 - Update bindgen to 0.66.1. r=emilio,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D179656
2023-06-21 08:52:22 +00:00
Mike Hommey
39ed3add07 Bug 1838354 - Change how the rust workspace hack is added. r=firefox-build-system-reviewers,webdriver-reviewers,ahochheiden,whimboo
First, instead of using a path, use a version, which is more convenient
(via a patch in the top-level Cargo.toml).

Second, we make the build system itself enforce its presence for any
crate that is hooked to the build system as a program or library.

Finally, for each crate depending on the workspace hack, we add a
feature named after it, and make the build system enforce that the
feature is set. For now, this remains unused, but the end goal is to
have each of those features enable the dependencies each of these
crates need, so that if crate A and B need dependency D, but crate C
doesn't, building crate C doesn't build D.

Differential Revision: https://phabricator.services.mozilla.com/D180910
2023-06-21 07:31:44 +00:00
Tooru Fujisawa
65f42a1084 Bug 1839360 - Part 2: Remove remaining more consumers of Services.jsm. r=kmag,necko-reviewers,geckoview-reviewers,m_kato,valentin
Differential Revision: https://phabricator.services.mozilla.com/D156922
2023-06-20 12:36:16 +00:00
Mike Kaply
3332079ecd Bug 1772503 - Keep policy locked preferences locked. r=mhowell,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D181100
2023-06-20 12:17:49 +00:00
sunil mayya
4a5b60e488 Bug 1812505 - add test to verify conditional requests are sent for stale responses with immutable cache-control extension. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181151
2023-06-20 05:57:32 +00:00
sunil mayya
e483756252 Bug 1812505 - conditional request must be sent for stale responses with immutable cache-control extension. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181044
2023-06-20 05:57:32 +00:00
Natalia Csoregi
37db79aab5 Backed out 8 changesets (bug 1830070) for causing assertion failures on nsAboutProtocolUtils.h. CLOSED TREE
Backed out changeset 05c4b06857fb (bug 1830070)
Backed out changeset f264c5b9c200 (bug 1830070)
Backed out changeset 45032e474c29 (bug 1830070)
Backed out changeset fa89c51ef6fc (bug 1830070)
Backed out changeset f0f70e7c8250 (bug 1830070)
Backed out changeset 785e1775c13d (bug 1830070)
Backed out changeset 582e28b83b50 (bug 1830070)
Backed out changeset de379bee27d0 (bug 1830070)
2023-06-19 23:51:04 +03:00
Tom Ritter
bc2e6a72ad 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-19 20:03:27 +00:00
Cristian Tuns
56fde7fc95 Backed out 8 changesets (bug 1830070) for causing build bustages in nsContentUtils.cpp CLOSED TREE
Backed out changeset e1fea00fd3d4 (bug 1830070)
Backed out changeset 2b18a4962ce4 (bug 1830070)
Backed out changeset db1529c19fb3 (bug 1830070)
Backed out changeset c84325c71e91 (bug 1830070)
Backed out changeset dc7d31b22ca7 (bug 1830070)
Backed out changeset 7cf935920d9a (bug 1830070)
Backed out changeset e41d8c2f85df (bug 1830070)
Backed out changeset e962979d701e (bug 1830070)
2023-06-19 14:25:09 -04:00
Tom Ritter
9a6a9504ad 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-19 18:08:04 +00:00
ffxbld
4d658ddaa8 No Bug, mozilla-central repo-update HSTS HPKP remote-settings tld-suffixes - r=release-managers,dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D181373
2023-06-19 12:04:00 +00:00
Andrew Creskey
d4b539e54c Bug 1838498 - Extend test_speculative_connect.js to cover https r=necko-reviewers,kershaw
Extending this test to cover https since that's most connections. Tested negative case by cancelling https connections in nsHttpHandler::SpeculativeConnectInternal

Differential Revision: https://phabricator.services.mozilla.com/D180985
2023-06-19 10:51:21 +00:00
Tom Schuster
a413d17357 Bug 1832461 - Remove COOKIE_RETRIEVAL_SAMESITE_PROBLEM telemetry probe. r=cookie-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D181256
2023-06-19 09:25:06 +00:00
Dana Keeler
2edebb46f1 Bug 1837267 - introduce XPCOM interface nsIDataStorage for DataStorage r=jschanck,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D180267
2023-06-15 20:24:07 +00:00
ffxbld
5b6d309f90 No Bug, mozilla-central repo-update HSTS HPKP remote-settings tld-suffixes - r=release-managers,diannaS
Differential Revision: https://phabricator.services.mozilla.com/D181075
2023-06-15 15:16:58 +00:00
Iulian Moraru
99be4f67e4 Merge mozilla-central to autoland on a CLOSED TREE 2023-06-15 17:51:30 +03:00
Iulian Moraru
39cf02c89d Backed out changeset 3fc04d8eb32b (bug 1659763) for frame checker crashes. a=backout 2023-06-15 17:48:35 +03:00
Sean Feng
dba509892e Bug 1837585 - Make the COEP:Credentialless check ignores the subdocument request if it's a redirect r=valentin,necko-reviewers
We shouldn't block the iframe if the initial request doesn't have valid
headers, we should only check the final request.

Differential Revision: https://phabricator.services.mozilla.com/D180485
2023-06-15 13:07:43 +00:00
Cristian Tuns
a014ec090e Backed out 8 changesets (bug 1830070) for causing build bustages in nsContentUtils.cpp CLOSED TREE
Backed out changeset 4726b70822cf (bug 1830070)
Backed out changeset dd73f3c56f5e (bug 1830070)
Backed out changeset 3628e8b8d28a (bug 1830070)
Backed out changeset dfbd51c0a3a6 (bug 1830070)
Backed out changeset 3d372cedcfdb (bug 1830070)
Backed out changeset 443d83b8fe70 (bug 1830070)
Backed out changeset 3ed6c302f108 (bug 1830070)
Backed out changeset 919b884d5a2b (bug 1830070)
2023-06-14 23:37:36 -04:00
Tom Ritter
91ec06ecce 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-15 03:08:15 +00:00
june wilde
31bdb71dd5 Bug 1659763 - Fix failing x-frame-options web platform tests; r=freddyb,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D180234
2023-06-14 18:26:21 +00:00
Andreas Farre
abd9bc6760 Bug 1838208 - Part 1: Add pref to allow choosing exception strategy. r=sefeng,necko-reviewers
In `IsOpaqueSafeListedSpecBreakingMIMEType` we make it possible to
configure, with pref, what kind of exception strategy to use to handle
compatibility problems with MIME types starting with `audio/` or
`video/`.

Differential Revision: https://phabricator.services.mozilla.com/D180926
2023-06-14 17:07:57 +00:00