mirror of
https://github.com/electron/electron.git
synced 2026-01-09 23:48:01 -05:00
* chore: bump chromium in DEPS to 133.0.6887.0 * chore: update render_widget_host_view_base.patch trivial manual intervention needed due to header context shear Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5952851 * chore: update osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch trivial manual intervention needed due to header context shear Xref: https://chromium-review.googlesource.com/c/chromium/src/+/6068570 * chore: e patches all * Remove ClipboardFormatType::GetType() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/6075792 * Remove raw byte range methods from network::ResourceRequestBody Xref: https://chromium-review.googlesource.com/c/chromium/src/+/6038757 * fix: update patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch:wq Refs https://issues.chromium.org/issues/40092527 * fix: windows gn check * chore: update patches/chromium/render_widget_host_view_base.patch --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
73 lines
3.9 KiB
Diff
73 lines
3.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shelley Vohr <shelley.vohr@gmail.com>
|
|
Date: Mon, 29 Aug 2022 11:44:57 +0200
|
|
Subject: fix: crash loading non-standard schemes in iframes
|
|
|
|
This fixes a crash that occurs when loading non-standard schemes from
|
|
iframes or webviews. This was happening because
|
|
ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin contains explicit
|
|
exceptions to allow built-in non-standard schemes, but does not check
|
|
for non-standard schemes registered by the embedder.
|
|
|
|
This patch adjusts the origin calculation for subframe non-standard schemes in
|
|
- browser process at `NavigationRequest::GetOriginForURLLoaderFactoryUncheckedWithDebugInfo`
|
|
- render process at `DocumentLoader::CalculateOrigin`
|
|
|
|
When top level frame navigates to non-standard scheme url, the origin is calculated
|
|
as `null` without any derivation. It is only in cases where there is a `initiator_origin`
|
|
then the origin is derived from it, which is usually the case for renderer initiated
|
|
navigations and iframes are no exceptions from this rule.
|
|
|
|
The patch should be removed in favor of either:
|
|
- Remove support for non-standard custom schemes
|
|
- Register non-standard custom schemes as websafe schemes and update
|
|
CPSPI::CanAccessDataForOrigin to allow them for any navigation.
|
|
- Update the callsite to use RFHI::CanCommitOriginAndUrl in upstream, previous
|
|
effort to do this can be found at https://chromium-review.googlesource.com/c/chromium/src/+/3856266.
|
|
|
|
Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397.
|
|
|
|
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
|
|
index e919dcd7acf870e39709d7ac5afd356a8a2b94fa..ceed8afc60dd3d38ca722b79b93c6b1c1ee7fb76 100644
|
|
--- a/content/browser/renderer_host/navigation_request.cc
|
|
+++ b/content/browser/renderer_host/navigation_request.cc
|
|
@@ -10867,6 +10867,12 @@ NavigationRequest::GetOriginForURLLoaderFactoryUncheckedWithDebugInfo() {
|
|
"blob");
|
|
}
|
|
|
|
+ if (!IsInMainFrame() && !common_params().url.IsStandard()) {
|
|
+ return std::make_pair(url::Origin::Resolve(common_params().url,
|
|
+ url::Origin()),
|
|
+ "url_non_standard");
|
|
+ }
|
|
+
|
|
// In cases not covered above, URLLoaderFactory should be associated with the
|
|
// origin of |common_params.url| and/or |common_params.initiator_origin|.
|
|
url::Origin resolved_origin = url::Origin::Resolve(
|
|
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc
|
|
index ccc8243d90000c8da65486a00c4800ede3de66fe..8355f72ec1e2d3a50c21761e764ad6c0233a3b81 100644
|
|
--- a/third_party/blink/renderer/core/loader/document_loader.cc
|
|
+++ b/third_party/blink/renderer/core/loader/document_loader.cc
|
|
@@ -2309,6 +2309,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() {
|
|
scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
|
|
Document* owner_document) {
|
|
scoped_refptr<SecurityOrigin> origin;
|
|
+ bool is_standard = false;
|
|
+ std::string protocol = url_.Protocol().Ascii();
|
|
+ is_standard = url::IsStandard(
|
|
+ protocol.data(), url::Component(0, static_cast<int>(protocol.size())));
|
|
StringBuilder debug_info_builder;
|
|
// Whether the origin is newly created within this call, instead of copied
|
|
// from an existing document's origin or from `origin_to_commit_`. If this is
|
|
@@ -2362,6 +2366,10 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
|
|
// the end of this function.
|
|
origin = origin_to_commit_;
|
|
debug_info_builder.Append("use_origin_to_commit");
|
|
+ } else if (!SecurityOrigin::ShouldUseInnerURL(url_) &&
|
|
+ !is_standard) {
|
|
+ debug_info_builder.Append("use_url_with_non_standard_scheme");
|
|
+ origin = SecurityOrigin::Create(url_);
|
|
} else {
|
|
debug_info_builder.Append("use_url_with_precursor");
|
|
// Otherwise, create an origin that propagates precursor information
|