Commit graph

356 commits

Author SHA1 Message Date
Olli Pettay
a63d71ea6b Bug 1905843, prevent unexpected use of result site origin, a=diannaS
Original Revision: https://phabricator.services.mozilla.com/D215496

Differential Revision: https://phabricator.services.mozilla.com/D222921
2024-09-20 10:15:51 +00:00
Tom Schuster
346cecd51c Bug 1872839 - Remove aMimeTypeGuess parameter from nsIContentPolicy. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D197794
2024-01-08 15:47:42 +00:00
Tom Schuster
b158ada37d Bug 1871581 - Add missing (but implicitly used) ExtContentPolicy::TYPE_WEB_IDENTITY. r=necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D197190
2024-01-03 10:54:12 +00:00
Sean Feng
ba1dd25a05 Bug 1722322 - Fix two bugs in nsContentSecurityManager::GetSerializedOrigin r=necko-reviewers,dragana
The first bug is according to https://fetch.spec.whatwg.org/#serializing-a-request-origin,
the algorithm should return "null" if the request has a redirected-tainted origin.

The second bug is the comparison of whether this is a cross origin redirect missed
the `not operator`.

Differential Revision: https://phabricator.services.mozilla.com/D151078
2023-11-02 20:53:35 +00:00
Sandor Molnar
a4163792c6 Backed out 7 changesets (bug 1722322) for causing bp-nu bustages
Backed out changeset 0ebd32e273b8 (bug 1722322)
Backed out changeset 7a75717f127c (bug 1722322)
Backed out changeset c2a6440a83d7 (bug 1722322)
Backed out changeset 9955756855bd (bug 1722322)
Backed out changeset 37fccb407777 (bug 1722322)
Backed out changeset f52b1f28f753 (bug 1722322)
Backed out changeset 0121c8cf5d2f (bug 1722322)
2023-11-02 21:27:24 +02:00
Sean Feng
5a55dc91cf Bug 1722322 - Fix two bugs in nsContentSecurityManager::GetSerializedOrigin r=necko-reviewers,dragana
The first bug is according to https://fetch.spec.whatwg.org/#serializing-a-request-origin,
the algorithm should return "null" if the request has a redirected-tainted origin.

The second bug is the comparison of whether this is a cross origin redirect missed
the `not operator`.

Differential Revision: https://phabricator.services.mozilla.com/D151078
2023-11-02 17:04:46 +00:00
Frederik Braun
7291dac470 Bug 1812192 - Store schemeless address bar loads in loadinfo and upgrade to https with fallback r=necko-reviewers,webidl,smaug,freddyb,kershaw
Depends on D179794

Differential Revision: https://phabricator.services.mozilla.com/D179795
2023-10-11 17:49:42 +00:00
Cristian Tuns
5fabc0ee57 Backed out 6 changesets (bug 1812192) for causing browser_schemeless.js failures. CLOSED TREE
Backed out changeset 3d07a92324d0 (bug 1812192)
Backed out changeset 9c2a1ff6c90d (bug 1812192)
Backed out changeset fa6784f8b0f4 (bug 1812192)
Backed out changeset 0f39aba7e4d5 (bug 1812192)
Backed out changeset ef7219327a10 (bug 1812192)
Backed out changeset 9833b559342e (bug 1812192)
2023-10-10 10:02:25 -04:00
Frederik Braun
aed55ecb55 Bug 1812192 - Store schemeless address bar loads in loadinfo and upgrade to https with fallback r=necko-reviewers,webidl,smaug,freddyb,kershaw
Depends on D179794

Differential Revision: https://phabricator.services.mozilla.com/D179795
2023-10-10 08:43:00 +00:00
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
Sean Feng
93454dbf5f Bug 1835925 - Add TYPE_WEB_TRANSPORT to ExtContentPolicyType r=jesup,extension-reviewers,robwu
Differential Revision: https://phabricator.services.mozilla.com/D180732
2023-06-14 15:25:40 +00:00
Sean Feng
0440925674 Bug 1829495 - Make websocket request bypass the COEP:Credentialless' allow credentials check r=smaug
According to the spec, websocket request has 'websocket' as the mode
that differs than 'no-cors' mode. So websocket request should always
contain credentials.

Differential Revision: https://phabricator.services.mozilla.com/D177396
2023-05-11 18:03:58 +00:00
Narcis Beleuzu
9cf8852844 Backed out changeset 035b850b6a1e (bug 1829495) for wpt failures on websocket.https.window.html . CLOSED TREE 2023-05-09 23:13:22 +03:00
Sean Feng
6817372a99 Bug 1829495 - Make websocket request bypass the COEP:Credentialless' allow credentials check r=smaug
According to the spec, websocket request has 'websocket' as the mode
that differs than 'no-cors' mode. So websocket request should always
contain credentials.

Differential Revision: https://phabricator.services.mozilla.com/D177396
2023-05-09 14:52:58 +00:00
Gijs Kruitbosch
b02fe6e1e2 Bug 1691658 - block http redirects to data: protocol, r=necko-reviewers,ckerschb,valentin
This also adds a network.allow_redirect_to_data pref in case we need to turn
this back on for compat reasons.

Differential Revision: https://phabricator.services.mozilla.com/D173988
2023-04-12 09:43:00 +00:00
Iulian Moraru
bc5aeba27c Backed out changeset ad22661fac08 (bug 1691658) for causing wpt failures on browser_datauri.js. CLOSED TREE 2023-04-11 17:25:27 +03:00
Gijs Kruitbosch
d0b8081ec4 Bug 1691658 - block http redirects to data: protocol, r=necko-reviewers,ckerschb,valentin
This also adds a network.allow_redirect_to_data pref in case we need to turn
this back on for compat reasons.

Differential Revision: https://phabricator.services.mozilla.com/D173988
2023-04-11 10:58:09 +00:00
Stanca Serban
5f18f085ee Backed out changeset 8bab888ea4d4 (bug 1691658) for causing xpcshell failures in test_redirect_different-protocol_wrap.js. CLOSED TREE 2023-04-05 04:00:14 +03:00
Gijs Kruitbosch
193d8a5b5a Bug 1691658 - block http redirects to data: protocol, r=necko-reviewers,ckerschb,valentin
This also adds a network.allow_redirect_to_data pref in case we need to turn
this back on for compat reasons.

Differential Revision: https://phabricator.services.mozilla.com/D173988
2023-04-04 21:41:12 +00:00
Cristina Horotan
7317157573 Backed out changeset 736be753a5cf (bug 1691658) for causing xpcshell failures at test_redirect_different-protocol.js CLOSED TREE 2023-04-04 18:02:15 +03:00
Gijs Kruitbosch
8bcb463d80 Bug 1691658 - block http redirects to data: protocol, r=necko-reviewers,ckerschb,valentin
This also adds a network.allow_redirect_to_data pref in case we need to turn
this back on for compat reasons.

Differential Revision: https://phabricator.services.mozilla.com/D173988
2023-04-04 13:54:05 +00:00
Christoph Kerschbaumer
f1492ecbfe Bug 1818704: Remove unnecessary FTP checks in dom/security, r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D170863
2023-02-24 10:28:52 +00:00
Sean Feng
e9bb065823 Bug 1814491 - Fix a bug where worker with require_corp was not able to be created if owner has credentialless. r=necko-reviewers,valentin
Our `check a global object's embedder policy` step is not updated after
we have coep:credentialless.

Differential Revision: https://phabricator.services.mozilla.com/D170667
2023-02-23 15:19:13 +00:00
Nika Layzell
98304d1200 Bug 1793463 - Part 5: Stop using contractids to fetch protocol handlers, r=necko-reviewers,xpcom-reviewers,webdriver-reviewers,whimboo,valentin,kmag
This patch replaces the previous ContractID-based lookup system for protocol
handlers, and replaces it with a new custom system in nsIOService. It will be
pre-populated with non-overridable static protocol handlers using the
StaticComponents infrastructure added in the previous part, and callers can
also dynamically register new protocol handlers at runtime.

This new system is intended to provide access to the default port and
non-dynamic protocol flags off-main-thread, by requiring these values to be
provided up-front as constants, rather than getting them from the xpcom
interface. The data is then guarded by an RWLock.

Callers which look up specific handlers by their contractID are not changed, as
the contract IDs for existing handlers have not been changed, so the lookup
will still succeed.

This change as-implemented breaks the nsGIOProtocolHandler on Linux, as it
removes the special code which would try to use that handler for some
protocols. This will be fixed in a later part by making the
nsGIOProtocolHandler use the dynamic registration APIs to register and
un-register protocol handlers at runtime in response to the GIO pref.

Differential Revision: https://phabricator.services.mozilla.com/D162804
2022-12-01 15:43:19 +00:00
Marian-Vasile Laza
7492025127 Backed out 7 changesets (bug 1793463) for causing bustages on nsIOService.cpp. CLOSED TREE
Backed out changeset 47c3acb30de2 (bug 1793463)
Backed out changeset 71afe900eb17 (bug 1793463)
Backed out changeset d168599a269e (bug 1793463)
Backed out changeset d0f18d300818 (bug 1793463)
Backed out changeset a116e6f089f2 (bug 1793463)
Backed out changeset eba1123c8b56 (bug 1793463)
Backed out changeset 68a3eb8a3057 (bug 1793463)
2022-12-01 02:30:02 +02:00
Nika Layzell
9cc8ee8c01 Bug 1793463 - Part 5: Stop using contractids to fetch protocol handlers, r=necko-reviewers,xpcom-reviewers,webdriver-reviewers,whimboo,valentin,kmag
This patch replaces the previous ContractID-based lookup system for protocol
handlers, and replaces it with a new custom system in nsIOService. It will be
pre-populated with non-overridable static protocol handlers using the
StaticComponents infrastructure added in the previous part, and callers can
also dynamically register new protocol handlers at runtime.

This new system is intended to provide access to the default port and
non-dynamic protocol flags off-main-thread, by requiring these values to be
provided up-front as constants, rather than getting them from the xpcom
interface. The data is then guarded by an RWLock.

Callers which look up specific handlers by their contractID are not changed, as
the contract IDs for existing handlers have not been changed, so the lookup
will still succeed.

This change as-implemented breaks the nsGIOProtocolHandler on Linux, as it
removes the special code which would try to use that handler for some
protocols. This will be fixed in a later part by making the
nsGIOProtocolHandler use the dynamic registration APIs to register and
un-register protocol handlers at runtime in response to the GIO pref.

Differential Revision: https://phabricator.services.mozilla.com/D162804
2022-11-30 18:13:43 +00:00
Nika Layzell
399a2f946d Bug 1538028 - Part 3: Validate loads by TriggeringRemoteType, r=smaug,ckerschb
The previous part introduced a new mechanism to track the triggering remote
type for a specific load in a reliable way. This adds some basic checks based
on the triggering remote type to the nsContentSecurityManager, while also
providing the potential infrastructure to expand these checks in the future.

As these checks are performed before some other content security checks (to
ensure that they are performed before InitialSecurityCheckDone() is checked),
they may reject a load which would otherwise have been rejected by a later
check. For this reason, the diagnostic assertions added in this part are only
fired if the check appears as though it would otherwise have succeeded. This
check is not fully accurate, however, so may miss some cases.

This is important, as we have some tests, such as service worker navigation
tests, which will try to load file:/// URIs in content processes, and only fail
in the later content security checks.

For now, no checks are performed for non-document loads, though that may change
in the future.

Differential Revision: https://phabricator.services.mozilla.com/D161199
2022-11-29 20:41:45 +00:00
Shane Caraveo
d3e7b16fa3 Bug 1705044 r=freddyb,Gijs,mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D154919
2022-11-03 17:00:40 +00:00
Tom Schuster
a2593348c1 Bug 1787250 - Remove SCRIPT_FILE_PROTOCOL_CORRECT_MIME probe. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D157341
2022-09-15 14:44:21 +00:00
Shane Caraveo
f1212fb1db Bug 1711168 support extension matching in webAccessibleResources r=zombie,smaug,rpl
Differential Revision: https://phabricator.services.mozilla.com/D115114
2022-08-02 17:08:58 +00:00
Butkovits Atila
ae6f4c94fc Backed out 3 changesets (bug 1711168, bug 1773115) for causing failures at test_ext_web_accessible_resources.html. CLOSED TREE
Backed out changeset 703c909eb009 (bug 1773115)
Backed out changeset 902385a7ce60 (bug 1711168)
Backed out changeset 3d061ce03de7 (bug 1711168)
2022-07-27 00:13:26 +03:00
Shane Caraveo
a73cd6df49 Bug 1711168 support extension matching in webAccessibleResources r=zombie,smaug,rpl
Differential Revision: https://phabricator.services.mozilla.com/D115114
2022-07-26 19:39:14 +00:00
Sean Feng
6acee53f6c Bug 1731778 - Implement COEP: credentialless r=smaug,necko-reviewers,kershaw
Spec: https://html.spec.whatwg.org/multipage/#coep:coep-credentialless

Credentialless is a new cross-origin embedder policy which allows us
to not enforcing CORP when loading cross-origin resources while
providing SharedArrayBuffer.

There are two main things involved here:
  1. Fetching cross-origin no-CORS resources omits credentials
     - This is done by applying `LOAD_ANONYMOUS` flag to the request
  2. Other requests sent with credentials require the server's explicit
  permission through the CORS protocol or the CORS header
     - This is done by expanding `ProcessCrossOriginResourcePolicyHeader`
     function to apply the necessary checks.

Differential Revision: https://phabricator.services.mozilla.com/D147802
2022-06-27 17:07:15 +00:00
Iulian Moraru
672f2cb672 Backed out 3 changesets (bug 1731778) for causing COEP related failures on embedding.tentative.https.window.html.
Backed out changeset c30f5751d54c (bug 1731778)
Backed out changeset 0eec19308453 (bug 1731778)
Backed out changeset 7c14fa8a4804 (bug 1731778)
2022-06-22 22:00:17 +03:00
Sean Feng
80b0c0f55b Bug 1731778 - Implement COEP: credentialless r=smaug,necko-reviewers,kershaw
Spec: https://html.spec.whatwg.org/multipage/#coep:coep-credentialless

Credentialless is a new cross-origin embedder policy which allows us
to not enforcing CORP when loading cross-origin resources while
providing SharedArrayBuffer.

There are two main things involved here:
  1. Fetching cross-origin no-CORS resources omits credentials
     - This is done by applying `LOAD_ANONYMOUS` flag to the request
  2. Other requests sent with credentials require the server's explicit
  permission through the CORS protocol or the CORS header
     - This is done by expanding `ProcessCrossOriginResourcePolicyHeader`
     function to apply the necessary checks.

Differential Revision: https://phabricator.services.mozilla.com/D147802
2022-06-22 13:13:39 +00:00
Narcis Beleuzu
9e3db37db1 Backed out 2 changesets (bug 1731778) for wpt failures on embedding.tentative.https.window.html . CLOSED TREE
Backed out changeset 2510b654e8f2 (bug 1731778)
Backed out changeset fea9b21d8efe (bug 1731778)
2022-06-21 19:13:32 +03:00
Sean Feng
413fe3115c Bug 1731778 - Implement COEP: credentialless r=smaug,necko-reviewers,kershaw
Spec: https://html.spec.whatwg.org/multipage/#coep:coep-credentialless

Credentialless is a new cross-origin embedder policy which allows us
to not enforcing CORP when loading cross-origin resources while
providing SharedArrayBuffer.

There are two main things involved here:
  1. Fetching cross-origin no-CORS resources omits credentials
     - This is done by applying `LOAD_ANONYMOUS` flag to the request
  2. Other requests sent with credentials require the server's explicit
  permission through the CORS protocol or the CORS header
     - This is done by expanding `ProcessCrossOriginResourcePolicyHeader`
     function to apply the necessary checks.

Differential Revision: https://phabricator.services.mozilla.com/D147802
2022-06-21 13:56:52 +00:00
Sean Feng
a0027872bc Bug 1770001 - Update TimingAllowCheck function to align spec updates r=necko-reviewers,dragana
Given the Fetch spec, the TAO check algorithm has been updated to
be more restricted. This patch updates the algorithm to match the
spec.

Differential Revision: https://phabricator.services.mozilla.com/D146737
2022-06-17 15:04:18 +00:00
Manuel Bucher
14dd2f26fc Bug 1761242 - Expose computing security flags for early hint preloader r=ckerschb,smaug
Differential Revision: https://phabricator.services.mozilla.com/D144798
2022-06-15 09:59:44 +00:00
Tom Schuster
3b08086654 Bug 1773667 - Add console logging for file:// script loads. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D148899
2022-06-13 08:02:13 +00:00
Tom Schuster
4b2a9f4fe1 Bug 1773667 - Perform file URI script check after other checks. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D148898
2022-06-13 08:02:13 +00:00
Molnar Sandor
1fc858a96d Backed out 5 changesets (bug 1761242, bug 1744822, bug 1761252) for causing browser-chrome failures in netwerk/test/browser/browser_103_assets.js CLOSED TREE
Backed out changeset 33cc08eb51b3 (bug 1744822)
Backed out changeset b70697d24e75 (bug 1761252)
Backed out changeset 4a5e10110c6a (bug 1761242)
Backed out changeset 7cda175b833d (bug 1761242)
Backed out changeset 4f5ed111093b (bug 1761242)
2022-06-08 18:56:35 +03:00
Manuel Bucher
35abf46688 Bug 1761242 - Expose computing security flags for early hint preloader r=ckerschb,smaug
Differential Revision: https://phabricator.services.mozilla.com/D144798
2022-06-08 14:33:10 +00:00
Tom Schuster
b9f2fe59ee Bug 1770395 - Telemetry for file protocol script loads. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D146902
2022-05-25 17:07:56 +00:00
Frederik Braun
c2181f7a67 Bug 1767581 - restrict loads of http/https scripts in the privilegedabout process r=dveditz
Differential Revision: https://phabricator.services.mozilla.com/D145978
2022-05-23 20:22:52 +00:00
Frederik Braun
0aeb0900a2 Bug 1767581 - refactor systemprincipal restrictions, disallow loads without finaluri r=ckerschb,tjr
This is a bit of a refactor.
We'll keep the spagetthi code for existing checks, to be able
to easily iterate and pref-flip if things fail later in the cycle.
This also resolves bug 1638770 and removes the "disallow all"
-pref that proved not be a useful approach anyway.

Differential Revision: https://phabricator.services.mozilla.com/D145411
2022-05-23 20:22:52 +00:00
Tom Schuster
c41e3ff3ad Bug 1760024 - Add a pref for checking file:// script loads. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D146069
2022-05-13 11:13:09 +00:00
Tom Schuster
82ba338d5a Bug 1760024 - Enforce a correct MIME type for file:// script loads. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D143608
2022-05-06 10:51:42 +00:00
Frederik Braun
b7e76370ff Bug 1767954 - csmlog should include process type r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D145575
2022-05-05 12:46:47 +00:00
Frederik Braun
e0e7fe2c04 Bug 1767395 disallow loading http/https scripts for systemprincipal r=ckerschb,tjr
This copies over the behavior for style & subdocument restrictions.
Admittedly, with this if/else spagetthi, it would be preferable to
turn this into restriction levels or lump some of the known-to-be-safe
prefs together, but I would prefer we wait a couple of cycles to
make sure this makes it all the way to release before we refactor.

Differential Revision: https://phabricator.services.mozilla.com/D145306
2022-05-03 15:28:34 +00:00