Title: [262332] trunk/Source
Revision
262332
Author
bfulg...@apple.com
Date
2020-05-29 18:19:25 -0700 (Fri, 29 May 2020)

Log Message

[Cocoa] Improve logging quality for non-ephemeral sessions
https://bugs.webkit.org/show_bug.cgi?id=212551
<rdar://problem/62461099>

Reviewed by David Kilzer.

Source/WebCore/PAL:

Add support for the 'nw_context_privacy_level' setting.

* pal/spi/cf/CFNetworkSPI.h:

Source/WebKit:

In Bug 209522 I switched normal mode logging to use the same privacy-protecting mode we use for ephemeral sessions.
This had the unintended consequence of removing network load data used to investigate networking issues.

This patch adopts the more fine-grained logging provided by the low-level 'nw_context_privacy_level' setting.

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::configurationForSessionID): Adopt 'nw_context_privacy_level' setting.

Source/WTF:

* wtf/PlatformHave.h: Add new feature check for CFNetwork convenience setter.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (262331 => 262332)


--- trunk/Source/WTF/ChangeLog	2020-05-30 01:08:40 UTC (rev 262331)
+++ trunk/Source/WTF/ChangeLog	2020-05-30 01:19:25 UTC (rev 262332)
@@ -1,3 +1,13 @@
+2020-05-29  Brent Fulgham  <bfulg...@apple.com>
+
+        [Cocoa] Improve logging quality for non-ephemeral sessions
+        https://bugs.webkit.org/show_bug.cgi?id=212551
+        <rdar://problem/62461099>
+
+        Reviewed by David Kilzer.
+
+        * wtf/PlatformHave.h: Add new feature check for CFNetwork convenience setter.
+
 2020-05-29  Wenson Hsieh  <wenson_hs...@apple.com>
 
         REGRESSION (r261812): editing/async-clipboard/clipboard-item-get-type-basic.html is flaky

Modified: trunk/Source/WTF/wtf/PlatformHave.h (262331 => 262332)


--- trunk/Source/WTF/wtf/PlatformHave.h	2020-05-30 01:08:40 UTC (rev 262331)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2020-05-30 01:19:25 UTC (rev 262332)
@@ -638,3 +638,7 @@
 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000
 #define HAVE_NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY 1
 #endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000)
+#define HAVE_LOGGING_PRIVACY_LEVEL 1
+#endif

Modified: trunk/Source/WebCore/PAL/ChangeLog (262331 => 262332)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-05-30 01:08:40 UTC (rev 262331)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-05-30 01:19:25 UTC (rev 262332)
@@ -1,3 +1,15 @@
+2020-05-29  Brent Fulgham  <bfulg...@apple.com>
+
+        [Cocoa] Improve logging quality for non-ephemeral sessions
+        https://bugs.webkit.org/show_bug.cgi?id=212551
+        <rdar://problem/62461099>
+
+        Reviewed by David Kilzer.
+
+        Add support for the 'nw_context_privacy_level' setting.
+
+        * pal/spi/cf/CFNetworkSPI.h:
+
 2020-05-29  Andy Estes  <aes...@apple.com>
 
         [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4)

Modified: trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h (262331 => 262332)


--- trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2020-05-30 01:08:40 UTC (rev 262331)
+++ trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2020-05-30 01:19:25 UTC (rev 262332)
@@ -42,6 +42,7 @@
 #include <CFNetwork/CFURLRequestPriv.h>
 #include <CFNetwork/CFURLResponsePriv.h>
 #include <CFNetwork/CFURLStorageSession.h>
+#include <nw/private.h>
 
 #if PLATFORM(WIN)
 
@@ -66,6 +67,20 @@
 
 #else // !PLATFORM(WIN) && !USE(APPLE_INTERNAL_SDK)
 
+#if HAVE(LOGGING_PRIVACY_LEVEL)
+typedef enum {
+    nw_context_privacy_level_public = 1,
+    nw_context_privacy_level_private = 2,
+    nw_context_privacy_level_sensitive = 3,
+    nw_context_privacy_level_silent = 4,
+} nw_context_privacy_level_t;
+
+#ifndef NW_CONTEXT_HAS_PRIVACY_LEVEL_SILENT
+#define NW_CONTEXT_HAS_PRIVACY_LEVEL_SILENT    1
+#endif
+
+#endif
+
 typedef CF_ENUM(int64_t, _TimingDataOptions)
 {
     _TimingDataOptionsEnableW3CNavigationTiming = (1 << 0)
@@ -209,6 +224,9 @@
 #if HAVE(ALLOWS_SENSITIVE_LOGGING)
 @property BOOL _allowsSensitiveLogging;
 #endif
+#if HAVE(LOGGING_PRIVACY_LEVEL)
+@property nw_context_privacy_level_t _loggingPrivacyLevel;
+#endif
 #if HAVE(CFNETWORK_ALTERNATIVE_SERVICE)
 @property (nullable, retain) _NSHTTPAlternativeServicesStorage *_alternativeServicesStorage;
 @property (readonly, assign) BOOL _allowsHTTP3;

Modified: trunk/Source/WebKit/ChangeLog (262331 => 262332)


--- trunk/Source/WebKit/ChangeLog	2020-05-30 01:08:40 UTC (rev 262331)
+++ trunk/Source/WebKit/ChangeLog	2020-05-30 01:19:25 UTC (rev 262332)
@@ -1,3 +1,19 @@
+2020-05-29  Brent Fulgham  <bfulg...@apple.com>
+
+        [Cocoa] Improve logging quality for non-ephemeral sessions
+        https://bugs.webkit.org/show_bug.cgi?id=212551
+        <rdar://problem/62461099>
+
+        Reviewed by David Kilzer.
+
+        In Bug 209522 I switched normal mode logging to use the same privacy-protecting mode we use for ephemeral sessions.
+        This had the unintended consequence of removing network load data used to investigate networking issues.
+
+        This patch adopts the more fine-grained logging provided by the low-level 'nw_context_privacy_level' setting.
+
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (WebKit::configurationForSessionID): Adopt 'nw_context_privacy_level' setting.
+
 2020-05-29  Andy Estes  <aes...@apple.com>
 
         [Apple Pay] Remove conditionals for ENABLE_APPLE_PAY_SESSION_V(3|4)

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (262331 => 262332)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2020-05-30 01:08:40 UTC (rev 262331)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2020-05-30 01:19:25 UTC (rev 262332)
@@ -52,6 +52,7 @@
 #import <wtf/MainThread.h>
 #import <wtf/NakedRef.h>
 #import <wtf/NeverDestroyed.h>
+#import <wtf/ObjCRuntimeExtras.h>
 #import <wtf/ProcessPrivilege.h>
 #import <wtf/SoftLinking.h>
 #import <wtf/URL.h>
@@ -1029,14 +1030,25 @@
 
 static NSURLSessionConfiguration *configurationForSessionID(const PAL::SessionID& session)
 {
+#if HAVE(LOGGING_PRIVACY_LEVEL)
+    auto loggingPrivacyLevel = nw_context_privacy_level_sensitive;
+#endif
+
     NSURLSessionConfiguration *configuration;
     if (session.isEphemeral()) {
         configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration];
         configuration._shouldSkipPreferredClientCertificateLookup = YES;
+#if HAVE(LOGGING_PRIVACY_LEVEL) && defined(NW_CONTEXT_HAS_PRIVACY_LEVEL_SILENT)
+        loggingPrivacyLevel = nw_context_privacy_level_silent;
+#endif
     } else
         configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
 
-#if HAVE(ALLOWS_SENSITIVE_LOGGING)
+#if HAVE(LOGGING_PRIVACY_LEVEL)
+    auto setLoggingPrivacyLevel = NSSelectorFromString(@"_setLoggingPrivacyLevel:");
+    if ([configuration respondsToSelector:setLoggingPrivacyLevel])
+        wtfObjCMsgSend<void>(configuration, setLoggingPrivacyLevel, loggingPrivacyLevel);
+#elif HAVE(ALLOWS_SENSITIVE_LOGGING)
 ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     configuration._allowsSensitiveLogging = NO;
 ALLOW_DEPRECATED_DECLARATIONS_END
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to