Title: [253720] branches/safari-608-branch/Source/WebCore
- Revision
- 253720
- Author
- [email protected]
- Date
- 2019-12-18 14:20:55 -0800 (Wed, 18 Dec 2019)
Log Message
Cherry-pick r253654. rdar://problem/58049166
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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253654 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (253719 => 253720)
--- branches/safari-608-branch/Source/WebCore/ChangeLog 2019-12-18 22:05:47 UTC (rev 253719)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog 2019-12-18 22:20:55 UTC (rev 253720)
@@ -1,5 +1,43 @@
2019-12-18 Dan Robson <[email protected]>
+ Cherry-pick r253654. rdar://problem/58049166
+
+ 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):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253654 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-18 Dan Robson <[email protected]>
+
Cherry-pick r253662. rdar://problem/58049156
Limit URL to reasonable size
Modified: branches/safari-608-branch/Source/WebCore/bindings/js/ScriptController.cpp (253719 => 253720)
--- branches/safari-608-branch/Source/WebCore/bindings/js/ScriptController.cpp 2019-12-18 22:05:47 UTC (rev 253719)
+++ branches/safari-608-branch/Source/WebCore/bindings/js/ScriptController.cpp 2019-12-18 22:20:55 UTC (rev 253720)
@@ -615,11 +615,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: branches/safari-608-branch/Source/WebCore/bindings/js/ScriptController.h (253719 => 253720)
--- branches/safari-608-branch/Source/WebCore/bindings/js/ScriptController.h 2019-12-18 22:05:47 UTC (rev 253719)
+++ branches/safari-608-branch/Source/WebCore/bindings/js/ScriptController.h 2019-12-18 22:20:55 UTC (rev 253720)
@@ -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: branches/safari-608-branch/Source/WebCore/loader/FrameLoader.cpp (253719 => 253720)
--- branches/safari-608-branch/Source/WebCore/loader/FrameLoader.cpp 2019-12-18 22:05:47 UTC (rev 253719)
+++ branches/safari-608-branch/Source/WebCore/loader/FrameLoader.cpp 2019-12-18 22:20:55 UTC (rev 253720)
@@ -397,8 +397,10 @@
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())) {
+ m_quickRedirectComing = false;
return;
+ }
if (frameRequest.frameName().isEmpty())
frameRequest.setFrameName(m_frame.document()->baseTarget());
@@ -433,7 +435,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