Граф коммитов

168 Коммитов

Автор SHA1 Сообщение Дата
Nika Layzell 1fdee2314c Bug 1839920 - Rename Get{ASCII,UTF}Origin to GetWebExposedOriginSerialization, r=smaug,necko-reviewers,anti-tracking-reviewers,bvandersloot,jesup
This should make uses of the type more clearly indicating where the
origin came from, and should help avoid potential confusion between this
origin and nsIPrincipal::origin in new code.

This new name is long, but explicit. The string returned from this
function corresponds to the "serialization of an origin" from the WHATWG
html spec:
https://html.spec.whatwg.org/multipage/browsers.html#ascii-serialisation-of-an-origin

Differential Revision: https://phabricator.services.mozilla.com/D181794
2023-06-27 19:59:15 +00:00
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
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
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
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
Dave Townsend b752598495 Bug 1792138: Show the extension's name in permission prompts for opening external links. r=ckerschb,robwu,fluent-reviewers,pbz,flod
In order to handle the content script case correctly we must expose the
contentScriptAddonPolicy to JavaScript. With that we can always see what
extension is trying to perform an action and use its name rather than internal
ID in the dialog.

Differential Revision: https://phabricator.services.mozilla.com/D161282
2023-01-07 17:53:19 +00:00
Sylvestre Ledru 1f8d23143a Bug 1802288 - remove trailing whitespaces in idl/webidl files r=credential-management-reviewers,webidl,smaug,sgalich
Differential Revision: https://phabricator.services.mozilla.com/D165559
2022-12-28 09:52:44 +00:00
Stanca Serban bd29139bde Backed out changeset 514642d76faa (bug 1792138) for causing mochitests failures in test_ext_protocolHandlers.html. CLOSED TREE 2022-12-13 14:53:38 +02:00
Dave Townsend e021cf6a60 Bug 1792138: Show the extension's name in permission prompts for opening external links. r=ckerschb,robwu,fluent-reviewers,pbz,flod
In order to handle the content script case correctly we must expose the
contentScriptAddonPolicy to JavaScript. With that we can always see what
extension is trying to perform an action and use its name rather than internal
ID in the dialog.

Differential Revision: https://phabricator.services.mozilla.com/D161282
2022-12-13 10:43:32 +00:00
Nika Layzell 2869537fdd Bug 1443925 - Part 11: Document thread safety requirements for most principal methods, r=ckerschb
After the previous changes, the majority of methods on nsIPrincipal are now
threadsafe. This patch documents which methods are still bound to the main
thread, and adds thread assertions to them to avoid potential misuse.

Differential Revision: https://phabricator.services.mozilla.com/D163041
2022-12-02 00:53:53 +00:00
Stanca Serban 3811bf75f5 Backed out changeset 02a9e51358f1 (bug 1792138) for causing mochitests failures on browser_ext_windows_create_url.js. CLOSED TREE 2022-11-17 18:38:00 +02:00
Dave Townsend 1573156d9c Bug 1792138: Show the extension's name in permission prompts for opening external links. r=ckerschb,robwu,fluent-reviewers,pbz,flod
In order to handle the content script case correctly we must expose the
contentScriptAddonPolicy to JavaScript. With that we can always see what
extension is trying to perform an action and use its name rather than internal
ID in the dialog.

Differential Revision: https://phabricator.services.mozilla.com/D161282
2022-11-17 14:44:57 +00:00
Stanca Serban d7154c3939 Backed out changeset e14d08963786 (bug 1792138) for causing mochitest failures on browser_protocol_ask_dialog_permission.js. CLOSED TREE 2022-11-17 14:57:36 +02:00
Dave Townsend 409d66befd Bug 1792138: Show the extension's name in permission prompts for opening external links. r=ckerschb,robwu,fluent-reviewers,pbz,flod
In order to handle the content script case correctly we must expose the
contentScriptAddonPolicy to JavaScript. With that we can always see what
extension is trying to perform an action and use its name rather than internal
ID in the dialog.

Differential Revision: https://phabricator.services.mozilla.com/D161282
2022-11-17 11:08:48 +00:00
nchevobbe ac16015106 Bug 1778959 - Expose nsIPrincipal.isLoopbackHost. r=bholley.
This will be used in SitePermsAddonInstallRequestPrototype to discriminate permission
requests coming from localhost, where we want to fallback to regular permission prompt.

Depends on D151477

Differential Revision: https://phabricator.services.mozilla.com/D157658
2022-09-30 22:07:18 +00:00
Emilio Cobos Álvarez 685321b746 Bug 1755947 - Simplify nsIPrincipal.isSameOrigin(). r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D139030
2022-02-17 18:11:58 +00:00
Tim Huang b3594081d0 Bug 1724376 - Part 2: Add a RejectForeignAllowList::Check() for principal. r=dimi,pbz,ckerschb
We need a helper function for checking principal if it's in the foreign
allow list.

In this patch we will add a BasePrincipal::IsURIInList() because this is
needed for RejectForeignAllowList::Check().

Differential Revision: https://phabricator.services.mozilla.com/D123804
2021-10-05 15:16:19 +00:00
Tom Schuster a0128c7638 Bug 1724206 - Use WebExtensionPolicy webidl definition for addonPolicy property on nsIPrincipal. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D121889
2021-08-05 18:16:17 +00:00
Nika Layzell 37b7c93371 Bug 1715167 - Part 5: Add a precursorPrincipal attribute to nsIPrincipal, r=ckerschb,ngogge
This provides a getter which can be used to interact with the precursor
attribute of the null principal.

Depends on D119691

Differential Revision: https://phabricator.services.mozilla.com/D119692
2021-07-15 21:09:15 +00:00
Stefan Zabka 35d147115f Bug 1716734 - Updated comment in nsIPrincipal.idl r=ckerschb DONTBUILD
Updated the origin attributes comment to use the current delimiter

Differential Revision: https://phabricator.services.mozilla.com/D117990
2021-06-16 15:53:18 +00:00
Nika Layzell a8265c4766 Bug 1711078 - Part 2: Mark immutable fields in principal types as const, r=ckerschb
This is a step towards separating the mutable state on principals from const
state which can be made threadsafe. The remaining mutable fields will either
need to be moved off of nsIPrincipal or made threadsafe to destroy (e.g. using
nsMainThreadPtrHandle) and stored behind a mutex.

Serialization is handled for most types using a separate Deserializer class,
like how it was handled with `nsIURI` mutators. SystemPrincipal wasn't changed
as the `Read` method is a no-op for that class.

Differential Revision: https://phabricator.services.mozilla.com/D115092
2021-05-17 20:50:09 +00:00
Christoph Kerschbaumer d6ef7be5e9 Bug 1706593: Update prePath to camel case in nsIPrincipal.idl r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D113927
2021-04-30 11:16:31 +00:00
Emilio Cobos Álvarez 7dac28d4c1 Bug 1684001 - IsURIInPrefList should be infallible. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107455
2021-03-08 23:36:40 +00:00
Butkovits Atila d795f5b731 Backed out 2 changesets (bug 1684001) for causing failures on test_ext_webRequest_filterResponseData.js. CLOSED TREE
Backed out changeset 2396dd65ee8d (bug 1684001)
Backed out changeset 52c6a21b39fb (bug 1684001)
2021-03-09 03:10:19 +02:00
Emilio Cobos Álvarez 6aff310271 Bug 1684001 - IsURIInPrefList should be infallible. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D107455
2021-03-08 23:36:40 +00:00
Christoph Kerschbaumer 0f05ea9b88 Bug 1678310: Expose siteOriginNoSuffix on nsIPrincipal r=baku,nika
Differential Revision: https://phabricator.services.mozilla.com/D97605
2020-11-28 07:21:32 +00:00
Csoregi Natalia a810f4e72c Backed out changeset cf796da336c8 (bug 1678310) due to causing memory crashes. CLOSED TREE 2020-11-24 13:00:45 +02:00
Christoph Kerschbaumer a1c2ca7af2 Bug 1678310: Expose siteOriginNoSuffix on nsIPrincipal r=baku
Differential Revision: https://phabricator.services.mozilla.com/D97605
2020-11-24 09:04:56 +00:00
Tim Huang 18853bea78 Bug 1670617 - Part 2: Make the CORS preflight cache partitioned by the originAttributes. r=ckerschb,necko-reviewers
We want to partition the CORS preflight cache by the network state
partitioning. So, we have done two things in the patch. First, we make
the CORS preflight cache to be aware of the OriginAttributes. Second, we
use the originAttributes of the network state partitioning in the CORS
preflight cache. As the result, the CORS preflight cache will be
partitioned by the originAttributes.partitionKey as well as other
originAttributes fields if present.

Differential Revision: https://phabricator.services.mozilla.com/D93683
2020-10-26 13:39:12 +00:00
Sebastian Streich 7defa66497 Bug 1655945 - Remove principal.uri in RemotePageAccessManager.jsm r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D82917
2020-08-25 13:58:49 +00:00
Sebastian Streich f1c274e657 Bug 1660822 - Add isLocalIpAdress to nsIPrincipal r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D82919
2020-08-24 16:28:26 +00:00
Butkovits Atila a24ad1c55b Backed out changeset 6d39aab86966 (bug 1633710) for failure at test_disabled_hosts.js. CLOSED TREE 2020-08-05 22:19:30 +03:00
Sebastian Streich a7595921ed Bug 1633710 - Move display-(spec/prepath/host) to nsIPrincipal r=geckoview-reviewers,snorp
Differential Revision: https://phabricator.services.mozilla.com/D82913
2020-08-05 16:52:12 +00:00
Sebastian Streich bf58055b03 Bug 1633710 - Move uri.spec calls to nsIPrincipal r=necko-reviewers,geckoview-reviewers,preferences-reviewers,ckerschb,ntim,snorp,valentin
Differential Revision: https://phabricator.services.mozilla.com/D82911
2020-08-04 11:10:41 +00:00
Noemi Erli 5cebe61c77 Backed out changeset 4ed7b13fb7a5 (bug 1633710) for causing failures in browser_amosigned_url.js CLOSED TREE 2020-07-29 22:34:42 +03:00
Sebastian Streich ea482d8e73 Bug 1633710 - Move uri.spec calls to nsIPrincipal r=necko-reviewers,geckoview-reviewers,preferences-reviewers,ckerschb,ntim,snorp,valentin
Differential Revision: https://phabricator.services.mozilla.com/D82911
2020-07-29 17:33:10 +00:00
Sebastian Streich 147fdbb684 Bug 1633710 - principal.URI in Sanitizer.jsm r=ckerschb,johannh
Differential Revision: https://phabricator.services.mozilla.com/D75801
2020-06-30 16:25:45 +00:00
Andrea Marchesini 7ff3759ac3 Bug 1638358 - Cookie Schemeful Same-Site - part 5 - schemeful comparison, r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D75629
2020-06-02 13:50:12 +00:00
Csoregi Natalia e960b9f449 Backed out 7 changesets (bug 1640405, bug 1638358) for failures on browser_webconsole_network_messages_status_code.js. CLOSED TREE
Backed out changeset ef5f7479ddf8 (bug 1640405)
Backed out changeset 286e0c83eb30 (bug 1638358)
Backed out changeset 89e396b2896e (bug 1638358)
Backed out changeset 33ad5fa05209 (bug 1638358)
Backed out changeset d213264c1379 (bug 1638358)
Backed out changeset 6bc05236afb4 (bug 1638358)
Backed out changeset 87e9d0ed3982 (bug 1638358)
2020-06-02 15:16:42 +03:00
Andrea Marchesini 2eaedfe5f4 Bug 1638358 - Cookie Schemeful Same-Site - part 5 - schemeful comparison, r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D75629
2020-06-02 09:15:24 +00:00
Razvan Maries 79fe28f0d6 Backed out 6 changesets (bug 1638358) for perma failures on browser_webconsole_navigate_to_parse_error.js. CLOSED TREE
Backed out changeset beb85cf281d5 (bug 1638358)
Backed out changeset 39f2e21623aa (bug 1638358)
Backed out changeset 2c873c72bf1f (bug 1638358)
Backed out changeset e91292c7c719 (bug 1638358)
Backed out changeset 0219ef931cd9 (bug 1638358)
Backed out changeset 4ac06f3992f4 (bug 1638358)
2020-06-02 00:24:46 +03:00
Andrea Marchesini 97f0db059a Bug 1638358 - Cookie Schemeful Same-Site - part 5 - schemeful comparison, r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D75629
2020-06-01 16:49:03 +00:00
Noemi Erli e40be0aa72 Backed out 6 changesets (bug 1638358) for causing failures in test_Chrome_cookies.js CLOSED TREE
Backed out changeset 4e8fbe01aa38 (bug 1638358)
Backed out changeset 532731e94bb2 (bug 1638358)
Backed out changeset fad2ba760157 (bug 1638358)
Backed out changeset 932a3fdbd07c (bug 1638358)
Backed out changeset 05a62901a3f5 (bug 1638358)
Backed out changeset cddeada5c4a6 (bug 1638358)
2020-06-01 19:45:46 +03:00
Andrea Marchesini bcda89c3fb Bug 1638358 - Cookie Schemeful Same-Site - part 5 - schemeful comparison, r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D75629
2020-06-01 11:43:28 +00:00
Dorel Luca 9574e25c80 Backed out 6 changesets (bug 1638358) for XPCShell failures in netwerk/cookie/test/unit/test_schemeMap.js. CLOSED TREE
Backed out changeset 745eab35e851 (bug 1638358)
Backed out changeset a45df1876e37 (bug 1638358)
Backed out changeset 1a85cc92d2fb (bug 1638358)
Backed out changeset 2156294cb158 (bug 1638358)
Backed out changeset 31101054c52c (bug 1638358)
Backed out changeset d284b50551ab (bug 1638358)
2020-06-01 14:38:22 +03:00
Andrea Marchesini e2b687e0ce Bug 1638358 - Cookie Schemeful Same-Site - part 5 - schemeful comparison, r=mayhemer
Differential Revision: https://phabricator.services.mozilla.com/D75629
2020-06-01 10:29:34 +00:00
Sebastian Streich 47570a169b Bug 1633710 - Move js uri.AsciiHost to principal r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D73239
2020-05-26 11:58:06 +00:00
Sebastian Streich 159ab546db Bug 1625845 - Remove GetUri in Navigator.cpp r=ckerschb,baku
Differential Revision: https://phabricator.services.mozilla.com/D68749
2020-05-19 14:51:40 +00:00
Sebastian Streich b70610980a Bug 1633710 - Move js uri.hostPort to principal r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D73240
2020-05-18 13:50:14 +00:00