Title: [285404] trunk/Source
Revision
285404
Author
[email protected]
Date
2021-11-08 08:39:20 -0800 (Mon, 08 Nov 2021)

Log Message

trustd network connections occasionally omitted from App Privacy report
https://bugs.webkit.org/show_bug.cgi?id=232770
<rdar://problem/83840427>

Reviewed by Alex Christensen.

Source/WebKit:

* NetworkProcess/cocoa/NetworkSessionCocoa.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(NetworkSessionCocoa::setClientAuditToken):
(-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):

Source/WTF:

* wtf/spi/cocoa/SecuritySPI.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (285403 => 285404)


--- trunk/Source/WTF/ChangeLog	2021-11-08 16:24:10 UTC (rev 285403)
+++ trunk/Source/WTF/ChangeLog	2021-11-08 16:39:20 UTC (rev 285404)
@@ -1,3 +1,13 @@
+2021-11-08  Kate Cheney  <[email protected]>
+
+        trustd network connections occasionally omitted from App Privacy report
+        https://bugs.webkit.org/show_bug.cgi?id=232770
+        <rdar://problem/83840427>
+
+        Reviewed by Alex Christensen.
+
+        * wtf/spi/cocoa/SecuritySPI.h:
+
 2021-11-04  Myles C. Maxfield  <[email protected]>
 
         [WebGPU] Bindings part 1: Bring back Adapter/Device bindings code

Modified: trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h (285403 => 285404)


--- trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h	2021-11-08 16:24:10 UTC (rev 285403)
+++ trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h	2021-11-08 16:39:20 UTC (rev 285404)
@@ -99,6 +99,7 @@
 #endif
 
 CF_RETURNS_RETAINED CFDictionaryRef SecTrustCopyInfo(SecTrustRef);
+OSStatus SecTrustSetClientAuditToken(SecTrustRef, CFDataRef);
 
 extern const CFStringRef kSecTrustInfoExtendedValidationKey;
 extern const CFStringRef kSecTrustInfoCompanyNameKey;

Modified: trunk/Source/WebKit/ChangeLog (285403 => 285404)


--- trunk/Source/WebKit/ChangeLog	2021-11-08 16:24:10 UTC (rev 285403)
+++ trunk/Source/WebKit/ChangeLog	2021-11-08 16:39:20 UTC (rev 285404)
@@ -1,3 +1,16 @@
+2021-11-08  Kate Cheney  <[email protected]>
+
+        trustd network connections occasionally omitted from App Privacy report
+        https://bugs.webkit.org/show_bug.cgi?id=232770
+        <rdar://problem/83840427>
+
+        Reviewed by Alex Christensen.
+
+        * NetworkProcess/cocoa/NetworkSessionCocoa.h:
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (NetworkSessionCocoa::setClientAuditToken):
+        (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
+
 2021-11-08  Andres Gonzalez  <[email protected]>
 
         WTR::AccessibilityController::focusedElement() cannot get the focused object via WKAccessibilityFocusedObject in isolated tree mode.

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h (285403 => 285404)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h	2021-11-08 16:24:10 UTC (rev 285403)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h	2021-11-08 16:39:20 UTC (rev 285404)
@@ -111,6 +111,7 @@
 #endif
 
     static bool allowsSpecificHTTPSCertificateForHost(const WebCore::AuthenticationChallenge&);
+    void setClientAuditToken(const WebCore::AuthenticationChallenge&);
 
     void continueDidReceiveChallenge(SessionWrapper&, const WebCore::AuthenticationChallenge&, NegotiatedLegacyTLS, NetworkDataTaskCocoa::TaskIdentifier, NetworkDataTaskCocoa*, CompletionHandler<void(WebKit::AuthenticationChallengeDisposition, const WebCore::Credential&)>&&);
 

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (285403 => 285404)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2021-11-08 16:24:10 UTC (rev 285403)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2021-11-08 16:39:20 UTC (rev 285404)
@@ -60,6 +60,7 @@
 #import <wtf/SoftLinking.h>
 #import <wtf/URL.h>
 #import <wtf/WeakObjCPtr.h>
+#import <wtf/cocoa/TypeCastsCocoa.h>
 #import <wtf/cocoa/VectorCocoa.h>
 #import <wtf/darwin/WeakLinking.h>
 #import <wtf/text/WTFString.h>
@@ -699,6 +700,19 @@
     return nullptr;
 }
 
+void NetworkSessionCocoa::setClientAuditToken(const WebCore::AuthenticationChallenge& challenge)
+{
+#if ENABLE(APP_PRIVACY_REPORT)
+    if (auto auditToken = networkProcess().sourceApplicationAuditToken()) {
+        auto& tokenValue = *auditToken;
+        RetainPtr<NSData> token = adoptNS([[NSData alloc] initWithBytes:(uint8_t *)&tokenValue length:sizeof(tokenValue)]);
+        SecTrustSetClientAuditToken(challenge.nsURLAuthenticationChallenge().protectionSpace.serverTrust, bridge_cast(token.get()));
+    }
+#else
+    UNUSED_PARAM(challenge);
+#endif
+}
+
 - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
 {
     auto* sessionCocoa = [self sessionFromTask: task];
@@ -720,6 +734,7 @@
     NegotiatedLegacyTLS negotiatedLegacyTLS = NegotiatedLegacyTLS::No;
 
     if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
+        sessionCocoa->setClientAuditToken(challenge);
         if (NetworkSessionCocoa::allowsSpecificHTTPSCertificateForHost(challenge))
             return completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to