Changeset 255522 in webkit
- Timestamp:
- Jan 31, 2020, 3:16:47 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r255519 r255522 1 2020-01-31 Alex Christensen <achristensen@webkit.org> 2 3 Add KVO SPI WKWebView._negotiatedLegacyTLS 4 https://bugs.webkit.org/show_bug.cgi?id=207067 5 6 Reviewed by Andy Estes. 7 8 Covered by API tests. 9 10 * NetworkProcess/NetworkDataTask.cpp: 11 (WebKit::NetworkDataTask::negotiatedLegacyTLS const): 12 * NetworkProcess/NetworkDataTask.h: 13 (WebKit::NetworkDataTaskClient::negotiatedLegacyTLS const): 14 * NetworkProcess/NetworkLoad.cpp: 15 (WebKit::NetworkLoad::negotiatedLegacyTLS const): 16 * NetworkProcess/NetworkLoad.h: 17 * NetworkProcess/cocoa/NetworkSessionCocoa.mm: 18 (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]): 19 * Shared/Authentication/AuthenticationManager.cpp: 20 (WebKit::AuthenticationManager::negotiatedLegacyTLS const): 21 * Shared/Authentication/AuthenticationManager.h: 22 * UIProcess/API/Cocoa/WKWebView.mm: 23 (-[WKWebView _negotiatedLegacyTLS]): 24 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 25 * UIProcess/Cocoa/NavigationState.h: 26 * UIProcess/Cocoa/NavigationState.mm: 27 (WebKit::NavigationState::willChangeNegotiatedLegacyTLS): 28 (WebKit::NavigationState::didChangeNegotiatedLegacyTLS): 29 * UIProcess/Network/NetworkProcessProxy.cpp: 30 (WebKit::NetworkProcessProxy::negotiatedLegacyTLS): 31 * UIProcess/Network/NetworkProcessProxy.h: 32 * UIProcess/Network/NetworkProcessProxy.messages.in: 33 * UIProcess/PageLoadState.cpp: 34 (WebKit::PageLoadState::commitChanges): 35 (WebKit::PageLoadState::hasNegotiatedLegacyTLS const): 36 (WebKit::PageLoadState::negotiatedLegacyTLS): 37 (WebKit::PageLoadState::didCommitLoad): 38 * UIProcess/PageLoadState.h: 39 (WebKit::PageLoadState::Observer::willChangeNegotiatedLegacyTLS): 40 (WebKit::PageLoadState::Observer::didChangeNegotiatedLegacyTLS): 41 (WebKit::PageLoadState::Data::Data): Deleted. 42 * UIProcess/WebPageProxy.cpp: 43 * UIProcess/WebPageProxy.h: 44 1 45 2020-01-31 Chris Dumez <cdumez@apple.com> 2 46 -
trunk/Source/WebKit/NetworkProcess/NetworkDataTask.cpp
r252185 r255522 117 117 } 118 118 119 void NetworkDataTask::negotiatedLegacyTLS() const 120 { 121 if (m_client) 122 m_client->negotiatedLegacyTLS(); 123 } 124 119 125 bool NetworkDataTask::shouldCaptureExtraNetworkLoadMetrics() const 120 126 { -
trunk/Source/WebKit/NetworkProcess/NetworkDataTask.h
r255461 r255522 71 71 virtual void wasBlockedByRestrictions() = 0; 72 72 73 virtual void negotiatedLegacyTLS() const { } 73 74 virtual bool shouldCaptureExtraNetworkLoadMetrics() const { return false; } 74 75 … … 93 94 94 95 void didReceiveResponse(WebCore::ResourceResponse&&, ResponseCompletionHandler&&); 96 void negotiatedLegacyTLS() const; 95 97 bool shouldCaptureExtraNetworkLoadMetrics() const; 96 98 -
trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp
r255461 r255522 207 207 } 208 208 209 void NetworkLoad::negotiatedLegacyTLS() const 210 { 211 m_networkProcess->authenticationManager().negotiatedLegacyTLS(m_parameters.webPageProxyID); 212 } 213 209 214 void NetworkLoad::didReceiveResponse(ResourceResponse&& response, ResponseCompletionHandler&& completionHandler) 210 215 { -
trunk/Source/WebKit/NetworkProcess/NetworkLoad.h
r255461 r255522 82 82 void cannotShowURL() final; 83 83 void wasBlockedByRestrictions() final; 84 void negotiatedLegacyTLS() const final; 84 85 85 86 void notifyDidReceiveResponse(WebCore::ResourceResponse&&, ResponseCompletionHandler&&); -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
r255461 r255522 814 814 if (auto* networkDataTask = [self existingTask:dataTask]) { 815 815 ASSERT(RunLoop::isMain()); 816 817 bool negotiatedLegacyTLS = false; 818 #if HAVE(TLS_PROTOCOL_VERSION_T) 819 NSURLSessionTaskTransactionMetrics *metrics = dataTask._incompleteTaskMetrics.transactionMetrics.lastObject; 820 auto tlsVersion = reinterpret_cast<tls_protocol_version_t>(metrics.negotiatedTLSProtocolVersion.unsignedShortValue); 821 if (tlsVersion == tls_protocol_version_TLSv10 || tlsVersion == tls_protocol_version_TLSv11) 822 negotiatedLegacyTLS = true; 823 UNUSED_PARAM(metrics); 824 #else // We do not need to check _TLSNegotiatedProtocolVersion if we have metrics.negotiatedTLSProtocolVersion because it works at response time even before rdar://problem/56522601 825 ALLOW_DEPRECATED_DECLARATIONS_BEGIN 826 if ([dataTask respondsToSelector:@selector(_TLSNegotiatedProtocolVersion)]) { 827 SSLProtocol tlsVersion = [dataTask _TLSNegotiatedProtocolVersion]; 828 if (tlsVersion == kTLSProtocol11 || tlsVersion == kTLSProtocol1) 829 negotiatedLegacyTLS = true; 830 } 831 ALLOW_DEPRECATED_DECLARATIONS_END 832 #endif 833 if (negotiatedLegacyTLS) 834 networkDataTask->negotiatedLegacyTLS(); 816 835 817 836 // Avoid MIME type sniffing if the response comes back as 304 Not Modified. -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.cpp
r255461 r255522 150 150 } 151 151 152 void AuthenticationManager::negotiatedLegacyTLS(WebPageProxyIdentifier pageID) const 153 { 154 m_process.send(Messages::NetworkProcessProxy::NegotiatedLegacyTLS(pageID)); 155 } 156 152 157 } // namespace WebKit -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.h
r255461 r255522 76 76 void completeAuthenticationChallenge(uint64_t challengeID, AuthenticationChallengeDisposition, WebCore::Credential&&); 77 77 78 void negotiatedLegacyTLS(WebPageProxyIdentifier) const; 79 78 80 private: 79 81 struct Challenge { -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r255132 r255522 1551 1551 } 1552 1552 1553 - (BOOL)_negotiatedLegacyTLS 1554 { 1555 return _page->pageLoadState().hasNegotiatedLegacyTLS(); 1556 } 1557 1553 1558 - (BOOL)_isEditable 1554 1559 { -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
r255220 r255522 165 165 @property (nonatomic, getter=_isEditable, setter=_setEditable:) BOOL _editable WK_API_AVAILABLE(macos(10.11), ios(9.0)); 166 166 167 /*! @abstract A Boolean value indicating whether any resource on the page 168 has been loaded over a connection using TLS 1.0 or TLS 1.1. 169 @discussion @link WKWebView @/link is key-value observing (KVO) compliant 170 for this property. 171 */ 172 @property (nonatomic, readonly) BOOL _negotiatedLegacyTLS WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 173 167 174 // FIXME: Remove these once nobody is using them. 168 175 @property (nonatomic, readonly) NSData *_sessionStateData; -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h
r255461 r255522 171 171 void willChangeHasOnlySecureContent() override; 172 172 void didChangeHasOnlySecureContent() override; 173 void willChangeNegotiatedLegacyTLS() override; 174 void didChangeNegotiatedLegacyTLS() override; 173 175 void willChangeEstimatedProgress() override; 174 176 void didChangeEstimatedProgress() override; -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm
r255461 r255522 1322 1322 } 1323 1323 1324 void NavigationState::willChangeNegotiatedLegacyTLS() 1325 { 1326 [m_webView willChangeValueForKey:@"_negotiatedLegacyTLS"]; 1327 } 1328 1329 void NavigationState::didChangeNegotiatedLegacyTLS() 1330 { 1331 [m_webView didChangeValueForKey:@"_negotiatedLegacyTLS"]; 1332 } 1333 1324 1334 void NavigationState::willChangeEstimatedProgress() 1325 1335 { -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r255461 r255522 370 370 } 371 371 372 void NetworkProcessProxy::negotiatedLegacyTLS(WebPageProxyIdentifier pageID) 373 { 374 WebPageProxy* page = nullptr; 375 if (pageID) 376 page = WebProcessProxy::webPage(pageID); 377 if (page) 378 page->negotiatedLegacyTLS(); 379 } 380 372 381 void NetworkProcessProxy::didFetchWebsiteData(uint64_t callbackID, const WebsiteData& websiteData) 373 382 { -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r255461 r255522 237 237 void didReceiveNetworkProcessProxyMessage(IPC::Connection&, IPC::Decoder&); 238 238 void didReceiveAuthenticationChallenge(PAL::SessionID, WebPageProxyIdentifier, const Optional<WebCore::SecurityOriginData>&, WebCore::AuthenticationChallenge&&, bool, uint64_t challengeID); 239 void negotiatedLegacyTLS(WebPageProxyIdentifier); 239 240 void didFetchWebsiteData(uint64_t callbackID, const WebsiteData&); 240 241 void didDeleteWebsiteData(uint64_t callbackID); -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
r255461 r255522 23 23 messages -> NetworkProcessProxy LegacyReceiver NotRefCounted { 24 24 DidReceiveAuthenticationChallenge(PAL::SessionID sessionID, WebKit::WebPageProxyIdentifier pageID, Optional<WebCore::SecurityOriginData> topOrigin, WebCore::AuthenticationChallenge challenge, bool negotiatedLegacyTLS, uint64_t challengeID) 25 NegotiatedLegacyTLS(WebKit::WebPageProxyIdentifier pageID) 25 26 26 27 DidFetchWebsiteData(uint64_t callbackID, struct WebKit::WebsiteData websiteData) -
trunk/Source/WebKit/UIProcess/PageLoadState.cpp
r247851 r255522 100 100 bool activeURLChanged = activeURL(m_committedState) != activeURL(m_uncommittedState); 101 101 bool hasOnlySecureContentChanged = hasOnlySecureContent(m_committedState) != hasOnlySecureContent(m_uncommittedState); 102 bool negotiatedLegacyTLSChanged = m_committedState.negotiatedLegacyTLS != m_uncommittedState.negotiatedLegacyTLS; 102 103 bool estimatedProgressChanged = estimatedProgress(m_committedState) != estimatedProgress(m_uncommittedState); 103 104 bool networkRequestsInProgressChanged = m_committedState.networkRequestsInProgress != m_uncommittedState.networkRequestsInProgress; … … 116 117 if (hasOnlySecureContentChanged) 117 118 callObserverCallback(&Observer::willChangeHasOnlySecureContent); 119 if (negotiatedLegacyTLSChanged) 120 callObserverCallback(&Observer::willChangeNegotiatedLegacyTLS); 118 121 if (estimatedProgressChanged) 119 122 callObserverCallback(&Observer::willChangeEstimatedProgress); … … 136 139 if (hasOnlySecureContentChanged) 137 140 callObserverCallback(&Observer::didChangeHasOnlySecureContent); 141 if (negotiatedLegacyTLSChanged) 142 callObserverCallback(&Observer::didChangeNegotiatedLegacyTLS); 138 143 if (activeURLChanged) 139 144 callObserverCallback(&Observer::didChangeActiveURL); … … 222 227 } 223 228 229 bool PageLoadState::hasNegotiatedLegacyTLS() const 230 { 231 return m_committedState.negotiatedLegacyTLS; 232 } 233 234 void PageLoadState::negotiatedLegacyTLS(const Transaction::Token& token) 235 { 236 ASSERT_UNUSED(token, &token.m_pageLoadState == this); 237 m_uncommittedState.negotiatedLegacyTLS = true; 238 } 239 224 240 double PageLoadState::estimatedProgress(const Data& data) 225 241 { … … 313 329 m_uncommittedState.url = m_uncommittedState.provisionalURL; 314 330 m_uncommittedState.provisionalURL = String(); 331 m_uncommittedState.negotiatedLegacyTLS = false; 315 332 316 333 m_uncommittedState.title = String(); -
trunk/Source/WebKit/UIProcess/PageLoadState.h
r254087 r255522 63 63 virtual void didChangeHasOnlySecureContent() = 0; 64 64 65 virtual void willChangeNegotiatedLegacyTLS() { }; 66 virtual void didChangeNegotiatedLegacyTLS() { }; 67 65 68 virtual void willChangeEstimatedProgress() = 0; 66 69 virtual void didChangeEstimatedProgress() = 0; … … 141 144 142 145 bool hasOnlySecureContent() const; 146 bool hasNegotiatedLegacyTLS() const; 147 void negotiatedLegacyTLS(const Transaction::Token&); 143 148 144 149 double estimatedProgress() const; … … 201 206 202 207 struct Data { 203 Data() 204 : state(State::Finished) 205 , hasInsecureContent(false) 206 , canGoBack(false) 207 , canGoForward(false) 208 , estimatedProgress(0) 209 , networkRequestsInProgress(false) 210 { 211 } 212 213 State state; 214 bool hasInsecureContent; 208 State state { State::Finished }; 209 bool hasInsecureContent { false }; 210 bool negotiatedLegacyTLS { false }; 215 211 216 212 PendingAPIRequest pendingAPIRequest; … … 225 221 URL resourceDirectoryURL; 226 222 227 bool canGoBack ;228 bool canGoForward ;229 230 double estimatedProgress ;231 bool networkRequestsInProgress ;223 bool canGoBack { false }; 224 bool canGoForward { false }; 225 226 double estimatedProgress { 0 }; 227 bool networkRequestsInProgress { false }; 232 228 233 229 RefPtr<WebCertificateInfo> certificateInfo; -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r255519 r255522 7714 7714 } 7715 7715 7716 void WebPageProxy::negotiatedLegacyTLS() 7717 { 7718 auto transaction = m_pageLoadState.transaction(); 7719 m_pageLoadState.negotiatedLegacyTLS(transaction); 7720 } 7721 7716 7722 void WebPageProxy::exceededDatabaseQuota(FrameIdentifier frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply&& reply) 7717 7723 { -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r255461 r255522 1336 1336 1337 1337 void didReceiveAuthenticationChallengeProxy(Ref<AuthenticationChallengeProxy>&&, NegotiatedLegacyTLS); 1338 void negotiatedLegacyTLS(); 1338 1339 1339 1340 SpellDocumentTag spellDocumentTag(); -
trunk/Tools/ChangeLog
r255513 r255522 1 2020-01-31 Alex Christensen <achristensen@webkit.org> 2 3 Add KVO SPI WKWebView._negotiatedLegacyTLS 4 https://bugs.webkit.org/show_bug.cgi?id=207067 5 6 Reviewed by Andy Estes. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm: 9 (-[TLSObserver observeValueForKeyPath:ofObject:change:context:]): 10 (-[TLSObserver waitUntilNegotiatedLegacyTLSChanged]): 11 (TestWebKitAPI::TEST): 12 * TestWebKitAPI/config.h: 13 1 14 2020-01-31 Aakash Jain <aakash_jain@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm
r255461 r255522 44 44 #endif 45 45 46 #if HAVE(TLS_PROTOCOL_VERSION_T) 47 @interface TLSObserver : NSObject 48 - (void)waitUntilNegotiatedLegacyTLSChanged; 49 @end 50 51 @implementation TLSObserver { 52 bool _negotiatedLegacyTLSChanged; 53 } 54 55 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context 56 { 57 EXPECT_WK_STREQ(keyPath, "_negotiatedLegacyTLS"); 58 _negotiatedLegacyTLSChanged = true; 59 } 60 61 - (void)waitUntilNegotiatedLegacyTLSChanged 62 { 63 _negotiatedLegacyTLSChanged = false; 64 while (!_negotiatedLegacyTLSChanged) 65 TestWebKitAPI::Util::spinRunLoop(); 66 } 67 68 @end 69 #endif 70 46 71 @interface TLSNavigationDelegate : NSObject <WKNavigationDelegate> 47 72 - (void)waitForDidFinishNavigation; … … 203 228 } 204 229 230 #if HAVE(TLS_PROTOCOL_VERSION_T) 231 TEST(TLSVersion, NegotiatedLegacyTLS) 232 { 233 TCPServer server(TCPServer::Protocol::HTTPS, [] (SSL *ssl) { 234 TCPServer::respondWithOK(ssl); 235 TCPServer::respondWithOK(ssl); 236 }, tls1_1); 237 238 auto delegate = adoptNS([TestNavigationDelegate new]); 239 auto webView = adoptNS([WKWebView new]); 240 [webView setNavigationDelegate:delegate.get()]; 241 [delegate setDidReceiveAuthenticationChallenge:^(WKWebView *, NSURLAuthenticationChallenge *challenge, void (^callback)(NSURLSessionAuthChallengeDisposition, NSURLCredential *)) { 242 EXPECT_WK_STREQ(challenge.protectionSpace.authenticationMethod, NSURLAuthenticationMethodServerTrust); 243 callback(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); 244 }]; 245 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]; 246 [webView loadRequest:request]; 247 248 auto observer = adoptNS([TLSObserver new]); 249 [webView addObserver:observer.get() forKeyPath:@"_negotiatedLegacyTLS" options:NSKeyValueObservingOptionNew context:nil]; 250 251 EXPECT_FALSE([webView _negotiatedLegacyTLS]); 252 [observer waitUntilNegotiatedLegacyTLSChanged]; 253 EXPECT_TRUE([webView _negotiatedLegacyTLS]); 254 255 [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; 256 [observer waitUntilNegotiatedLegacyTLSChanged]; 257 EXPECT_FALSE([webView _negotiatedLegacyTLS]); 258 259 [webView loadRequest:request]; 260 [observer waitUntilNegotiatedLegacyTLSChanged]; 261 EXPECT_TRUE([webView _negotiatedLegacyTLS]); 262 263 [webView removeObserver:observer.get() forKeyPath:@"_negotiatedLegacyTLS"]; 264 } 265 #endif 266 205 267 // FIXME: Add some tests for WKWebView.hasOnlySecureContent 206 268 -
trunk/Tools/TestWebKitAPI/config.h
r252476 r255522 123 123 #define HAVE_NETWORK_FRAMEWORK 1 124 124 #endif 125 126 #if PLATFORM(COCOA) && !(PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500) 127 #define HAVE_TLS_PROTOCOL_VERSION_T 1 128 #endif
Note:
See TracChangeset
for help on using the changeset viewer.