|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Tariq Bashir <120014322+t-bashir-bs@users.noreply.github.com> |
| 3 | +Date: Thu, 27 Feb 2025 14:29:55 +0000 |
| 4 | +Subject: OS-17051: Short-circuit same origin check for frame load if |
| 5 | + websecurity is disabled |
| 6 | + |
| 7 | +Disable the same origin check for frame loads if web security is disabled. |
| 8 | +This is to allow the loading of iframes from different origins when web |
| 9 | +security is disabled. |
| 10 | + |
| 11 | +This is a cherry pick of https://cam-gerrit.brightsign.info/c/qtwebengine-chromium/+/6236 |
| 12 | + |
| 13 | +diff --git a/content/browser/renderer_host/ancestor_throttle.cc b/content/browser/renderer_host/ancestor_throttle.cc |
| 14 | +index d17a791b05bf59b64cdc055620560a3cf1d75b1b..19f7ee73fcdeefcbf6a1f756daa9a44f01624312 100644 |
| 15 | +--- a/content/browser/renderer_host/ancestor_throttle.cc |
| 16 | ++++ b/content/browser/renderer_host/ancestor_throttle.cc |
| 17 | +@@ -25,6 +25,7 @@ |
| 18 | + #include "content/public/browser/navigation_handle.h" |
| 19 | + #include "content/public/browser/navigation_throttle.h" |
| 20 | + #include "content/public/browser/storage_partition.h" |
| 21 | ++#include "content/public/browser/web_contents.h" |
| 22 | + #include "content/public/common/content_client.h" |
| 23 | + #include "net/http/http_response_headers.h" |
| 24 | + #include "services/network/public/cpp/content_security_policy/content_security_policy.h" |
| 25 | +@@ -253,7 +254,9 @@ AncestorThrottle::CheckResult AncestorThrottle::EvaluateXFrameOptions( |
| 26 | + url::Origin current_origin = |
| 27 | + url::Origin::Create(navigation_handle()->GetURL()); |
| 28 | + while (parent) { |
| 29 | +- if (!parent->GetLastCommittedOrigin().IsSameOriginWith( |
| 30 | ++ if ((!navigation_handle()->GetWebContents() |
| 31 | ++ || navigation_handle()->GetWebContents()->GetOrCreateWebPreferences().web_security_enabled) |
| 32 | ++ && !parent->GetLastCommittedOrigin().IsSameOriginWith( |
| 33 | + current_origin)) { |
| 34 | + if (logging == LoggingDisposition::LOG_TO_CONSOLE) |
| 35 | + ConsoleErrorXFrameOptions(disposition); |
0 commit comments