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

344 Коммитов

Автор SHA1 Сообщение Дата
Nika Layzell 1eb3c1d7cd Bug 1906734 - Switch WebExtension resources to use only static protocol flags, r=extension-reviewers,necko-reviewers,kershaw,robwu
Previously, the WebExtension protocol used dynamic protocol flags which
were based on the WebExtension policy in order to enforce things such as
availability in private browsing and the accessibility of certain
resources.

Since the shift to MV3, these checks have required more complex checks
than what was possible to specify with protocol flags, which required
the addition of WEBEXT_URI_WEB_ACCESSIBLE - a security flag which would
trigger further checks with the EPS to determine if the URI can be
loaded.

This was somewhat inefficient, as fetching the URI flags would require
looking up the policy each time dynamic flags were looked up, as well as
when policy specifics were being checked after loading flags. In
addition, it lead to a number of flags which were very specific to
extension protocols.

This patch changes extensions to no longer have dynamic flags, instead
specifying the static `URI_IS_WEBEXTENSION_RESOURCE` security flag. When
this flag is specified, security checks are made by querying the
ExtensionPolicyService to ask if the load should be permitted, combining
the specific security checks for Extension resources into a simpler
code-path, and avoids redundant checks.

Differential Revision: https://phabricator.services.mozilla.com/D216076
2024-07-17 16:02:34 +00:00
Tom Schuster 6613ec7689 Bug 1904004 - Use OriginAttributes::IsPrivateBrowsing instead of open coding PBM checks. r=timhuang,cookie-reviewers,anti-tracking-reviewers,profiler-reviewers,necko-reviewers,kershaw,dom-storage-reviewers,janv,canaltinova,dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D214532
2024-06-24 11:06:18 +00:00
aiunusov fe9f006639 Bug 1883860 - nsDocShell::HandleSameDocumentNavigation() cause crash in SetDocumentURI, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D204611
2024-03-22 12:27:38 +00:00
Sandor Molnar 72c98c7f24 Backed out changeset 7b83373f7a9e (bug 1883860) for causing build bustages @ caps/tests/gtest/TestScriptSecurityManager.cpp CLOSED TREE 2024-03-22 02:35:03 +02:00
aiunusov b201b63e61 Bug 1883860 - nsDocShell::HandleSameDocumentNavigation() cause crash in SetDocumentURI, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D204611
2024-03-22 00:07:27 +00:00
Tooru Fujisawa 8c59289f4f Bug 1864168 - Part 1: Use 1-origin column number in nsIContentSecurityPolicy. r=smaug,devtools-reviewers,ochameau,ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D193369
2023-11-22 12:31:30 +00:00
Natalia Csoregi 705aa81869 Backed out 14 changesets (bug 1865005, bug 1864168, bug 1864155, bug 1862814, bug 1862693) for causing bustage on nsRFPService.cpp. CLOSED TREE
Backed out changeset a4f3e7625abf (bug 1865005)
Backed out changeset ab38141e470b (bug 1862814)
Backed out changeset a679b50dc4a9 (bug 1862814)
Backed out changeset e340886ce62a (bug 1862814)
Backed out changeset 1378502e64b0 (bug 1862814)
Backed out changeset 8ee94e5e79c2 (bug 1862814)
Backed out changeset 6d4ef1cdfabb (bug 1864168)
Backed out changeset 2c30c4d757fc (bug 1864168)
Backed out changeset d4db9576559b (bug 1864168)
Backed out changeset 8ffec0d83028 (bug 1864168)
Backed out changeset fa77d852b494 (bug 1864168)
Backed out changeset f6646771a26a (bug 1864168)
Backed out changeset 7bd0ff6986df (bug 1864155)
Backed out changeset 39867b503289 (bug 1862693)
2023-11-22 14:01:55 +02:00
Tooru Fujisawa a4a513ad86 Bug 1864168 - Part 1: Use 1-origin column number in nsIContentSecurityPolicy. r=smaug,devtools-reviewers,ochameau,ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D193369
2023-11-22 11:13:54 +00:00
Tooru Fujisawa c8916f8e8e Bug 1862692 - Part 16: Use 1-origin column number type in JS::DescribeScriptedCaller. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D193029
2023-11-09 11:41:10 +00:00
Valentin Gosu 7f59cce94d Bug 1848694 - Remove/avoid global references to nsIIOService r=mccr8,necko-reviewers,kershaw
This patch removes the static pointer to nsIIOService in nsContentUtils,
replacing it to calls to mozilla::components::IO::Service.

It also makes nsScriptSecurityManager::sIOService a StaticRefPtr.

Differential Revision: https://phabricator.services.mozilla.com/D188714
2023-09-22 12:49:44 +00:00
Sandor Molnar bf0bc531b4 Backed out changeset b858a0740582 (bug 1848694) for causing build bustages on dom/base/Element.cpp CLOSED TREE 2023-09-21 16:45:57 +03:00
Valentin Gosu 32014974c0 Bug 1848694 - Remove/avoid global references to nsIIOService r=mccr8,necko-reviewers,kershaw
This patch removes the static pointer to nsIIOService in nsContentUtils,
replacing it to calls to mozilla::components::IO::Service.

It also makes nsScriptSecurityManager::sIOService a StaticRefPtr.

Differential Revision: https://phabricator.services.mozilla.com/D188714
2023-09-21 12:39:20 +00:00
Tooru Fujisawa 357b9c51d8 Bug 1847469 - Part 24: Use column number types in JS::DescribeScriptedCaller. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185762
2023-08-16 17:31:42 +00:00
Tooru Fujisawa 264b992ca0 Bug 1847469 - Part 23: Use uint32_t for line and column in DescribeScriptedCaller* functions as a preparation to use column number types. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185761
2023-08-16 17:31:41 +00:00
Cristian Tuns 4fe9ed8f30 Backed out 27 changesets (bug 1847469) for causing spidermonkey bustages in Script.cpp CLOSED TREE
Backed out changeset 9d6e2651a013 (bug 1847469)
Backed out changeset 9b72d668efd2 (bug 1847469)
Backed out changeset 86abf5cf0a22 (bug 1847469)
Backed out changeset 46833087f8ac (bug 1847469)
Backed out changeset f3e2207fdeec (bug 1847469)
Backed out changeset aed75776cfff (bug 1847469)
Backed out changeset 8292a38bd99f (bug 1847469)
Backed out changeset 1320f83fb8c7 (bug 1847469)
Backed out changeset df9f925f9837 (bug 1847469)
Backed out changeset 69f32cf1862a (bug 1847469)
Backed out changeset b2ddddec8818 (bug 1847469)
Backed out changeset 056eed7abc97 (bug 1847469)
Backed out changeset 5df4f43ac0bf (bug 1847469)
Backed out changeset cb57923f6532 (bug 1847469)
Backed out changeset a0993f2a2195 (bug 1847469)
Backed out changeset 782499fbedf2 (bug 1847469)
Backed out changeset cf84fb98c5e1 (bug 1847469)
Backed out changeset 1fa5ab59814b (bug 1847469)
Backed out changeset f5f78944df81 (bug 1847469)
Backed out changeset aa14337bf5c6 (bug 1847469)
Backed out changeset 6757db4575d7 (bug 1847469)
Backed out changeset 236ff135701e (bug 1847469)
Backed out changeset 9b4d5b435020 (bug 1847469)
Backed out changeset a0f789621bc8 (bug 1847469)
Backed out changeset c19b81f48055 (bug 1847469)
Backed out changeset b4521e546d7e (bug 1847469)
Backed out changeset f26a10289316 (bug 1847469)
2023-08-16 07:08:01 -04:00
Tooru Fujisawa 5c4dc17c44 Bug 1847469 - Part 24: Use column number types in JS::DescribeScriptedCaller. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185762
2023-08-16 10:26:33 +00:00
Tooru Fujisawa f61ba91ee2 Bug 1847469 - Part 23: Use uint32_t for line and column in DescribeScriptedCaller* functions as a preparation to use column number types. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185761
2023-08-16 10:26:33 +00:00
Nika Layzell b582df1238 Bug 1443925 - Part 5: Make it possible to get the system principal from any thread, r=ckerschb
This is required because the script security manager which currently owns the
singleton is main-thread only. This change still ties the lifecycle of the
static to that service, but also makes it generally available from any thread.

Differential Revision: https://phabricator.services.mozilla.com/D163035
2022-12-02 00:53:51 +00:00
Nika Layzell ee682d387a Bug 1443925 - Part 3: Make nsScriptSecurityManager::GetStrictFileOriginPolicy threadsafe, r=ckerschb
This is used in various places in principals, as well as in the implementation
of nsScriptSecurityManager::SecurityCompareURIs which is also now threadsafe
after this change.

Differential Revision: https://phabricator.services.mozilla.com/D163033
2022-12-02 00:53:50 +00:00
Shane Caraveo 3978bd8144 Bug 1783078 require web_accessible_resources for any extension loads from a content script r=robwu,ckerschb
Enforce requiring web accessible resources in MV3 and use a pref to turn on later for MV2.

Differential Revision: https://phabricator.services.mozilla.com/D153677
2022-08-05 04:36:30 +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
Emilio Cobos Álvarez 42b7f1a58c Bug 1780788 - Use abstract strings as in-arguments for ipdl. r=nika,necko-reviewers,media-playback-reviewers,alwu,dragana
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.

Non-virtual actors can still use `nsString` if they need to on the
receiving end.

Differential Revision: https://phabricator.services.mozilla.com/D152519
2022-07-25 20:19:48 +00:00
Tom Ritter be3d5275d4 Bug 1772378: Move Eval checks higher to encompass JSMs r=bholley
This no longer permits wasm modules to being instatiated;
and will perform an eval check even when no csp exists,
such as for JSMs.

Differential Revision: https://phabricator.services.mozilla.com/D148141
2022-06-29 13:45:57 +00:00
Iulian Moraru 5b54549da9 Backed out changeset 6b0d5ebbdea5 (bug 1772378) for causing multiple xpcshell failures. 2022-06-28 01:47:11 +03:00
Tom Ritter fc33a9662d Bug 1772378: Move Eval checks higher to encompass JSMs r=bholley
This no longer permits wasm modules to being instatiated;
and will perform an eval check even when no csp exists,
such as for JSMs.

Differential Revision: https://phabricator.services.mozilla.com/D148141
2022-06-27 19:28:05 +00:00
Csoregi Natalia 9d7e731ba5 Backed out changeset 6085e9770cde (bug 1772378) for causing xpcshell crashes. CLOSED TREE 2022-06-27 21:47:32 +03:00
Tom Ritter eb33210657 Bug 1772378: Move Eval checks higher to encompass JSMs r=bholley
This no longer permits wasm modules to being instatiated;
and will perform an eval check even when no csp exists,
such as for JSMs.

Differential Revision: https://phabricator.services.mozilla.com/D148141
2022-06-27 17:34:12 +00:00
Mike Conley 32c1db2b09 Bug 1354248 - Part 4: Make PageIconProtocolHandler use RemoteStreamGetter. r=necko-reviewers,nika,mak,ckerschb,kershaw
This makes it so that PageIconProtocolHandler uses RemoteStreamGetter in the event that the
privileged about content process attempts to use the page-icon: protocol. This allows the parent
to then remotely stream the favicons down to the privileged about content process.

This also adds a test to check that only the privileged about content process can use this
protocol, and that "normal" web content processes cannot.

Differential Revision: https://phabricator.services.mozilla.com/D147335
2022-06-03 15:17:34 +00:00
Rob Wu c0e20dd0b0 Bug 1770468 - Report-only wasm-unsafe-eval in MV2 r=mixedpuppy,freddyb,ckerschb
For backcompat, do not enforce wasm-unsafe-eval even if the extension
has specified a custom CSP. Do report the errors though, to allow
extension authors to discover the issue and fix it.

Differential Revision: https://phabricator.services.mozilla.com/D147105
2022-05-24 13:56:22 +00:00
Tom Schuster 4525afaf9f Bug 1740263 - Implement the CSP checking callback for WASM. r=dom-worker-reviewers,smaug,freddyb
Differential Revision: https://phabricator.services.mozilla.com/D141979
2022-05-19 14:13:50 +00:00
Iulian Moraru 4d59317ca4 Backed out 6 changesets (bug 1740263) for causing bp-hybrid bustages on nsScriptSecurityManager. CLOSED TREE
Backed out changeset 2f5ec6ad0f81 (bug 1740263)
Backed out changeset a1e7766cdb94 (bug 1740263)
Backed out changeset 3978ccb95455 (bug 1740263)
Backed out changeset e34ba774b3f8 (bug 1740263)
Backed out changeset 8365b10be28e (bug 1740263)
Backed out changeset d923462c9cd0 (bug 1740263)
2022-05-19 03:28:08 +03:00
Tom Schuster 5c808859fa Bug 1740263 - Implement the CSP checking callback for WASM. r=dom-worker-reviewers,smaug,freddyb
Differential Revision: https://phabricator.services.mozilla.com/D141979
2022-05-18 21:39:29 +00:00
Andrew McCreight f7be2ba306 Bug 1731645 - Fix non-unified build errors in caps/. r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D126135
2021-09-21 15:42:01 +00:00
Paul Zuehlcke a466d4aa0a Bug 1687314 - Improve behavior of GetChannelResultStoragePrincipal and StoragePrincipalHelper::Create when handling NullPrincipal. r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D122381
2021-08-17 12:51:22 +00:00
Nika Layzell e620d25a35 Bug 1715167 - Part 6: Use the unsandboxed result principal as precursor for sandbox principals, r=ckerschb,ngogge
This change stores a generated nsID directly on the LoadInfo, rather
than the full SandboxedLoadingPrincipal. This allows for the sandboxed
principal to be constructed from GetChannelResultPrincipal using the
unsandboxed result principal as a precursor, rather than the loading
principal.

The nsID is reset by HttpChannelBase whenever a non-internal redirect
occurs to reduce the chance of multiple null result principals during a
redirect with the same nsID, but different precursors.

Depends on D119692

Differential Revision: https://phabricator.services.mozilla.com/D119693
2021-07-15 21:09:15 +00:00
Nika Layzell 6ef5d5d817 Bug 1715167 - Part 3: Track precursor origins for URI_INHERITS_SECURITY_CONTEXT responses, r=ckerschb,ngogge
If a URI has the URI_INHERITS_SECURITY_CONTEXT flag it will not be given
a content principal by CreateContentPrincipal. This patch changes the
algorithm for creating result principals for network requests such that
the null principal created in this situation has a precursor principal
tracked on it.

Depends on D119689

Differential Revision: https://phabricator.services.mozilla.com/D119690
2021-07-15 21:09:14 +00:00
Alexandru Michis 88d34a31f5 Backed out changeset 19de2822bc0c (bug 1711168) for causing Bug 1719063.
CLOSED TREE
2021-07-08 22:56:34 +03:00
Christoph Kerschbaumer 15f7d2932c Bug 1654488: Remove pref in CheckLoadURIWIthFlags which allows all UI resources to load r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D118817
2021-06-25 17:28:59 +00:00
Shane Caraveo 7a0db3609f Bug 1711168 support extension matching in webAccessibleResources r=zombie,smaug
Differential Revision: https://phabricator.services.mozilla.com/D115114
2021-06-23 21:52:38 +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
Shane Caraveo c4d682be93 Bug 1697334 implement matches property in web_accessible_resources r=zombie,ckerschb,necko-reviewers,smaug
This patch implements support for the manifest V3 matches property
which limits what hosts may load an extensions web_accessible_resources.

Differential Revision: https://phabricator.services.mozilla.com/D107746
2021-05-14 03:15:15 +00:00
Tom Schuster 801c5575e6 Bug 1696229 - Don't report wrong errors for expanded principals in CheckLoadURIWithPrincipal. r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D107101
2021-03-08 20:57:08 +00:00
Alexis Beingessner 07f2f659c6 Bug 1686616 - make StringBundle use Components instead of Services. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D105531
2021-02-18 13:26:32 +00:00
Christoph Kerschbaumer 6cdf7289fa Bug 1690942: Ensure CheckLoadURIWithPrincipalFromJS does not crash when receiving nullptr principal r=dveditz
Differential Revision: https://phabricator.services.mozilla.com/D104161
2021-02-11 13:02:20 +00:00
Kris Maglione b92138146b Bug 1685801: Part 12 - Remove BrowserUtils.urlSecurityCheck. r=mccr8
This moves the exception prettifying to the script security manager for all JS
callers, where it is much cheaper and more consistently applied.

Differential Revision: https://phabricator.services.mozilla.com/D101492
2021-01-28 20:58:48 +00:00
Mihai Alexandru Michis 040e2ea5d0 Backed out 12 changesets (bug 1685801) for causing bc failures in browser_ctrlTab.js
CLOSED TREE

Backed out changeset 021924b62f13 (bug 1685801)
Backed out changeset 38cc10101c1f (bug 1685801)
Backed out changeset 9ab9574ac72a (bug 1685801)
Backed out changeset 1a7f259cc2ec (bug 1685801)
Backed out changeset b267b19a7f6e (bug 1685801)
Backed out changeset 7dfcf0257487 (bug 1685801)
Backed out changeset ee0d0169b079 (bug 1685801)
Backed out changeset 0c358ee51951 (bug 1685801)
Backed out changeset 338ab91af557 (bug 1685801)
Backed out changeset a49415007aaf (bug 1685801)
Backed out changeset b91098299143 (bug 1685801)
Backed out changeset edf6209861a8 (bug 1685801)
2021-01-28 22:55:11 +02:00
Kris Maglione 205b99c744 Bug 1685801: Part 12 - Remove BrowserUtils.urlSecurityCheck. r=mccr8
This moves the exception prettifying to the script security manager for all JS
callers, where it is much cheaper and more consistently applied.

Differential Revision: https://phabricator.services.mozilla.com/D101492
2021-01-28 05:25:15 +00:00
Butkovits Atila 7decdccbdc Backed out 12 changesets (bug 1685801) for causing failures on browser_fission_maxOrigins.js. CLOSED TREE
Backed out changeset 0d7153110519 (bug 1685801)
Backed out changeset 5175062925c7 (bug 1685801)
Backed out changeset 2c1250e786f0 (bug 1685801)
Backed out changeset 0ce3c773ba74 (bug 1685801)
Backed out changeset 9d51c6e24dee (bug 1685801)
Backed out changeset 3f4dc6349441 (bug 1685801)
Backed out changeset a80de9abb9f8 (bug 1685801)
Backed out changeset 30786893a5e7 (bug 1685801)
Backed out changeset 8007b12d6e32 (bug 1685801)
Backed out changeset fa814f4b7125 (bug 1685801)
Backed out changeset 14e4e47ee99f (bug 1685801)
Backed out changeset d9f1feba9454 (bug 1685801)
2021-01-28 07:15:59 +02:00