mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
* chore: bump chromium in DEPS to 124.0.6355.0 * 5341411: view-transition: Ensure resources are cleaned up in all cases. https://chromium-review.googlesource.com/c/chromium/src/+/5341411 * chore: fixup patch indices * 5354013: Return nullopt on error from ProcessMetrics CPU measurements https://chromium-review.googlesource.com/c/chromium/src/+/5354013 * chore: bump chromium in DEPS to 124.0.6357.0 * chore: update patches * 5368769: Reland "[mojo] Use large worker for mojom_parser action" https://chromium-review.googlesource.com/c/chromium/src/+/5368769 * 5336171: [Extensions] Introduce a CoreExtensionsRendererAPIProvider https://chromium-review.googlesource.com/c/chromium/src/+/5336171 * 5367334: [FS Shortcut] Refactor ExclusiveAccessManager https://chromium-review.googlesource.com/c/chromium/src/+/5367334 * 5354161: Rename GeolocationManager to GeolocationSystemPermissionManager https://chromium-review.googlesource.com/c/chromium/src/+/5354161 * fixup: [Extensions] Introduce a CoreExtensionsRendererAPIProvider * chore: bump chromium in DEPS to 124.0.6359.0 * chore: update patches * 5371370: [Extensions] Move core NativeHandler registration https://chromium-review.googlesource.com/c/chromium/src/+/5371370 * 5370702: [Extensions] Introduce ShellExtensionsRendererAPIProvider https://chromium-review.googlesource.com/c/chromium/src/+/5370702 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
68 lines
3.6 KiB
Diff
68 lines
3.6 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 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.
|
|
|
|
Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397.
|
|
|
|
Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/3856266.
|
|
|
|
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
|
|
index 1ca5ce3110edea41fde30db79b384489d0297977..072d02f2130294d59176e510caafade29feca96f 100644
|
|
--- a/content/browser/renderer_host/navigation_request.cc
|
|
+++ b/content/browser/renderer_host/navigation_request.cc
|
|
@@ -10420,6 +10420,12 @@ NavigationRequest::GetOriginForURLLoaderFactoryUncheckedWithDebugInfo() {
|
|
return std::make_pair(parent->GetLastCommittedOrigin(), "about_srcdoc");
|
|
}
|
|
|
|
+ if (!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 1e94b973f4486e11ae05528b4a97c9fae74fe7f2..43ffe048aea73bd2fae57fb87ad1346296189d64 100644
|
|
--- a/third_party/blink/renderer/core/loader/document_loader.cc
|
|
+++ b/third_party/blink/renderer/core/loader/document_loader.cc
|
|
@@ -2165,6 +2165,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;
|
|
if (origin_to_commit_) {
|
|
// Origin to commit is specified by the browser process, it must be taken
|
|
@@ -2212,6 +2216,10 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
|
|
debug_info_builder.Append(", url=");
|
|
debug_info_builder.Append(owner_document->Url().BaseAsString());
|
|
debug_info_builder.Append(")");
|
|
+ } else if (!SecurityOrigin::ShouldUseInnerURL(url_) &&
|
|
+ !is_standard) {
|
|
+ debug_info_builder.Append("use_url_with_non_standard_scheme");
|
|
+ origin = SecurityOrigin::Create(url_);
|
|
} else if (url_.IsAboutSrcdocURL()) {
|
|
// If there's no owner_document and this is a srcdoc load, then get the
|
|
// origin from the remote parent. A srcdoc navigation with no owner_document
|