Changeset 249096 in webkit
- Timestamp:
- Aug 26, 2019, 8:00:05 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 37 edited
- 2 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/ssl/certificate-validation.html (modified) (1 diff)
-
LayoutTests/http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight-expected.txt (modified) (1 diff)
-
LayoutTests/http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight.html (modified) (2 diffs)
-
LayoutTests/http/wpt/beacon/resources/beacon-preflight.py (modified) (1 diff)
-
LayoutTests/http/wpt/service-workers/resources/lengthy-pass.py (modified) (1 diff)
-
LayoutTests/http/wpt/service-workers/server-trust-evaluation.https-expected.txt (added)
-
LayoutTests/http/wpt/service-workers/server-trust-evaluation.https.html (added)
-
LayoutTests/http/wpt/service-workers/server-trust-worker.js (added)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/websocket-in-service-worker.https-expected.txt (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkDataTask.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkDataTask.h (modified) (2 diffs)
-
Source/WebKit/NetworkProcess/NetworkLoad.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkLoadChecker.h (modified) (1 diff)
-
Source/WebKit/NetworkProcess/PingLoad.cpp (modified) (1 diff)
-
Source/WebKit/Shared/Authentication/AuthenticationManager.cpp (modified) (2 diffs)
-
Source/WebKit/Shared/Authentication/AuthenticationManager.h (modified) (1 diff)
-
Source/WebKit/Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.h (copied) (copied from trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h ) (2 diffs)
-
Source/WebKit/Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.mm (copied) (copied from trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreClient.h ) (2 diffs)
-
Source/WebKit/SourcesCocoa.txt (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (modified) (4 diffs)
-
Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h (modified) (1 diff)
-
Source/WebKit/UIProcess/Cocoa/NavigationState.mm (modified) (3 diffs)
-
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (modified) (1 diff)
-
Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in (modified) (1 diff)
-
Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebProcessPool.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebProcessPool.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreClient.h (modified) (2 diffs)
-
Source/WebKit/WebKit.xcodeproj/project.pbxproj (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/WebKitTestRunner/TestController.cpp (modified) (3 diffs)
-
Tools/WebKitTestRunner/TestController.h (modified) (1 diff)
-
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (modified) (2 diffs)
-
Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h (modified) (1 diff)
-
Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249090 r249096 1 2019-08-26 Youenn Fablet <youenn@apple.com> 2 3 Add a WebsiteDataStore delegate to handle AuthenticationChallenge that do not come from pages 4 https://bugs.webkit.org/show_bug.cgi?id=196870 5 6 Reviewed by Alex Christensen. 7 8 Add tests to validate that the delegate decision is respected for beacons and service worker loads. 9 10 * http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight-expected.txt: 11 * http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight.html: 12 * http/wpt/beacon/resources/beacon-preflight.py: 13 (main): 14 * http/wpt/service-workers/resources/lengthy-pass.py: 15 (main): 16 * http/wpt/service-workers/server-trust-evaluation.https-expected.txt: Added. 17 * http/wpt/service-workers/server-trust-evaluation.https.html: Added. 18 * http/wpt/service-workers/server-trust-worker.js: Added. 19 * http/tests/ssl/certificate-validation.html: Remove unneeded setting call 20 since we deny server trust requests if SSL certificates are not all allowed. 21 1 22 2019-08-24 Simon Fraser <simon.fraser@apple.com> 2 23 -
trunk/LayoutTests/http/tests/ssl/certificate-validation.html
r240689 r249096 25 25 return; 26 26 27 window.testRunner.setAllowsAnySSLCertificate(false);28 27 // This should trigger network process server trust evaluation. 29 28 window.testRunner.setCanHandleHTTPSServerTrustEvaluation(false); -
trunk/LayoutTests/http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight-expected.txt
r249063 r249096 1 1 2 PASS Beacon load should not be sent if server is not trusted. 2 3 PASS Should send beacon with no CORS preflight 3 4 -
trunk/LayoutTests/http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight.html
r249063 r249096 27 27 } 28 28 29 function testCORSPreflightSuccess(what) { 30 var testBase = get_host_info().HTTP_REMOTE_ORIGIN + RESOURCES_DIR; 31 var id = self.token(); 32 var testUrl = testBase + "beacon-preflight.py?allowCors=1&cmd=put&id=" + id; 29 function testCORSPreflight(what) { 30 var testBase = get_host_info().HTTPS_REMOTE_ORIGIN + RESOURCES_DIR; 33 31 34 promise_test(function(test) { 32 promise_test(async function(test) { 33 var id = "ca33c073-1cf0-41e5-bbd4-55969fb1a6c7"; 34 var testUrl = testBase + "beacon-preflight.py?allowCors=1&cmd=put&id=" + id; 35 if (window.testRunner) { 36 window.testRunner.setAllowsAnySSLCertificate(false); 37 window.testRunner.terminateNetworkProcess(); 38 await fetch("").then(() => { }, () => { }); 39 } 40 41 assert_true(navigator.sendBeacon(testUrl, what), "sendBeacon succeeded"); 42 const result = await pollResult(test, id); 43 assert_equals(result['preflight'], 0, "Did not receive CORS preflight") 44 assert_equals(result['beacon'], 0, "Did not receive beacon") 45 }, "Beacon load should not be sent if server is not trusted."); 46 47 promise_test(async function(test) { 48 var id = self.token(); 49 var testUrl = testBase + "beacon-preflight.py?allowCors=1&cmd=put&id=" + id; 50 if (window.testRunner) { 51 window.testRunner.setAllowsAnySSLCertificate(true); 52 window.testRunner.terminateNetworkProcess(); 53 await fetch("").then(() => { }, () => { }); 54 } 55 35 56 assert_true(navigator.sendBeacon(testUrl, what), "SendBeacon Succeeded"); 36 57 return pollResult(test, id) .then(result => { … … 52 73 } 53 74 54 testCORSPreflight Success(stringToArrayBufferView("123"));75 testCORSPreflight(stringToArrayBufferView("123")); 55 76 </script> 56 77 </body> -
trunk/LayoutTests/http/wpt/beacon/resources/beacon-preflight.py
r249063 r249096 45 45 request.server.stash.put(test_id, stashed_data) 46 46 return [("Content-Type", "text/plain")], "" 47 47 48 48 if command == "get": 49 if stashed_data is not None: 50 return [("Content-Type", "text/plain")], json.dumps(stashed_data) 51 return [("Content-Type", "text/plain")], "" 49 return [("Content-Type", "text/plain")], json.dumps(stashed_data) 52 50 53 51 response.set_error(400, "Bad Command") -
trunk/LayoutTests/http/wpt/service-workers/resources/lengthy-pass.py
r249063 r249096 4 4 delay = 0.05 5 5 response.headers.set("Content-type", "text/javascript") 6 response.headers.append("Access-Control-Allow-Origin", "*") 6 7 response.write_status_headers() 7 8 time.sleep(delay); -
trunk/LayoutTests/imported/w3c/ChangeLog
r249079 r249096 1 2019-08-26 Youenn Fablet <youenn@apple.com> 2 3 Add a WebsiteDataStore delegate to handle AuthenticationChallenge that do not come from pages 4 https://bugs.webkit.org/show_bug.cgi?id=196870 5 <rdar://problem/54593556> 6 7 Reviewed by Alex Christensen. 8 9 * web-platform-tests/service-workers/service-worker/websocket-in-service-worker.https-expected.txt: 10 1 11 2019-08-22 Ryosuke Niwa <rniwa@webkit.org> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/websocket-in-service-worker.https-expected.txt
r225644 r249096 1 1 2 FAIL Verify WebSockets can be created in a Service Worker assert_equals: expected "PASS" but got "FAIL: Got an error event" 2 PASS Verify WebSockets can be created in a Service Worker 3 3 -
trunk/Source/WebKit/ChangeLog
r249093 r249096 1 2019-08-26 Youenn Fablet <youenn@apple.com> 2 3 Add a WebsiteDataStore delegate to handle AuthenticationChallenge that do not come from pages 4 https://bugs.webkit.org/show_bug.cgi?id=196870 5 6 Reviewed by Alex Christensen. 7 8 Make NetworkProcess provide the session ID for any authentication challenge. 9 In case there is no associated page for the authentication challenge or this is related to a service worker, 10 ask the website data store to take a decision. 11 Add website data store delegate to allow applications to make the decision. 12 Restrict using the delegate to server trust evaluation only. 13 14 Make ping loads reuse the same mechanism. 15 16 Covered by service worker tests and updated beacon test. 17 18 * NetworkProcess/NetworkCORSPreflightChecker.cpp: 19 (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge): 20 * NetworkProcess/NetworkDataTask.cpp: 21 (WebKit::NetworkDataTask::sessionID const): 22 * NetworkProcess/NetworkDataTask.h: 23 * NetworkProcess/NetworkLoad.cpp: 24 (WebKit::NetworkLoad::didReceiveChallenge): 25 * NetworkProcess/NetworkLoadChecker.h: 26 (WebKit::NetworkLoadChecker::networkProcess): 27 * NetworkProcess/PingLoad.cpp: 28 (WebKit::PingLoad::didReceiveChallenge): 29 * Shared/Authentication/AuthenticationManager.cpp: 30 (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge): 31 * Shared/Authentication/AuthenticationManager.h: 32 * Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.h: Copied from Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h. 33 * Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.mm: Copied from Source/WebKit/Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h. 34 (WebKit::toAuthenticationChallengeDisposition): 35 * SourcesCocoa.txt: 36 * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: 37 (WebsiteDataStoreClient::WebsiteDataStoreClient): 38 * UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h: 39 * UIProcess/Cocoa/NavigationState.mm: 40 (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): 41 * UIProcess/Network/NetworkProcessProxy.cpp: 42 (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge): 43 * UIProcess/Network/NetworkProcessProxy.h: 44 * UIProcess/Network/NetworkProcessProxy.messages.in: 45 * UIProcess/ServiceWorkerProcessProxy.cpp: 46 * UIProcess/ServiceWorkerProcessProxy.h: 47 * UIProcess/WebPageProxy.cpp: 48 * UIProcess/WebProcessPool.cpp: 49 (WebKit::WebProcessPool::isServiceWorkerPageID const): 50 * UIProcess/WebProcessPool.h: 51 * UIProcess/WebsiteData/WebsiteDataStoreClient.h: 52 (WebKit::WebsiteDataStoreClient::didReceiveAuthenticationChallenge): 53 * WebKit.xcodeproj/project.pbxproj: 54 1 55 2019-08-25 Simon Fraser <simon.fraser@apple.com> 2 56 -
trunk/Source/WebKit/NetworkProcess/NetworkCORSPreflightChecker.cpp
r249063 r249096 102 102 } 103 103 104 m_networkProcess->authenticationManager().didReceiveAuthenticationChallenge(m_parameters. pageID, m_parameters.frameID, challenge, WTFMove(completionHandler));104 m_networkProcess->authenticationManager().didReceiveAuthenticationChallenge(m_parameters.sessionID, m_parameters.pageID, m_parameters.frameID, challenge, WTFMove(completionHandler)); 105 105 } 106 106 -
trunk/Source/WebKit/NetworkProcess/NetworkDataTask.cpp
r249063 r249096 151 151 } 152 152 153 PAL::SessionID NetworkDataTask::sessionID() const 154 { 155 return m_session->sessionID(); 156 } 157 153 158 } // namespace WebKit -
trunk/Source/WebKit/NetworkProcess/NetworkDataTask.h
r249063 r249096 35 35 #include <WebCore/StoredCredentialsPolicy.h> 36 36 #include <WebCore/Timer.h> 37 #include <pal/SessionID.h> 37 38 #include <wtf/CompletionHandler.h> 38 39 #include <wtf/ThreadSafeRefCounted.h> … … 131 132 virtual String description() const; 132 133 134 PAL::SessionID sessionID() const; 135 133 136 protected: 134 137 NetworkDataTask(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::StoredCredentialsPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect, bool dataTaskIsForMainFrameNavigation); -
trunk/Source/WebKit/NetworkProcess/NetworkLoad.cpp
r249063 r249096 202 202 m_networkProcess->authenticationManager().didReceiveAuthenticationChallenge(*pendingDownload, challenge, WTFMove(completionHandler)); 203 203 else 204 m_networkProcess->authenticationManager().didReceiveAuthenticationChallenge(m_ parameters.webPageID, m_parameters.webFrameID, challenge, WTFMove(completionHandler));204 m_networkProcess->authenticationManager().didReceiveAuthenticationChallenge(m_task->sessionID(), m_parameters.webPageID, m_parameters.webFrameID, challenge, WTFMove(completionHandler)); 205 205 } 206 206 -
trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.h
r249063 r249096 85 85 #endif 86 86 87 NetworkProcess& networkProcess() { return m_networkProcess; } 88 87 89 const URL& url() const { return m_url; } 88 90 WebCore::StoredCredentialsPolicy storedCredentialsPolicy() const { return m_storedCredentialsPolicy; } -
trunk/Source/WebKit/NetworkProcess/PingLoad.cpp
r249063 r249096 149 149 RELEASE_LOG_IF_ALLOWED("didReceiveChallenge"); 150 150 if (challenge.protectionSpace().authenticationScheme() == ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested) { 151 completionHandler(AuthenticationChallengeDisposition::PerformDefaultHandling, { });151 m_networkLoadChecker->networkProcess().authenticationManager().didReceiveAuthenticationChallenge(m_parameters.sessionID, m_parameters.webPageID, m_parameters.webFrameID, challenge, WTFMove(completionHandler)); 152 152 return; 153 153 } -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.cpp
r249063 r249096 109 109 } 110 110 111 void AuthenticationManager::didReceiveAuthenticationChallenge(P ageIdentifier pageID, FrameIdentifier frameID, const AuthenticationChallenge& authenticationChallenge, ChallengeCompletionHandler&& completionHandler)111 void AuthenticationManager::didReceiveAuthenticationChallenge(PAL::SessionID sessionID, PageIdentifier pageID, FrameIdentifier frameID, const AuthenticationChallenge& authenticationChallenge, ChallengeCompletionHandler&& completionHandler) 112 112 { 113 113 ASSERT(pageID); … … 120 120 return; 121 121 122 m_process.send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge( pageID, frameID, authenticationChallenge, challengeID));122 m_process.send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(sessionID, pageID, frameID, authenticationChallenge, challengeID)); 123 123 } 124 124 -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.h
r249063 r249096 64 64 static const char* supplementName(); 65 65 66 void didReceiveAuthenticationChallenge( WebCore::PageIdentifier, WebCore::FrameIdentifier, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&);66 void didReceiveAuthenticationChallenge(PAL::SessionID, WebCore::PageIdentifier, WebCore::FrameIdentifier, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&); 67 67 void didReceiveAuthenticationChallenge(IPC::MessageSender& download, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&); 68 68 -
trunk/Source/WebKit/Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.h
r249095 r249096 1 /*1 /* 2 2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * … … 26 26 #pragma once 27 27 28 #include <WebKit/_WKWebsiteDataStoreDelegate.h> 28 #import "AuthenticationChallengeDisposition.h" 29 #import <Foundation/NSURLSession.h> 29 30 30 @interface TestWebsiteDataStoreDelegate: NSObject <_WKWebsiteDataStoreDelegate> { 31 @private 32 BOOL _shouldAllowRaisingQuota; 33 } 34 - (instancetype)init; 35 - (void)setAllowRaisingQuota:(BOOL)shouldAllowRaisingQuota; 36 @end 31 namespace WebKit { 32 33 AuthenticationChallengeDisposition toAuthenticationChallengeDisposition(NSURLSessionAuthChallengeDisposition); 34 35 } // namespace WebKit -
trunk/Source/WebKit/Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.mm
r249095 r249096 1 1 /* 2 * Copyright (C) 201 9 Apple Inc. All rights reserved.2 * Copyright (C) 2018-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 27 28 #include <wtf/CompletionHandler.h> 29 30 namespace WebCore { 31 struct SecurityOriginData; 32 } 26 #include "config.h" 27 #include "AuthenticationChallengeDispositionCocoa.h" 33 28 34 29 namespace WebKit { 35 30 36 class WebsiteDataStoreClient { 37 WTF_MAKE_FAST_ALLOCATED; 38 public: 39 virtual ~WebsiteDataStoreClient() { } 40 41 virtual void requestStorageSpace(const WebCore::SecurityOriginData& topOrigin, const WebCore::SecurityOriginData& frameOrigin, uint64_t quota, uint64_t currentSize, uint64_t spaceRequired, CompletionHandler<void(Optional<uint64_t>)>&& completionHandler) 42 { 43 completionHandler({ }); 31 AuthenticationChallengeDisposition toAuthenticationChallengeDisposition(NSURLSessionAuthChallengeDisposition disposition) 32 { 33 switch (disposition) { 34 case NSURLSessionAuthChallengeUseCredential: 35 return AuthenticationChallengeDisposition::UseCredential; 36 case NSURLSessionAuthChallengePerformDefaultHandling: 37 return AuthenticationChallengeDisposition::PerformDefaultHandling; 38 case NSURLSessionAuthChallengeCancelAuthenticationChallenge: 39 return AuthenticationChallengeDisposition::Cancel; 40 case NSURLSessionAuthChallengeRejectProtectionSpace: 41 return AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue; 44 42 } 45 }; 43 [NSException raise:NSInvalidArgumentException format:@"Invalid NSURLSessionAuthChallengeDisposition (%ld)", (long)disposition]; 44 } 46 45 47 46 } // namespace WebKit -
trunk/Source/WebKit/SourcesCocoa.txt
r249063 r249096 134 134 Shared/cg/ShareableBitmapCG.cpp 135 135 136 Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.mm 136 137 Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm 137 138 Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.cpp -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
r249063 r249096 28 28 29 29 #import "APIString.h" 30 #import "AuthenticationChallengeDispositionCocoa.h" 30 31 #import "CompletionHandlerCallChecker.h" 31 32 #import "WKHTTPCookieStoreInternal.h" 32 33 #import "WKNSArray.h" 34 #import "WKNSURLAuthenticationChallenge.h" 33 35 #import "WKWebViewInternal.h" 34 36 #import "WKWebsiteDataRecordInternal.h" … … 39 41 #import "_WKWebsiteDataStoreConfiguration.h" 40 42 #import "_WKWebsiteDataStoreDelegate.h" 43 #import <WebCore/Credential.h> 41 44 #import <WebKit/ServiceWorkerProcessProxy.h> 42 45 #import <wtf/BlockPtr.h> … … 49 52 : m_delegate(delegate) 50 53 , m_hasRequestStorageSpaceSelector([m_delegate.get() respondsToSelector:@selector(requestStorageSpace: frameOrigin: quota: currentSize: spaceRequired: decisionHandler:)]) 54 , m_hasAuthenticationChallengeSelector([m_delegate.get() respondsToSelector:@selector(didReceiveAuthenticationChallenge: completionHandler:)]) 51 55 { 52 56 } … … 74 78 } 75 79 80 void didReceiveAuthenticationChallenge(Ref<WebKit::AuthenticationChallengeProxy>&& challenge) final 81 { 82 if (!m_hasAuthenticationChallengeSelector || !m_delegate) { 83 challenge->listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::PerformDefaultHandling); 84 return; 85 } 86 87 auto nsURLChallenge = wrapper(challenge); 88 auto checker = WebKit::CompletionHandlerCallChecker::create(m_delegate.getAutoreleased(), @selector(didReceiveAuthenticationChallenge: completionHandler:)); 89 auto completionHandler = makeBlockPtr([challenge = WTFMove(challenge), checker = WTFMove(checker)](NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential) mutable { 90 if (checker->completionHandlerHasBeenCalled()) 91 return; 92 checker->didCallCompletionHandler(); 93 challenge->listener().completeChallenge(WebKit::toAuthenticationChallengeDisposition(disposition), WebCore::Credential(credential)); 94 }); 95 96 [m_delegate.getAutoreleased() didReceiveAuthenticationChallenge:nsURLChallenge completionHandler:completionHandler.get()]; 97 } 98 76 99 WeakObjCPtr<id <_WKWebsiteDataStoreDelegate> > m_delegate; 77 100 bool m_hasRequestStorageSpaceSelector { false }; 101 bool m_hasAuthenticationChallengeSelector { false }; 78 102 }; 79 103 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h
r249063 r249096 35 35 - (void)requestStorageSpace:(NSURL *)mainFrameURL frameOrigin:(NSURL *)frameURL quota:(NSUInteger)quota currentSize:(NSUInteger)currentSize spaceRequired:(NSUInteger)spaceRequired decisionHandler:(void (^)(unsigned long long quota))decisionHandler; 36 36 37 - (void)didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler; 38 37 39 @end -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm
r249063 r249096 36 36 #import "APIWebsiteDataStore.h" 37 37 #import "AuthenticationChallengeDisposition.h" 38 #import "AuthenticationChallengeDispositionCocoa.h" 38 39 #import "AuthenticationDecisionListener.h" 39 40 #import "CompletionHandlerCallChecker.h" … … 960 961 } 961 962 962 static AuthenticationChallengeDisposition toAuthenticationChallengeDisposition(NSURLSessionAuthChallengeDisposition disposition)963 {964 switch (disposition) {965 case NSURLSessionAuthChallengeUseCredential:966 return AuthenticationChallengeDisposition::UseCredential;967 case NSURLSessionAuthChallengePerformDefaultHandling:968 return AuthenticationChallengeDisposition::PerformDefaultHandling;969 case NSURLSessionAuthChallengeCancelAuthenticationChallenge:970 return AuthenticationChallengeDisposition::Cancel;971 case NSURLSessionAuthChallengeRejectProtectionSpace:972 return AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue;973 }974 [NSException raise:NSInvalidArgumentException format:@"Invalid NSURLSessionAuthChallengeDisposition (%ld)", (long)disposition];975 }976 977 963 void NavigationState::NavigationClient::didReceiveAuthenticationChallenge(WebPageProxy&, AuthenticationChallengeProxy& authenticationChallenge) 978 964 { … … 989 975 return; 990 976 checker->didCallCompletionHandler(); 991 challenge->listener().completeChallenge( toAuthenticationChallengeDisposition(disposition), Credential(credential));977 challenge->listener().completeChallenge(WebKit::toAuthenticationChallengeDisposition(disposition), Credential(credential)); 992 978 }).get()]; 993 979 } -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r249063 r249096 38 38 #include "NetworkProcessMessages.h" 39 39 #include "SandboxExtension.h" 40 #if HAVE(SEC_KEY_PROXY) 41 #include "SecKeyProxyStore.h" 42 #endif 40 43 #include "ShouldGrandfatherStatistics.h" 41 44 #include "StorageAccessStatus.h" … … 313 316 } 314 317 315 void NetworkProcessProxy::didReceiveAuthenticationChallenge(PageIdentifier pageID, FrameIdentifier frameID, WebCore::AuthenticationChallenge&& coreChallenge, uint64_t challengeID) 316 { 317 #if ENABLE(SERVICE_WORKER) 318 if (auto* serviceWorkerProcessProxy = m_processPool.serviceWorkerProcessProxyFromPageID(pageID)) { 319 auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, makeRef(*connection()), nullptr); 320 serviceWorkerProcessProxy->didReceiveAuthenticationChallenge(pageID, frameID, WTFMove(authenticationChallenge)); 321 return; 322 } 323 #endif 324 325 WebPageProxy* page = WebProcessProxy::webPage(pageID); 326 MESSAGE_CHECK(page); 327 328 auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, makeRef(*connection()), page->secKeyProxyStore(coreChallenge)); 318 void NetworkProcessProxy::didReceiveAuthenticationChallenge(PAL::SessionID sessionID, PageIdentifier pageID, FrameIdentifier frameID, WebCore::AuthenticationChallenge&& coreChallenge, uint64_t challengeID) 319 { 320 #if HAVE(SEC_KEY_PROXY) 321 WeakPtr<SecKeyProxyStore> secKeyProxyStore; 322 if (coreChallenge.protectionSpace().authenticationScheme() == ProtectionSpaceAuthenticationSchemeClientCertificateRequested) { 323 if (auto* store = websiteDataStoreFromSessionID(sessionID)) { 324 auto newSecKeyProxyStore = SecKeyProxyStore::create(); 325 secKeyProxyStore = makeWeakPtr(newSecKeyProxyStore.get()); 326 store->addSecKeyProxyStore(WTFMove(newSecKeyProxyStore)); 327 } 328 } 329 auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, makeRef(*connection()), WTFMove(secKeyProxyStore)); 330 #else 331 auto authenticationChallenge = AuthenticationChallengeProxy::create(WTFMove(coreChallenge), challengeID, makeRef(*connection()), nullptr); 332 #endif 333 334 WebPageProxy* page = nullptr; 335 if (pageID && !m_processPool.isServiceWorkerPageID(pageID)) 336 page = WebProcessProxy::webPage(pageID); 337 338 if (!page) { 339 auto* store = websiteDataStoreFromSessionID(sessionID); 340 if (!store || coreChallenge.protectionSpace().authenticationScheme() != ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested) { 341 authenticationChallenge->listener().completeChallenge(AuthenticationChallengeDisposition::PerformDefaultHandling); 342 return; 343 } 344 store->client().didReceiveAuthenticationChallenge(WTFMove(authenticationChallenge)); 345 return; 346 } 347 329 348 page->didReceiveAuthenticationChallengeProxy(frameID, WTFMove(authenticationChallenge)); 330 349 } -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r249063 r249096 214 214 void didReceiveNetworkProcessProxyMessage(IPC::Connection&, IPC::Decoder&); 215 215 void didCreateNetworkConnectionToWebProcess(const IPC::Attachment&); 216 void didReceiveAuthenticationChallenge( WebCore::PageIdentifier, WebCore::FrameIdentifier, WebCore::AuthenticationChallenge&&, uint64_t challengeID);216 void didReceiveAuthenticationChallenge(PAL::SessionID, WebCore::PageIdentifier, WebCore::FrameIdentifier, WebCore::AuthenticationChallenge&&, uint64_t challengeID); 217 217 void didFetchWebsiteData(uint64_t callbackID, const WebsiteData&); 218 218 void didDeleteWebsiteData(uint64_t callbackID); -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
r249063 r249096 24 24 DidCreateNetworkConnectionToWebProcess(IPC::Attachment connectionIdentifier) 25 25 26 DidReceiveAuthenticationChallenge( WebCore::PageIdentifier pageID, WebCore::FrameIdentifier frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID)26 DidReceiveAuthenticationChallenge(PAL::SessionID sessionID, WebCore::PageIdentifier pageID, WebCore::FrameIdentifier frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID) 27 27 28 28 DidFetchWebsiteData(uint64_t callbackID, struct WebKit::WebsiteData websiteData) -
trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.cpp
r249063 r249096 91 91 } 92 92 93 void ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge(PageIdentifier pageID, FrameIdentifier frameID, Ref<AuthenticationChallengeProxy>&& challenge)94 {95 UNUSED_PARAM(pageID);96 UNUSED_PARAM(frameID);97 98 // FIXME: Expose an API to delegate the actual decision to the application layer.99 auto& protectionSpace = challenge->core().protectionSpace();100 if (protectionSpace.authenticationScheme() == WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested && processPool().allowsAnySSLCertificateForServiceWorker()) {101 auto credential = WebCore::Credential("accept server trust"_s, emptyString(), WebCore::CredentialPersistenceNone);102 challenge->listener().completeChallenge(AuthenticationChallengeDisposition::UseCredential, credential);103 return;104 }105 notImplemented();106 challenge->listener().completeChallenge(AuthenticationChallengeDisposition::PerformDefaultHandling);107 }108 109 93 } // namespace WebKit 110 94 -
trunk/Source/WebKit/UIProcess/ServiceWorkerProcessProxy.h
r249063 r249096 42 42 static bool hasRegisteredServiceWorkers(const String& serviceWorkerDirectory); 43 43 44 void didReceiveAuthenticationChallenge(WebCore::PageIdentifier, WebCore::FrameIdentifier, Ref<AuthenticationChallengeProxy>&&);45 46 44 void start(const WebPreferencesStore&, Optional<PAL::SessionID> initialSessionID); 47 45 void setUserAgent(const String&); -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r249093 r249096 7334 7334 #endif 7335 7335 7336 WeakPtr<SecKeyProxyStore> WebPageProxy::secKeyProxyStore(const WebCore::AuthenticationChallenge& challenge)7337 {7338 #if HAVE(SEC_KEY_PROXY)7339 if (challenge.protectionSpace().authenticationScheme() == ProtectionSpaceAuthenticationSchemeClientCertificateRequested) {7340 auto secKeyProxyStore = SecKeyProxyStore::create();7341 auto weakPointer = makeWeakPtr(secKeyProxyStore.get());7342 m_websiteDataStore->addSecKeyProxyStore(WTFMove(secKeyProxyStore));7343 return weakPointer;7344 }7345 #endif7346 return nullptr;7347 }7348 7349 7336 void WebPageProxy::didReceiveAuthenticationChallengeProxy(FrameIdentifier, Ref<AuthenticationChallengeProxy>&& authenticationChallenge) 7350 7337 { -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r249063 r249096 2232 2232 } 2233 2233 2234 bool WebProcessPool::isServiceWorkerPageID(PageIdentifier pageID) const 2235 { 2234 2236 #if ENABLE(SERVICE_WORKER) 2235 ServiceWorkerProcessProxy* WebProcessPool::serviceWorkerProcessProxyFromPageID(PageIdentifier pageID) const2236 {2237 2237 // FIXME: This is inefficient. 2238 2238 for (auto* serviceWorkerProcess : m_serviceWorkerProcesses.values()) { 2239 2239 if (serviceWorkerProcess->pageID() == pageID) 2240 return serviceWorkerProcess;2241 } 2242 return nullptr; 2243 } 2244 #endif 2240 return true; 2241 } 2242 #endif 2243 return false; 2244 } 2245 2245 2246 2246 void WebProcessPool::addProcessToOriginCacheSet(WebProcessProxy& process, const URL& url) -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r249063 r249096 380 380 void getNetworkProcessConnection(WebProcessProxy&, Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply&&); 381 381 382 bool isServiceWorkerPageID(WebCore::PageIdentifier) const; 382 383 #if ENABLE(SERVICE_WORKER) 383 384 void establishWorkerContextConnectionToNetworkProcess(NetworkProcessProxy&, WebCore::RegistrableDomain&&, Optional<PAL::SessionID>); 384 ServiceWorkerProcessProxy* serviceWorkerProcessProxyFromPageID(WebCore::PageIdentifier) const;385 385 const HashMap<WebCore::RegistrableDomain, ServiceWorkerProcessProxy*>& serviceWorkerProxies() const { return m_serviceWorkerProcesses; } 386 386 void setAllowsAnySSLCertificateForServiceWorker(bool allows) { m_allowsAnySSLCertificateForServiceWorker = allows; } -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreClient.h
r249063 r249096 26 26 #pragma once 27 27 28 #include "AuthenticationChallengeDisposition.h" 29 #include "AuthenticationChallengeProxy.h" 30 #include "AuthenticationDecisionListener.h" 28 31 #include <wtf/CompletionHandler.h> 29 32 … … 43 46 completionHandler({ }); 44 47 } 48 49 virtual void didReceiveAuthenticationChallenge(Ref<AuthenticationChallengeProxy>&& challenge) 50 { 51 challenge->listener().completeChallenge(AuthenticationChallengeDisposition::PerformDefaultHandling); 52 } 45 53 }; 46 54 -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r249093 r249096 3158 3158 41897ED61F415D860016FA42 /* CacheStorageEngine.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStorageEngine.cpp; sourceTree = "<group>"; }; 3159 3159 419ACF9B1F981D26009F1A83 /* WebServiceWorkerFetchTaskClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebServiceWorkerFetchTaskClient.h; sourceTree = "<group>"; }; 3160 41A5F7B9226ECF7C00671764 /* AuthenticationChallengeDispositionCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallengeDispositionCocoa.h; sourceTree = "<group>"; }; 3161 41A5F7BA226ECF7C00671764 /* AuthenticationChallengeDispositionCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AuthenticationChallengeDispositionCocoa.mm; sourceTree = "<group>"; }; 3160 3162 41AC86811E042E5300303074 /* WebRTCResolver.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; lineEnding = 0; name = WebRTCResolver.messages.in; path = Network/webrtc/WebRTCResolver.messages.in; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = "<none>"; }; 3161 3163 41B28B081F83AD3E00FB52AC /* RTCPacketOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCPacketOptions.h; sourceTree = "<group>"; }; … … 7044 7046 isa = PBXGroup; 7045 7047 children = ( 7048 41A5F7B9226ECF7C00671764 /* AuthenticationChallengeDispositionCocoa.h */, 7049 41A5F7BA226ECF7C00671764 /* AuthenticationChallengeDispositionCocoa.mm */, 7046 7050 57B4B45D20B504AB00D4AD79 /* AuthenticationManagerCocoa.mm */, 7047 7051 44A481C621F2D27B00F2F919 /* ClientCertificateAuthenticationXPCConstants.cpp */, -
trunk/Tools/ChangeLog
r249067 r249096 1 2019-08-26 Youenn Fablet <youenn@apple.com> 2 3 Add a WebsiteDataStore delegate to handle AuthenticationChallenge that do not come from pages 4 https://bugs.webkit.org/show_bug.cgi?id=196870 5 6 Reviewed by Alex Christensen. 7 8 Implement the new delegate by respecting the value set by testRunner.setAllowsAnySSLCertificate 9 Accept any server certificate by default. 10 11 * WebKitTestRunner/TestController.cpp: 12 * WebKitTestRunner/cocoa/TestControllerCocoa.mm: 13 (WTR::TestController::cocoaResetStateToConsistentValues): 14 (WTR::TestController::setAllowsAnySSLCertificate): 15 * WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h: 16 * WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm: 17 (-[TestWebsiteDataStoreDelegate didReceiveAuthenticationChallenge:completionHandler:]): 18 (-[TestWebsiteDataStoreDelegate setAllowAnySSLCertificate:]): 19 1 20 2019-08-23 Aakash Jain <aakash_jain@apple.com> 2 21 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r249063 r249096 1033 1033 m_openPanelFileURLsMediaIcon = nullptr; 1034 1034 #endif 1035 1035 1036 setAllowsAnySSLCertificate(true); 1037 1036 1038 statisticsResetToConsistentState(); 1037 1039 … … 1182 1184 } 1183 1185 1186 #if !PLATFORM(COCOA) 1184 1187 void TestController::setAllowsAnySSLCertificate(bool allows) 1185 1188 { 1189 m_allowsAnySSLCertificate = allows; 1186 1190 WKContextSetAllowsAnySSLCertificateForWebSocketTesting(platformContext(), allows); 1187 1191 } 1192 #endif 1188 1193 1189 1194 static std::string testPath(WKURLRef url) … … 2329 2334 m_serverTrustEvaluationCallbackCallsCount++; 2330 2335 2331 WKRetainPtr<WKCredentialRef> credential = adoptWK(WKCredentialCreate(toWK("accept server trust").get(), toWK("").get(), kWKCredentialPersistenceNone)); 2332 WKAuthenticationDecisionListenerUseCredential(decisionListener, credential.get()); 2336 if (m_allowsAnySSLCertificate) { 2337 WKRetainPtr<WKCredentialRef> credential = adoptWK(WKCredentialCreate(toWK("accept server trust").get(), toWK("").get(), kWKCredentialPersistenceNone)); 2338 WKAuthenticationDecisionListenerUseCredential(decisionListener, credential.get()); 2339 return; 2340 } 2341 WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue(decisionListener); 2333 2342 return; 2334 2343 } -
trunk/Tools/WebKitTestRunner/TestController.h
r249063 r249096 592 592 uint64_t m_serverTrustEvaluationCallbackCallsCount { 0 }; 593 593 bool m_shouldDismissJavaScriptAlertsAsynchronously { false }; 594 bool m_allowsAnySSLCertificate { true }; 594 595 }; 595 596 -
trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
r249063 r249096 36 36 #import <Security/SecItem.h> 37 37 #import <WebKit/WKContextConfigurationRef.h> 38 #import <WebKit/WKContextPrivate.h> 38 39 #import <WebKit/WKCookieManager.h> 39 40 #import <WebKit/WKPreferencesRefPrivate.h> … … 398 399 } 399 400 401 void TestController::setAllowsAnySSLCertificate(bool allows) 402 { 403 m_allowsAnySSLCertificate = allows; 404 WKContextSetAllowsAnySSLCertificateForWebSocketTesting(platformContext(), allows); 405 [globalWebsiteDataStoreDelegateClient setAllowAnySSLCertificate: allows]; 406 } 407 400 408 bool TestController::canDoServerTrustEvaluationInNetworkProcess() const 401 409 { -
trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h
r249063 r249096 31 31 @private 32 32 BOOL _shouldAllowRaisingQuota; 33 BOOL _shouldAllowAnySSLCertificate; 33 34 } 34 35 - (instancetype)init; 35 36 - (void)setAllowRaisingQuota:(BOOL)shouldAllowRaisingQuota; 37 - (void)setAllowAnySSLCertificate:(BOOL)shouldAllowAnySSLCertificate; 36 38 @end -
trunk/Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm
r249063 r249096 43 43 _shouldAllowRaisingQuota = shouldAllowRaisingQuota; 44 44 } 45 46 - (void)didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler 47 { 48 NSString *method = challenge.protectionSpace.authenticationMethod; 49 if ([method isEqualToString:NSURLAuthenticationMethodServerTrust]) { 50 if (_shouldAllowAnySSLCertificate) 51 completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust: challenge.protectionSpace.serverTrust]); 52 else 53 completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil); 54 return; 55 } 56 completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); 57 } 58 59 - (void)setAllowAnySSLCertificate:(BOOL)shouldAllowAnySSLCertificate 60 { 61 _shouldAllowAnySSLCertificate = shouldAllowAnySSLCertificate; 62 } 63 45 64 @end
Note:
See TracChangeset
for help on using the changeset viewer.