Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8c4517f0f7c512fe8ace111510e3068f745ebcd2
https://github.com/WebKit/WebKit/commit/8c4517f0f7c512fe8ace111510e3068f745ebcd2
Author: Alex Christensen <[email protected]>
Date: 2026-07-09 (Thu, 09 Jul 2026)
Changed paths:
M Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
M Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
M Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
M Source/WebKit/UIProcess/ProvisionalPageProxy.h
M Source/WebKit/UIProcess/WebFrameProxy.cpp
M Source/WebKit/UIProcess/WebFrameProxy.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxy.messages.in
M
Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewServerTrustKVC.mm
Log Message:
-----------
Use CertificateInfo from network process instead of web content process
rdar://174079071
Reviewed by Chris Dumez.
Using the CertificateInfo from the web content process allows a compromised
web content process to tamper with the certificates and their properties.
This PR makes us use the CertificateInfo from the network process instead.
We send the CertificateInfo when we receive a response. Thereafter, when the
first HTTP body data is received, it is sent to the web content process which
tells the UI process that the load was committed. Since the messages coming
from the network process directly to the UI process are on a separate queue
at the kernel level, there is no guarantee of the order messages are received
in. In the very unlikely case that the certificate info has not yet
arrived,
process the incoming messages from the network process to find the certificate
info. To avoid race conditions between multiple navigations committing in
quick succession, we check the host and port for correctness before using the
certificate info. This allows a compromised web content process to either
match or not match, which limits its ability to just using or not using the
certificate info from the network process.
To fix the regression from the original commit, I include rdar://177670634
in this upstreaming too.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewServerTrustKVC.mm
* Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didReceiveMainResourceResponse):
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _certificateChain]):
(-[WKWebView certificateChain]):
*
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::receivedMainResourceResponseWithCertificateInfo):
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.h:
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in:
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
* Source/WebKit/UIProcess/ProvisionalPageProxy.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::didCommitLoad):
(WebKit::WebFrameProxy::commitProvisionalFrame):
(WebKit::WebFrameProxy::waitForCertificateInfoFromNetworkProcess):
(WebKit::WebFrameProxy::commitCertificateInfo):
(WebKit::WebFrameProxy::receivedMainResourceResponseWithCertificateInfo):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::commitProvisionalPage):
(WebKit::WebPageProxy::didCommitLoadForFrame):
* Source/WebKit/UIProcess/WebPageProxy.h:
*
Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::dispatchDidCommitLoad):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewServerTrustKVC.mm:
(-[TrustObserver observeValueForKeyPath:ofObject:change:context:]):
(-[TrustObserver waitUntilServerTrustChanged]):
(TEST(WKWebView, ServerTrustKVC)):
Originally-landed-as: 305413.924@safari-7624-branch (ca0e749a00ce).
rdar://174079071
Also includes:
Originally-landed-as: 305413.950@safari-7624-branch (732f21e). rdar://177670634
Canonical link:
https://flagged.apple.com:443/proxy?t2=DI0g4s5tI2&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE2ODU0QG1haW4=&emid=e37e87bc-745d-413f-9a5c-9295491900b6&c=11
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications