Changeset 287781 in webkit
- Timestamp:
- Jan 7, 2022, 1:52:15 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 19 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/SocketProvider.cpp (modified) (1 diff)
-
WebCore/platform/network/cf/SocketStreamHandleImpl.h (modified) (3 diffs)
-
WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (modified) (2 diffs)
-
WebCore/platform/network/curl/SocketStreamHandleImpl.h (modified) (1 diff)
-
WebCore/platform/network/soup/SocketStreamHandleImpl.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (modified) (1 diff)
-
WebKit/NetworkProcess/NetworkSession.cpp (modified) (1 diff)
-
WebKit/NetworkProcess/NetworkSession.h (modified) (2 diffs)
-
WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp (modified) (3 diffs)
-
WebKit/NetworkProcess/NetworkSessionCreationParameters.h (modified) (1 diff)
-
WebKit/NetworkProcess/NetworkSocketStream.cpp (modified) (1 diff)
-
WebKit/NetworkProcess/NetworkSocketStream.h (modified) (2 diffs)
-
WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h (modified) (1 diff)
-
WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm (modified) (1 diff)
-
WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (modified) (1 diff)
-
WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp (modified) (1 diff)
-
WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287779 r287781 1 2022-01-07 Patrick Angle <pangle@apple.com> 2 3 [Cocoa] Web Driver: WebSocket over TLS failing over WebDriver with acceptInsecureCerts on Big Sur 4 https://bugs.webkit.org/show_bug.cgi?id=234403 5 6 Reviewed by BJ Burg. 7 8 * page/SocketProvider.cpp: 9 (WebCore::SocketProvider::createSocketStreamHandle): 10 * platform/network/cf/SocketStreamHandleImpl.h: 11 (WebCore::SocketStreamHandleImpl::create): 12 * platform/network/cf/SocketStreamHandleImplCFNet.cpp: 13 (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl): 14 (WebCore::SocketStreamHandleImpl::createStreams): 15 * platform/network/curl/SocketStreamHandleImpl.h: 16 (WebCore::SocketStreamHandleImpl::create): 17 * platform/network/soup/SocketStreamHandleImpl.h: 18 1 19 2022-01-07 Alan Bujtas <zalan@apple.com> 2 20 -
trunk/Source/WebCore/page/SocketProvider.cpp
r266467 r287781 34 34 Ref<SocketStreamHandle> SocketProvider::createSocketStreamHandle(const URL& url, SocketStreamHandleClient& client, WebSocketIdentifier, PAL::SessionID sessionID, const String& credentialPartition, const StorageSessionProvider* provider) 35 35 { 36 return SocketStreamHandleImpl::create(url, client, sessionID, credentialPartition, { }, provider); 36 static const auto shouldAcceptInsecureCertificates = false; 37 return SocketStreamHandleImpl::create(url, client, sessionID, credentialPartition, { }, provider, shouldAcceptInsecureCertificates); 37 38 } 38 39 -
trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h
r278253 r287781 48 48 class SocketStreamHandleImpl : public SocketStreamHandle { 49 49 public: 50 static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData, const StorageSessionProvider* provider ) { return adoptRef(*new SocketStreamHandleImpl(url, client, sessionID, credentialPartition, WTFMove(auditData), provider)); }50 static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData, const StorageSessionProvider* provider, bool shouldAcceptInsecureCertificates) { return adoptRef(*new SocketStreamHandleImpl(url, client, sessionID, credentialPartition, WTFMove(auditData), provider, shouldAcceptInsecureCertificates)); } 51 51 52 52 virtual ~SocketStreamHandleImpl(); … … 62 62 bool sendPendingData(); 63 63 64 WEBCORE_EXPORT SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition, SourceApplicationAuditToken&&, const StorageSessionProvider* );64 WEBCORE_EXPORT SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition, SourceApplicationAuditToken&&, const StorageSessionProvider*, bool shouldAcceptInsecureCertificates); 65 65 void createStreams(); 66 66 void scheduleStreams(); … … 100 100 RetainPtr<CFHTTPMessageRef> m_proxyResponseMessage; 101 101 bool m_sentStoredCredentials; 102 bool m_shouldAcceptInsecureCertificates; 102 103 RetainPtr<CFReadStreamRef> m_readStream; 103 104 RetainPtr<CFWriteStreamRef> m_writeStream; -
trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp
r287224 r287781 97 97 } 98 98 99 SocketStreamHandleImpl::SocketStreamHandleImpl(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData, const StorageSessionProvider* provider )99 SocketStreamHandleImpl::SocketStreamHandleImpl(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData, const StorageSessionProvider* provider, bool acceptInsecureCertificates) 100 100 : SocketStreamHandle(url, client) 101 101 , m_connectingSubstate(New) 102 102 , m_connectionType(Unknown) 103 103 , m_sentStoredCredentials(false) 104 , m_shouldAcceptInsecureCertificates(acceptInsecureCertificates) 104 105 , m_credentialPartition(credentialPartition) 105 106 , m_auditData(WTFMove(auditData)) … … 358 359 359 360 if (shouldUseSSL()) { 360 CFBooleanRef validateCertificateChain = DeprecatedGlobalSettings::allowsAnySSLCertificate() ? kCFBooleanFalse : kCFBooleanTrue; 361 // FIXME: rdar://86641948 Remove shouldAcceptInsecureCertificatesForWebSockets once HAVE(NSURLSESSION_WEBSOCKET) is supported on all Cocoa platforms. 362 CFBooleanRef validateCertificateChain = DeprecatedGlobalSettings::allowsAnySSLCertificate() || m_shouldAcceptInsecureCertificates ? kCFBooleanFalse : kCFBooleanTrue; 361 363 const void* keys[] = { 362 364 kCFStreamSSLPeerName, -
trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h
r287684 r287781 45 45 class SocketStreamHandleImpl : public SocketStreamHandle, public CurlStream::Client { 46 46 public: 47 static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID, const String&, SourceApplicationAuditToken&&, const StorageSessionProvider* provider ) { return adoptRef(*new SocketStreamHandleImpl(url, client, provider)); }47 static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID, const String&, SourceApplicationAuditToken&&, const StorageSessionProvider* provider, bool) { return adoptRef(*new SocketStreamHandleImpl(url, client, provider)); } 48 48 49 49 virtual ~SocketStreamHandleImpl(); -
trunk/Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h
r278253 r287781 48 48 class SocketStreamHandleImpl final : public SocketStreamHandle { 49 49 public: 50 static Ref<SocketStreamHandleImpl> create(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String&, SourceApplicationAuditToken&&, const StorageSessionProvider* )50 static Ref<SocketStreamHandleImpl> create(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String&, SourceApplicationAuditToken&&, const StorageSessionProvider*, bool) 51 51 { 52 52 RELEASE_ASSERT_NOT_REACHED(); -
trunk/Source/WebKit/ChangeLog
r287775 r287781 1 2022-01-07 Patrick Angle <pangle@apple.com> 2 3 [Cocoa] Web Driver: WebSocket over TLS failing over WebDriver with acceptInsecureCerts on Big Sur 4 https://bugs.webkit.org/show_bug.cgi?id=234403 5 6 Reviewed by BJ Burg. 7 8 macOS Big Sur and earlier do not use NSURLSession-based WebSockets, so we need a way to allow insecure 9 certificates under automation that does not rely on the `WKNavigationDelegate` to determine if an 10 authentication challenge should be accepted. In order to accomplish this we now plumb through an 11 `_shouldAcceptInsecureCertificatesForWebSockets` value from `_WKAutomationSessionConfiguration` to 12 `SocketStreamHandleImplCFNet` on platforms that do not `HAVE(NSURLSESSION_WEBSOCKET)`, which allows automation 13 clients to enable this behavior when the `acceptInsecureCerts` capability is set on a session. 14 15 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 16 (WebKit::NetworkConnectionToWebProcess::createSocketStream): 17 * NetworkProcess/NetworkSession.cpp: 18 (WebKit::NetworkSession::NetworkSession): 19 * NetworkProcess/NetworkSession.h: 20 (WebKit::NetworkSession::shouldAcceptInsecureCertificatesForWebSockets const): 21 * NetworkProcess/NetworkSessionCreationParameters.cpp: 22 (WebKit::NetworkSessionCreationParameters::encode const): 23 (WebKit::NetworkSessionCreationParameters::decode): 24 * NetworkProcess/NetworkSessionCreationParameters.h: 25 * NetworkProcess/NetworkSocketStream.cpp: 26 (WebKit::NetworkSocketStream::create): 27 (WebKit::NetworkSocketStream::NetworkSocketStream): 28 * NetworkProcess/NetworkSocketStream.h: 29 * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: 30 * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: 31 (-[_WKWebsiteDataStoreConfiguration _shouldAcceptInsecureCertificatesForWebSockets]): 32 (-[_WKWebsiteDataStoreConfiguration _setShouldAcceptInsecureCertificatesForWebSockets:]): 33 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 34 (WebKit::WebsiteDataStore::parameters): 35 * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: 36 (WebKit::WebsiteDataStoreConfiguration::copy const): 37 * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 38 (WebKit::WebsiteDataStoreConfiguration::shouldAcceptInsecureCertificatesForWebSockets const): 39 (WebKit::WebsiteDataStoreConfiguration::setShouldAcceptInsecureCertificatesForWebSockets): 40 1 41 2021-10-30 Myles C. Maxfield <mmaxfield@apple.com> 2 42 -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r287763 r287781 431 431 token = { m_networkProcess->sourceApplicationAuditData() }; 432 432 #endif 433 m_networkSocketStreams.add(identifier, NetworkSocketStream::create(m_networkProcess.get(), WTFMove(url), m_sessionID, cachePartition, identifier, m_connection, WTFMove(token))); 433 auto acceptInsecureCertificates = false; 434 #if !HAVE(NSURLSESSION_WEBSOCKET) 435 if (auto* session = networkSession()) 436 acceptInsecureCertificates = session->shouldAcceptInsecureCertificatesForWebSockets(); 437 #endif 438 m_networkSocketStreams.add(identifier, NetworkSocketStream::create(m_networkProcess.get(), WTFMove(url), m_sessionID, cachePartition, identifier, m_connection, WTFMove(token), acceptInsecureCertificates)); 434 439 } 435 440 -
trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp
r287731 r287781 133 133 , m_notificationManager(*this, parameters.webPushMachServiceName) 134 134 #endif 135 #if !HAVE(NSURLSESSION_WEBSOCKET) 136 , m_shouldAcceptInsecureCertificatesForWebSockets(parameters.shouldAcceptInsecureCertificatesForWebSockets) 137 #endif 135 138 { 136 139 if (!m_sessionID.isEphemeral()) { -
trunk/Source/WebKit/NetworkProcess/NetworkSession.h
r287611 r287781 245 245 NetworkNotificationManager& notificationManager() { return m_notificationManager; } 246 246 #endif 247 248 #if !HAVE(NSURLSESSION_WEBSOCKET) 249 bool shouldAcceptInsecureCertificatesForWebSockets() const { return m_shouldAcceptInsecureCertificatesForWebSockets; } 250 #endif 247 251 248 252 protected: … … 332 336 NetworkNotificationManager m_notificationManager; 333 337 #endif 338 #if !HAVE(NSURLSESSION_WEBSOCKET) 339 bool m_shouldAcceptInsecureCertificatesForWebSockets { false }; 340 #endif 334 341 }; 335 342 -
trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp
r286355 r287781 93 93 encoder << webPushMachServiceName; 94 94 encoder << enablePrivateClickMeasurementDebugMode; 95 #if !HAVE(NSURLSESSION_WEBSOCKET) 96 encoder << shouldAcceptInsecureCertificatesForWebSockets; 97 #endif 95 98 encoder << resourceLoadStatisticsParameters; 96 99 } … … 324 327 if (!enablePrivateClickMeasurementDebugMode) 325 328 return std::nullopt; 329 330 #if !HAVE(NSURLSESSION_WEBSOCKET) 331 std::optional<bool> shouldAcceptInsecureCertificatesForWebSockets; 332 decoder >> shouldAcceptInsecureCertificatesForWebSockets; 333 if (!shouldAcceptInsecureCertificatesForWebSockets) 334 return std::nullopt; 335 #endif 326 336 327 337 std::optional<ResourceLoadStatisticsParameters> resourceLoadStatisticsParameters; … … 383 393 , WTFMove(*webPushMachServiceName) 384 394 , WTFMove(*enablePrivateClickMeasurementDebugMode) 395 #if !HAVE(NSURLSESSION_WEBSOCKET) 396 , WTFMove(*shouldAcceptInsecureCertificatesForWebSockets) 397 #endif 385 398 , WTFMove(*resourceLoadStatisticsParameters) 386 399 }}; -
trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h
r286355 r287781 109 109 String webPushMachServiceName; 110 110 bool enablePrivateClickMeasurementDebugMode { false }; 111 #if !HAVE(NSURLSESSION_WEBSOCKET) 112 bool shouldAcceptInsecureCertificatesForWebSockets { false }; 113 #endif 111 114 112 115 ResourceLoadStatisticsParameters resourceLoadStatisticsParameters; -
trunk/Source/WebKit/NetworkProcess/NetworkSocketStream.cpp
r282755 r287781 36 36 using namespace WebCore; 37 37 38 Ref<NetworkSocketStream> NetworkSocketStream::create(NetworkProcess& networkProcess, URL&& url, PAL::SessionID sessionID, const String& credentialPartition, WebSocketIdentifier identifier, IPC::Connection& connection, SourceApplicationAuditToken&& auditData )38 Ref<NetworkSocketStream> NetworkSocketStream::create(NetworkProcess& networkProcess, URL&& url, PAL::SessionID sessionID, const String& credentialPartition, WebSocketIdentifier identifier, IPC::Connection& connection, SourceApplicationAuditToken&& auditData, bool shouldAcceptInsecureCertificates) 39 39 { 40 return adoptRef(*new NetworkSocketStream(networkProcess, WTFMove(url), sessionID, credentialPartition, identifier, connection, WTFMove(auditData) ));40 return adoptRef(*new NetworkSocketStream(networkProcess, WTFMove(url), sessionID, credentialPartition, identifier, connection, WTFMove(auditData), shouldAcceptInsecureCertificates)); 41 41 } 42 42 43 NetworkSocketStream::NetworkSocketStream(NetworkProcess& networkProcess, URL&& url, PAL::SessionID sessionID, const String& credentialPartition, WebSocketIdentifier identifier, IPC::Connection& connection, SourceApplicationAuditToken&& auditData )43 NetworkSocketStream::NetworkSocketStream(NetworkProcess& networkProcess, URL&& url, PAL::SessionID sessionID, const String& credentialPartition, WebSocketIdentifier identifier, IPC::Connection& connection, SourceApplicationAuditToken&& auditData, bool shouldAcceptInsecureCertificates) 44 44 : m_identifier(identifier) 45 45 , m_connection(connection) 46 , m_impl(SocketStreamHandleImpl::create(url, *this, sessionID, credentialPartition, WTFMove(auditData), NetworkStorageSessionProvider::create(networkProcess, sessionID).ptr() ))46 , m_impl(SocketStreamHandleImpl::create(url, *this, sessionID, credentialPartition, WTFMove(auditData), NetworkStorageSessionProvider::create(networkProcess, sessionID).ptr(), shouldAcceptInsecureCertificates)) 47 47 , m_delayFailTimer(*this, &NetworkSocketStream::sendDelayedFailMessage) 48 48 { -
trunk/Source/WebKit/NetworkProcess/NetworkSocketStream.h
r278532 r287781 47 47 class NetworkSocketStream : public RefCounted<NetworkSocketStream>, public IPC::MessageSender, public IPC::MessageReceiver, public WebCore::SocketStreamHandleClient { 48 48 public: 49 static Ref<NetworkSocketStream> create(NetworkProcess&, URL&&, PAL::SessionID, const String& credentialPartition, WebCore::WebSocketIdentifier, IPC::Connection&, WebCore::SourceApplicationAuditToken&& );49 static Ref<NetworkSocketStream> create(NetworkProcess&, URL&&, PAL::SessionID, const String& credentialPartition, WebCore::WebSocketIdentifier, IPC::Connection&, WebCore::SourceApplicationAuditToken&&, bool shouldAcceptInsecureCertificates); 50 50 ~NetworkSocketStream(); 51 51 … … 69 69 uint64_t messageSenderDestinationID() const final; 70 70 71 NetworkSocketStream(NetworkProcess&, URL&&, PAL::SessionID, const String& credentialPartition, WebCore::WebSocketIdentifier, IPC::Connection&, WebCore::SourceApplicationAuditToken&& );71 NetworkSocketStream(NetworkProcess&, URL&&, PAL::SessionID, const String& credentialPartition, WebCore::WebSocketIdentifier, IPC::Connection&, WebCore::SourceApplicationAuditToken&&, bool shouldAcceptInsecureCertificates); 72 72 73 73 WebCore::WebSocketIdentifier m_identifier; -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h
r286355 r287781 55 55 @property (nonatomic) BOOL shouldRunServiceWorkersOnMainThreadForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 56 56 57 // FIXME: rdar://86641948 Remove acceptInsecureCertificatesForWebSockets once HAVE(NSURLSESSION_WEBSOCKET) is supported on all Cocoa platforms. 58 @property (nonatomic, setter=_setShouldAcceptInsecureCertificatesForWebSockets:) BOOL _shouldAcceptInsecureCertificatesForWebSockets WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 59 57 60 // These properties only make sense for persistent data stores, and will throw 58 61 // an exception if set for non-persistent stores. -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm
r286816 r287781 497 497 } 498 498 499 - (BOOL)_shouldAcceptInsecureCertificatesForWebSockets 500 { 501 #if !HAVE(NSURLSESSION_WEBSOCKET) 502 return _configuration->shouldAcceptInsecureCertificatesForWebSockets(); 503 #else 504 return false; 505 #endif 506 } 507 508 - (void)_setShouldAcceptInsecureCertificatesForWebSockets:(BOOL)accept 509 { 510 #if !HAVE(NSURLSESSION_WEBSOCKET) 511 _configuration->setShouldAcceptInsecureCertificatesForWebSockets(accept); 512 #else 513 UNUSED_PARAM(accept); 514 #endif 515 } 516 499 517 - (void)setProxyConfiguration:(NSDictionary *)configuration 500 518 { -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r287731 r287781 1892 1892 networkSessionParameters.pcmMachServiceName = m_configuration->pcmMachServiceName(); 1893 1893 networkSessionParameters.webPushMachServiceName = m_configuration->webPushMachServiceName(); 1894 #if !HAVE(NSURLSESSION_WEBSOCKET) 1895 networkSessionParameters.shouldAcceptInsecureCertificatesForWebSockets = m_configuration->shouldAcceptInsecureCertificatesForWebSockets(); 1896 #endif 1894 1897 1895 1898 parameters.networkSessionParameters = WTFMove(networkSessionParameters); -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp
r286355 r287781 116 116 copy->m_modelElementCacheDirectory = this->m_modelElementCacheDirectory; 117 117 #endif 118 #if !HAVE(NSURLSESSION_WEBSOCKET) 119 copy->m_shouldAcceptInsecureCertificatesForWebSockets = this->m_shouldAcceptInsecureCertificatesForWebSockets; 120 #endif 118 121 119 122 return copy; -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h
r286816 r287781 197 197 void setWebPushMachServiceName(String&& name) { m_webPushMachServiceName = WTFMove(name); } 198 198 const String& webPushMachServiceName() const { return m_webPushMachServiceName; } 199 200 #if !HAVE(NSURLSESSION_WEBSOCKET) 201 bool shouldAcceptInsecureCertificatesForWebSockets() const { return m_shouldAcceptInsecureCertificatesForWebSockets; } 202 void setShouldAcceptInsecureCertificatesForWebSockets(bool accept) { m_shouldAcceptInsecureCertificatesForWebSockets = accept; } 203 #endif 199 204 200 205 private: … … 254 259 String m_pcmMachServiceName; 255 260 String m_webPushMachServiceName; 261 #if !HAVE(NSURLSESSION_WEBSOCKET) 262 bool m_shouldAcceptInsecureCertificatesForWebSockets { false }; 263 #endif 256 264 #if PLATFORM(COCOA) 257 265 RetainPtr<CFDictionaryRef> m_proxyConfiguration;
Note:
See TracChangeset
for help on using the changeset viewer.