Changeset 245538 in webkit
- Timestamp:
- May 20, 2019, 3:53:03 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/security/showModalDialog-sync-cross-origin-page-load2-expected.txt (added)
-
LayoutTests/http/tests/security/showModalDialog-sync-cross-origin-page-load2.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/bindings/js/ScriptController.cpp (modified) (1 diff)
-
Source/WebCore/bindings/js/ScriptController.h (modified) (1 diff)
-
Source/WebCore/html/HTMLFrameElementBase.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r245534 r245538 1 2019-05-20 Chris Dumez <cdumez@apple.com> 2 3 Fix security check in ScriptController::canAccessFromCurrentOrigin() 4 https://bugs.webkit.org/show_bug.cgi?id=196730 5 <rdar://problem/49731231> 6 7 Reviewed by Ryosuke Niwa. 8 9 Add layout test coverage. 10 11 * http/tests/security/showModalDialog-sync-cross-origin-page-load2-expected.txt: Added. 12 * http/tests/security/showModalDialog-sync-cross-origin-page-load2.html: Added. 13 1 14 2019-05-20 Gabe Giosia <giosia@google.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r245534 r245538 1 2019-05-20 Chris Dumez <cdumez@apple.com> 2 3 Fix security check in ScriptController::canAccessFromCurrentOrigin() 4 https://bugs.webkit.org/show_bug.cgi?id=196730 5 <rdar://problem/49731231> 6 7 Reviewed by Ryosuke Niwa. 8 9 Fix security check in ScriptController::canAccessFromCurrentOrigin() when there is no 10 current JS exec state. Instead of returning true unconditionally, we now fall back to 11 using the accessing document's origin for the security check. The new behavior is 12 aligned with Blink: 13 https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/html_frame_element_base.cc?rcl=d3f22423d512b45466f1694020e20da9e0c6ee6a&l=62 14 15 This fix is based on a patch from Sergei Glazunov <glazunov@google.com>. 16 17 Test: http/tests/security/showModalDialog-sync-cross-origin-page-load2.html 18 19 * bindings/js/ScriptController.cpp: 20 (WebCore::ScriptController::canAccessFromCurrentOrigin): 21 * bindings/js/ScriptController.h: 22 * html/HTMLFrameElementBase.cpp: 23 (WebCore::HTMLFrameElementBase::isURLAllowed const): 24 1 25 2019-05-20 Gabe Giosia <giosia@google.com> 2 26 -
trunk/Source/WebCore/bindings/js/ScriptController.cpp
r245508 r245538 384 384 } 385 385 386 bool ScriptController::canAccessFromCurrentOrigin(Frame* frame )386 bool ScriptController::canAccessFromCurrentOrigin(Frame* frame, Document& accessingDocument) 387 387 { 388 388 auto* state = JSExecState::currentState(); 389 389 390 // If the current state is null we're in a call path where the DOM security check doesn't apply (eg. parser). 391 if (!state) 392 return true; 390 // If the current state is null we should use the accessing document for the security check. 391 if (!state) { 392 auto* targetDocument = frame ? frame->document() : nullptr; 393 return targetDocument && accessingDocument.securityOrigin().canAccess(targetDocument->securityOrigin()); 394 } 393 395 394 396 return BindingSecurity::shouldAllowAccessToFrame(state, frame); -
trunk/Source/WebCore/bindings/js/ScriptController.h
r243324 r245538 124 124 void disableWebAssembly(const String& errorMessage); 125 125 126 static bool canAccessFromCurrentOrigin(Frame* );126 static bool canAccessFromCurrentOrigin(Frame*, Document& accessingDocument); 127 127 WEBCORE_EXPORT bool canExecuteScripts(ReasonForCallingCanExecuteScripts); 128 128 -
trunk/Source/WebCore/html/HTMLFrameElementBase.cpp
r238771 r245538 74 74 if (WTF::protocolIsJavaScript(completeURL)) { 75 75 RefPtr<Document> contentDoc = this->contentDocument(); 76 if (contentDoc && !ScriptController::canAccessFromCurrentOrigin(contentDoc->frame() ))76 if (contentDoc && !ScriptController::canAccessFromCurrentOrigin(contentDoc->frame(), document())) 77 77 return false; 78 78 }
Note:
See TracChangeset
for help on using the changeset viewer.