Changeset 238562 in webkit
- Timestamp:
- Nov 27, 2018, 11:38:18 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 16 edited
- 1 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/platform/mac-wk1/webarchive (added)
-
LayoutTests/platform/mac-wk1/webarchive/loading (added)
-
LayoutTests/platform/mac-wk1/webarchive/loading/test-loading-archive-subresource-expected.txt (added)
-
LayoutTests/platform/mac/fast/loader/webarchive-encoding-respected.html (modified) (1 diff)
-
LayoutTests/webarchive/loading/cache-expired-subresource.html (modified) (1 diff)
-
LayoutTests/webarchive/loading/mainresource-null-mimetype-crash.html (modified) (1 diff)
-
LayoutTests/webarchive/loading/missing-data.html (modified) (1 diff)
-
LayoutTests/webarchive/loading/resources/top.webarchive (added)
-
LayoutTests/webarchive/loading/test-loading-archive-subresource-expected.txt (added)
-
LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype.html (modified) (1 diff)
-
LayoutTests/webarchive/loading/test-loading-archive-subresource.html (copied) (copied from trunk/LayoutTests/webarchive/loading/test-loading-archive.html ) (1 diff)
-
LayoutTests/webarchive/loading/test-loading-archive.html (modified) (1 diff)
-
LayoutTests/webarchive/loading/test-loading-top-archive-expected.txt (added)
-
LayoutTests/webarchive/loading/test-loading-top-archive.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Document.h (modified) (2 diffs)
-
Source/WebCore/loader/DocumentLoader.cpp (modified) (3 diffs)
-
Source/WebCore/loader/DocumentLoader.h (modified) (1 diff)
-
Source/WebCore/testing/Internals.cpp (modified) (1 diff)
-
Source/WebCore/testing/Internals.h (modified) (1 diff)
-
Source/WebCore/testing/Internals.idl (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r238555 r238562 1 2018-11-16 Jiewen Tan <jiewen_tan@apple.com> 2 3 Disallow loading webarchives as iframes 4 https://bugs.webkit.org/show_bug.cgi?id=191728 5 <rdar://problem/45524528> 6 7 Reviewed by Youenn Fablet. 8 9 * platform/mac-wk1/webarchive/loading/test-loading-archive-subresource-expected.txt: Added. 10 * platform/mac/fast/loader/webarchive-encoding-respected.html: 11 * webarchive/loading/cache-expired-subresource.html: 12 * webarchive/loading/mainresource-null-mimetype-crash.html: 13 * webarchive/loading/missing-data.html: 14 * webarchive/loading/resources/test-loading-archive-main.webarchive: Copied from LayoutTests/webarchive/loading/test-loading-archive.html. 15 * webarchive/loading/test-loading-archive-subresource-expected.txt: Added. 16 * webarchive/loading/test-loading-archive-subresource-null-mimetype.html: 17 * webarchive/loading/test-loading-archive-subresource.html: Copied from LayoutTests/webarchive/loading/test-loading-archive.html. 18 * webarchive/loading/test-loading-archive.html: 19 * webarchive/loading/test-loading-top-archive-expected.txt: Added. 20 * webarchive/loading/test-loading-top-archive.html: Added. 21 1 22 2018-11-27 Per Arne Vollan <pvollan@apple.com> 2 23 -
trunk/LayoutTests/platform/mac/fast/loader/webarchive-encoding-respected.html
r122687 r238562 4 4 testRunner.dumpChildFramesAsText(); 5 5 } 6 if (window.internals) 7 internals.setAlwaysAllowLocalWebarchive(); 6 8 </script> 7 9 The webarchive in this iframe is utf-8 encoded and will only display properly if the webarchive's encoding is respected.<br> -
trunk/LayoutTests/webarchive/loading/cache-expired-subresource.html
r120521 r238562 5 5 testRunner.waitUntilDone(); 6 6 } 7 if (window.internals) 8 internals.setAlwaysAllowLocalWebarchive(); 7 9 8 10 function frameLoaded() { -
trunk/LayoutTests/webarchive/loading/mainresource-null-mimetype-crash.html
r217680 r238562 5 5 testRunner.waitUntilDone(); 6 6 } 7 if (window.internals) 8 internals.setAlwaysAllowLocalWebarchive(); 7 9 onload = function() { 8 10 frame = document.createElement("iframe"); -
trunk/LayoutTests/webarchive/loading/missing-data.html
r217680 r238562 4 4 testRunner.dumpAsText(); 5 5 } 6 6 if (window.internals) 7 internals.setAlwaysAllowLocalWebarchive(); 7 8 onload = function() { 8 9 frame = document.createElement("iframe"); -
trunk/LayoutTests/webarchive/loading/test-loading-archive-subresource-null-mimetype.html
r120521 r238562 6 6 testRunner.waitUntilDone(); 7 7 } 8 8 if (window.internals) 9 internals.setAlwaysAllowLocalWebarchive(); 9 10 function frameLoaded() { 10 11 if (window.testRunner) -
trunk/LayoutTests/webarchive/loading/test-loading-archive-subresource.html
r238561 r238562 2 2 <script> 3 3 if (window.testRunner) { 4 testRunner.dumpResourceLoadCallbacks();5 4 testRunner.dumpAsText(); 6 5 testRunner.waitUntilDone(); 7 6 } 8 7 9 8 function frameLoaded() { 10 9 if (window.testRunner) 11 10 testRunner.notifyDone(); 12 11 } 12 setTimeout(frameLoaded, 10); 13 13 </script> 14 14 <body> 15 15 <iframe onload="frameLoaded();" src="resources/helloworld.webarchive"></iframe> 16 This test s that doing a "normal load" of a webarchive (not using loadArchive) does not cause a cancelled error to be called.16 This test assumes the webarchive is not loaded. 17 17 </body> 18 18 </html> -
trunk/LayoutTests/webarchive/loading/test-loading-archive.html
r120521 r238562 6 6 testRunner.waitUntilDone(); 7 7 } 8 8 if (window.internals) 9 internals.setAlwaysAllowLocalWebarchive(); 9 10 function frameLoaded() { 10 11 if (window.testRunner) -
trunk/Source/WebCore/ChangeLog
r238561 r238562 1 2018-11-16 Jiewen Tan <jiewen_tan@apple.com> 2 3 Disallow loading webarchives as iframes 4 https://bugs.webkit.org/show_bug.cgi?id=191728 5 <rdar://problem/45524528> 6 7 Reviewed by Youenn Fablet. 8 9 Disallow loading webarchives as iframes. We don't allow loading remote webarchives. 10 Now, this policy is hardened to disallow loading webarchives as iframes for local 11 documents as well. 12 13 To allow old tests still be able to run, a flag is added to always allow loading local 14 webarchives in document. The flag can be set via window.internals. 15 16 Tests: webarchive/loading/test-loading-archive-subresource.html 17 webarchive/loading/test-loading-top-archive.html 18 19 * dom/Document.h: 20 (WebCore::Document::setAlwaysAllowLocalWebarchive): 21 (WebCore::Document::alwaysAllowLocalWebarchive): 22 * loader/DocumentLoader.cpp: 23 (WebCore::disallowWebArchive): 24 (WebCore::DocumentLoader::continueAfterContentPolicy): 25 (WebCore::isRemoteWebArchive): Deleted. 26 * testing/Internals.cpp: 27 (WebCore::Internals::setAlwaysAllowLocalWebarchive const): 28 * testing/Internals.h: 29 * testing/Internals.idl: 30 1 31 2018-11-27 Jer Noble <jer.noble@apple.com> 2 32 -
trunk/Source/WebCore/dom/Document.h
r238001 r238562 1531 1531 void frameWasDisconnectedFromOwner(); 1532 1532 1533 // Used in webarchive loading tests. 1534 void setAlwaysAllowLocalWebarchive() { m_alwaysAllowLocalWebarchive = true; } 1535 bool alwaysAllowLocalWebarchive() const { return m_alwaysAllowLocalWebarchive; } 1536 1533 1537 protected: 1534 1538 enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 }; … … 2070 2074 2071 2075 bool m_isRunningUserScripts { false }; 2076 2077 bool m_alwaysAllowLocalWebarchive { false }; 2072 2078 }; 2073 2079 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r237266 r238562 842 842 } 843 843 844 static bool isRemoteWebArchive(const DocumentLoader& documentLoader) 844 // Prevent web archives from loading if it is remote or it is not the main frame because they 845 // can claim to be from any domain and thus avoid cross-domain security checks (4120255, 45524528). 846 bool DocumentLoader::disallowWebArchive() const 845 847 { 846 848 using MIMETypeHashSet = HashSet<String, ASCIICaseInsensitiveHash>; … … 856 858 }; 857 859 858 const ResourceResponse& response = documentLoader.response(); 859 String mimeType = response.mimeType(); 860 String mimeType = m_response.mimeType(); 860 861 if (mimeType.isNull() || !webArchiveMIMETypes.get().contains(mimeType)) 861 862 return false; 862 863 863 864 #if USE(QUICK_LOOK) 864 if (isQuickLookPreviewURL( response.url()))865 if (isQuickLookPreviewURL(m_response.url())) 865 866 return false; 866 867 #endif 867 868 868 return !documentLoader.substituteData().isValid() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(documentLoader.request().url().protocol().toStringWithoutCopying()); 869 if (m_substituteData.isValid()) 870 return false; 871 872 if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(m_request.url().protocol().toStringWithoutCopying())) 873 return true; 874 875 if (!frame() || frame()->isMainFrame()) 876 return false; 877 878 // On purpose of maintaining existing tests. 879 if (!frame()->document() || frame()->document()->topDocument().alwaysAllowLocalWebarchive()) 880 return false; 881 return true; 869 882 } 870 883 … … 878 891 switch (policy) { 879 892 case PolicyAction::Use: { 880 // Prevent remote web archives from loading because they can claim to be from any domain and thus avoid cross-domain security checks (4120255). 881 if (!frameLoader()->client().canShowMIMEType(m_response.mimeType()) || isRemoteWebArchive(*this)) { 893 if (!frameLoader()->client().canShowMIMEType(m_response.mimeType()) || disallowWebArchive()) { 882 894 frameLoader()->policyChecker().cannotShowMIMEType(m_response); 883 895 // Check reachedTerminalState since the load may have already been canceled inside of _handleUnimplementablePolicyWithErrorCode::. -
trunk/Source/WebCore/loader/DocumentLoader.h
r237266 r238562 415 415 WEBCORE_EXPORT void enqueueSecurityPolicyViolationEvent(SecurityPolicyViolationEvent::Init&&) final; 416 416 417 bool disallowWebArchive() const; 418 417 419 Ref<CachedResourceLoader> m_cachedResourceLoader; 418 420 -
trunk/Source/WebCore/testing/Internals.cpp
r238378 r238562 4825 4825 } 4826 4826 4827 void Internals::setAlwaysAllowLocalWebarchive() const 4828 { 4829 auto* document = contextDocument(); 4830 if (!document) 4831 return; 4832 document->setAlwaysAllowLocalWebarchive(); 4833 } 4834 4827 4835 } // namespace WebCore -
trunk/Source/WebCore/testing/Internals.h
r238345 r238562 786 786 Vector<CookieData> getCookies() const; 787 787 788 void setAlwaysAllowLocalWebarchive() const; 789 788 790 private: 789 791 explicit Internals(Document&); -
trunk/Source/WebCore/testing/Internals.idl
r238345 r238562 724 724 725 725 sequence<CookieData> getCookies(); 726 }; 726 727 void setAlwaysAllowLocalWebarchive(); 728 }; -
trunk/Source/WebKit/ChangeLog
r238553 r238562 1 2018-11-16 Jiewen Tan <jiewen_tan@apple.com> 2 3 Disallow loading webarchives as iframes 4 https://bugs.webkit.org/show_bug.cgi?id=191728 5 <rdar://problem/45524528> 6 7 Reviewed by Youenn Fablet. 8 9 * UIProcess/WebPageProxy.cpp: 10 (WebKit::WebPageProxy::unableToImplementPolicy): 11 Add a check to prevent null pointer dereference. 12 1 13 2018-11-27 Wenson Hsieh <wenson_hsieh@apple.com> 2 14 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r238538 r238562 4415 4415 MESSAGE_CHECK(frame); 4416 4416 4417 if (!m_policyClient) 4418 return; 4417 4419 m_policyClient->unableToImplementPolicy(*this, *frame, error, m_process->transformHandlesToObjects(userData.object()).get()); 4418 4420 }
Note:
See TracChangeset
for help on using the changeset viewer.