Changeset 245925 in webkit
- Timestamp:
- May 30, 2019, 5:30:13 PM (7 years ago)
- Location:
- branches/safari-607-branch
- 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
-
branches/safari-607-branch/LayoutTests/ChangeLog
r245924 r245925 1 2019-05-30 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r245538. rdar://problem/50753927 4 5 Fix security check in ScriptController::canAccessFromCurrentOrigin() 6 https://bugs.webkit.org/show_bug.cgi?id=196730 7 <rdar://problem/49731231> 8 9 Reviewed by Ryosuke Niwa. 10 11 Source/WebCore: 12 13 Fix security check in ScriptController::canAccessFromCurrentOrigin() when there is no 14 current JS exec state. Instead of returning true unconditionally, we now fall back to 15 using the accessing document's origin for the security check. The new behavior is 16 aligned with Blink: 17 https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/html_frame_element_base.cc?rcl=d3f22423d512b45466f1694020e20da9e0c6ee6a&l=62 18 19 This fix is based on a patch from Sergei Glazunov <glazunov@google.com>. 20 21 Test: http/tests/security/showModalDialog-sync-cross-origin-page-load2.html 22 23 * bindings/js/ScriptController.cpp: 24 (WebCore::ScriptController::canAccessFromCurrentOrigin): 25 * bindings/js/ScriptController.h: 26 * html/HTMLFrameElementBase.cpp: 27 (WebCore::HTMLFrameElementBase::isURLAllowed const): 28 29 LayoutTests: 30 31 Add layout test coverage. 32 33 * http/tests/security/showModalDialog-sync-cross-origin-page-load2-expected.txt: Added. 34 * http/tests/security/showModalDialog-sync-cross-origin-page-load2.html: Added. 35 36 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245538 268f45cc-cd09-0410-ab3c-d52691b4dbfc 37 38 2019-05-20 Chris Dumez <cdumez@apple.com> 39 40 Fix security check in ScriptController::canAccessFromCurrentOrigin() 41 https://bugs.webkit.org/show_bug.cgi?id=196730 42 <rdar://problem/49731231> 43 44 Reviewed by Ryosuke Niwa. 45 46 Add layout test coverage. 47 48 * http/tests/security/showModalDialog-sync-cross-origin-page-load2-expected.txt: Added. 49 * http/tests/security/showModalDialog-sync-cross-origin-page-load2.html: Added. 50 1 51 2019-05-30 Kocsen Chung <kocsen_chung@apple.com> 2 52 -
branches/safari-607-branch/Source/WebCore/ChangeLog
r245924 r245925 1 2019-05-30 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r245538. rdar://problem/50753927 4 5 Fix security check in ScriptController::canAccessFromCurrentOrigin() 6 https://bugs.webkit.org/show_bug.cgi?id=196730 7 <rdar://problem/49731231> 8 9 Reviewed by Ryosuke Niwa. 10 11 Source/WebCore: 12 13 Fix security check in ScriptController::canAccessFromCurrentOrigin() when there is no 14 current JS exec state. Instead of returning true unconditionally, we now fall back to 15 using the accessing document's origin for the security check. The new behavior is 16 aligned with Blink: 17 https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/html_frame_element_base.cc?rcl=d3f22423d512b45466f1694020e20da9e0c6ee6a&l=62 18 19 This fix is based on a patch from Sergei Glazunov <glazunov@google.com>. 20 21 Test: http/tests/security/showModalDialog-sync-cross-origin-page-load2.html 22 23 * bindings/js/ScriptController.cpp: 24 (WebCore::ScriptController::canAccessFromCurrentOrigin): 25 * bindings/js/ScriptController.h: 26 * html/HTMLFrameElementBase.cpp: 27 (WebCore::HTMLFrameElementBase::isURLAllowed const): 28 29 LayoutTests: 30 31 Add layout test coverage. 32 33 * http/tests/security/showModalDialog-sync-cross-origin-page-load2-expected.txt: Added. 34 * http/tests/security/showModalDialog-sync-cross-origin-page-load2.html: Added. 35 36 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245538 268f45cc-cd09-0410-ab3c-d52691b4dbfc 37 38 2019-05-20 Chris Dumez <cdumez@apple.com> 39 40 Fix security check in ScriptController::canAccessFromCurrentOrigin() 41 https://bugs.webkit.org/show_bug.cgi?id=196730 42 <rdar://problem/49731231> 43 44 Reviewed by Ryosuke Niwa. 45 46 Fix security check in ScriptController::canAccessFromCurrentOrigin() when there is no 47 current JS exec state. Instead of returning true unconditionally, we now fall back to 48 using the accessing document's origin for the security check. The new behavior is 49 aligned with Blink: 50 https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/html_frame_element_base.cc?rcl=d3f22423d512b45466f1694020e20da9e0c6ee6a&l=62 51 52 This fix is based on a patch from Sergei Glazunov <glazunov@google.com>. 53 54 Test: http/tests/security/showModalDialog-sync-cross-origin-page-load2.html 55 56 * bindings/js/ScriptController.cpp: 57 (WebCore::ScriptController::canAccessFromCurrentOrigin): 58 * bindings/js/ScriptController.h: 59 * html/HTMLFrameElementBase.cpp: 60 (WebCore::HTMLFrameElementBase::isURLAllowed const): 61 1 62 2019-05-30 Kocsen Chung <kocsen_chung@apple.com> 2 63 -
branches/safari-607-branch/Source/WebCore/bindings/js/ScriptController.cpp
r239569 r245925 379 379 } 380 380 381 bool ScriptController::canAccessFromCurrentOrigin(Frame* frame )381 bool ScriptController::canAccessFromCurrentOrigin(Frame* frame, Document& accessingDocument) 382 382 { 383 383 auto* state = JSExecState::currentState(); 384 384 385 // If the current state is null we're in a call path where the DOM security check doesn't apply (eg. parser). 386 if (!state) 387 return true; 385 // If the current state is null we should use the accessing document for the security check. 386 if (!state) { 387 auto* targetDocument = frame ? frame->document() : nullptr; 388 return targetDocument && accessingDocument.securityOrigin().canAccess(targetDocument->securityOrigin()); 389 } 388 390 389 391 return BindingSecurity::shouldAllowAccessToFrame(state, frame); -
branches/safari-607-branch/Source/WebCore/bindings/js/ScriptController.h
r238771 r245925 120 120 void disableWebAssembly(const String& errorMessage); 121 121 122 static bool canAccessFromCurrentOrigin(Frame* );122 static bool canAccessFromCurrentOrigin(Frame*, Document& accessingDocument); 123 123 WEBCORE_EXPORT bool canExecuteScripts(ReasonForCallingCanExecuteScripts); 124 124 -
branches/safari-607-branch/Source/WebCore/html/HTMLFrameElementBase.cpp
r238771 r245925 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.