Title: [256593] releases/WebKitGTK/webkit-2.26/Source/WebCore
- Revision
- 256593
- Author
- [email protected]
- Date
- 2020-02-14 01:40:16 -0800 (Fri, 14 Feb 2020)
Log Message
Merge r253654 - executeIfJavaScriptURL should check requester's security origin
https://bugs.webkit.org/show_bug.cgi?id=205324
Reviewed by Brent Fulgham.
Don't execute the _javascript_ in ScriptController::executeIfJavaScriptURL if the security origin
of the current document is no longer accessible from the request originator's security origin.
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::executeIfJavaScriptURL): Added a check.
* bindings/js/ScriptController.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::urlSelected): Pass around the security origin of the requester.
(WebCore::FrameLoader::submitForm):
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.26/Source/WebCore/ChangeLog (256592 => 256593)
--- releases/WebKitGTK/webkit-2.26/Source/WebCore/ChangeLog 2020-02-14 09:40:11 UTC (rev 256592)
+++ releases/WebKitGTK/webkit-2.26/Source/WebCore/ChangeLog 2020-02-14 09:40:16 UTC (rev 256593)
@@ -1,3 +1,20 @@
+2019-12-17 Ryosuke Niwa <[email protected]>
+
+ executeIfJavaScriptURL should check requester's security origin
+ https://bugs.webkit.org/show_bug.cgi?id=205324
+
+ Reviewed by Brent Fulgham.
+
+ Don't execute the _javascript_ in ScriptController::executeIfJavaScriptURL if the security origin
+ of the current document is no longer accessible from the request originator's security origin.
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::executeIfJavaScriptURL): Added a check.
+ * bindings/js/ScriptController.h:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::urlSelected): Pass around the security origin of the requester.
+ (WebCore::FrameLoader::submitForm):
+
2019-12-16 youenn fablet <[email protected]>
Consider top-level context whose origin is unique as insecure
Modified: releases/WebKitGTK/webkit-2.26/Source/WebCore/bindings/js/ScriptController.cpp (256592 => 256593)
--- releases/WebKitGTK/webkit-2.26/Source/WebCore/bindings/js/ScriptController.cpp 2020-02-14 09:40:11 UTC (rev 256592)
+++ releases/WebKitGTK/webkit-2.26/Source/WebCore/bindings/js/ScriptController.cpp 2020-02-14 09:40:16 UTC (rev 256593)
@@ -616,11 +616,14 @@
return evaluate(sourceCode, exceptionDetails);
}
-bool ScriptController::executeIfJavaScriptURL(const URL& url, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL)
+bool ScriptController::executeIfJavaScriptURL(const URL& url, RefPtr<SecurityOrigin> requesterSecurityOrigin, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL)
{
if (!WTF::protocolIsJavaScript(url))
return false;
+ if (requesterSecurityOrigin && !requesterSecurityOrigin->canAccess(m_frame.document()->securityOrigin()))
+ return true;
+
if (!m_frame.page() || !m_frame.document()->contentSecurityPolicy()->allowJavaScriptURLs(m_frame.document()->url(), eventHandlerPosition().m_line))
return true;
Modified: releases/WebKitGTK/webkit-2.26/Source/WebCore/bindings/js/ScriptController.h (256592 => 256593)
--- releases/WebKitGTK/webkit-2.26/Source/WebCore/bindings/js/ScriptController.h 2020-02-14 09:40:11 UTC (rev 256592)
+++ releases/WebKitGTK/webkit-2.26/Source/WebCore/bindings/js/ScriptController.h 2020-02-14 09:40:16 UTC (rev 256593)
@@ -27,6 +27,7 @@
#include <_javascript_Core/JSBase.h>
#include <_javascript_Core/Strong.h>
#include <wtf/Forward.h>
+#include <wtf/Optional.h>
#include <wtf/RefPtr.h>
#include <wtf/WeakPtr.h>
#include <wtf/text/TextPosition.h>
@@ -96,7 +97,7 @@
bool shouldAllowUserAgentScripts(Document&) const;
// Returns true if argument is a _javascript_ URL.
- bool executeIfJavaScriptURL(const URL&, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
+ bool executeIfJavaScriptURL(const URL&, RefPtr<SecurityOrigin> = nullptr, ShouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
// This function must be called from the main thread. It is safe to call it repeatedly.
// Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly.
Modified: releases/WebKitGTK/webkit-2.26/Source/WebCore/loader/FrameLoader.cpp (256592 => 256593)
--- releases/WebKitGTK/webkit-2.26/Source/WebCore/loader/FrameLoader.cpp 2020-02-14 09:40:11 UTC (rev 256592)
+++ releases/WebKitGTK/webkit-2.26/Source/WebCore/loader/FrameLoader.cpp 2020-02-14 09:40:16 UTC (rev 256593)
@@ -397,7 +397,7 @@
Ref<Frame> protect(m_frame);
- if (m_frame.script().executeIfJavaScriptURL(frameRequest.resourceRequest().url(), frameRequest.shouldReplaceDocumentIfJavaScriptURL()))
+ if (m_frame.script().executeIfJavaScriptURL(frameRequest.resourceRequest().url(), &frameRequest.requester().securityOrigin(), frameRequest.shouldReplaceDocumentIfJavaScriptURL()))
return;
if (frameRequest.frameName().isEmpty())
@@ -433,7 +433,7 @@
return;
m_isExecutingJavaScriptFormAction = true;
Ref<Frame> protect(m_frame);
- m_frame.script().executeIfJavaScriptURL(submission->action(), DoNotReplaceDocumentIfJavaScriptURL);
+ m_frame.script().executeIfJavaScriptURL(submission->action(), nullptr, DoNotReplaceDocumentIfJavaScriptURL);
m_isExecutingJavaScriptFormAction = false;
return;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes