Title: [273286] trunk/Source/WebKit
Revision
273286
Author
[email protected]
Date
2021-02-22 16:03:08 -0800 (Mon, 22 Feb 2021)

Log Message

[Cocoa] Send sandbox extensions for Network Extension services in load parameters
https://bugs.webkit.org/show_bug.cgi?id=222284
<rdar://problem/74402532>

Reviewed by Brent Fulgham.

Currently, sandbox extensions for Network Extension services are sent from the UI process to the WebContent process when the
policy decision is made, but that is not soon enough in all cases. They should also be sent as part of the load parameters.

* Shared/Cocoa/LoadParametersCocoa.mm:
(WebKit::LoadParameters::platformEncode const):
(WebKit::LoadParameters::platformDecode):
* Shared/LoadParameters.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::addPlatformLoadParameters):
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::platformDidReceiveLoadParameters):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (273285 => 273286)


--- trunk/Source/WebKit/ChangeLog	2021-02-22 23:49:35 UTC (rev 273285)
+++ trunk/Source/WebKit/ChangeLog	2021-02-23 00:03:08 UTC (rev 273286)
@@ -1,3 +1,23 @@
+2021-02-22  Per Arne Vollan  <[email protected]>
+
+        [Cocoa] Send sandbox extensions for Network Extension services in load parameters
+        https://bugs.webkit.org/show_bug.cgi?id=222284
+        <rdar://problem/74402532>
+
+        Reviewed by Brent Fulgham.
+
+        Currently, sandbox extensions for Network Extension services are sent from the UI process to the WebContent process when the
+        policy decision is made, but that is not soon enough in all cases. They should also be sent as part of the load parameters.
+
+        * Shared/Cocoa/LoadParametersCocoa.mm:
+        (WebKit::LoadParameters::platformEncode const):
+        (WebKit::LoadParameters::platformDecode):
+        * Shared/LoadParameters.h:
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::WebPageProxy::addPlatformLoadParameters):
+        * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+        (WebKit::WebPage::platformDidReceiveLoadParameters):
+
 2021-02-22  Chris Dumez  <[email protected]>
 
         [Cocoa] Add WKWebView session restoration API

Modified: trunk/Source/WebKit/Shared/Cocoa/LoadParametersCocoa.mm (273285 => 273286)


--- trunk/Source/WebKit/Shared/Cocoa/LoadParametersCocoa.mm	2021-02-22 23:49:35 UTC (rev 273285)
+++ trunk/Source/WebKit/Shared/Cocoa/LoadParametersCocoa.mm	2021-02-23 00:03:08 UTC (rev 273286)
@@ -37,6 +37,7 @@
 {
     IPC::encode(encoder, dataDetectionContext.get());
 
+    encoder << networkExtensionSandboxExtensionHandles;
 #if PLATFORM(IOS)
     encoder << contentFilterExtensionHandle;
     encoder << frontboardServiceExtensionHandle;
@@ -48,6 +49,12 @@
     if (!IPC::decode(decoder, parameters.dataDetectionContext))
         return false;
 
+    Optional<SandboxExtension::HandleArray> networkExtensionSandboxExtensionHandles;
+    decoder >> networkExtensionSandboxExtensionHandles;
+    if (!networkExtensionSandboxExtensionHandles)
+        return false;
+    parameters.networkExtensionSandboxExtensionHandles = WTFMove(*networkExtensionSandboxExtensionHandles);
+    
 #if PLATFORM(IOS)
     Optional<Optional<SandboxExtension::Handle>> contentFilterExtensionHandle;
     decoder >> contentFilterExtensionHandle;

Modified: trunk/Source/WebKit/Shared/LoadParameters.h (273285 => 273286)


--- trunk/Source/WebKit/Shared/LoadParameters.h	2021-02-22 23:49:35 UTC (rev 273285)
+++ trunk/Source/WebKit/Shared/LoadParameters.h	2021-02-23 00:03:08 UTC (rev 273286)
@@ -74,6 +74,7 @@
 
 #if PLATFORM(COCOA)
     RetainPtr<NSDictionary> dataDetectionContext;
+    SandboxExtension::HandleArray networkExtensionSandboxExtensionHandles;
 #endif
 #if PLATFORM(IOS)
     Optional<SandboxExtension::Handle> contentFilterExtensionHandle;

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (273285 => 273286)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2021-02-22 23:49:35 UTC (rev 273285)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2021-02-23 00:03:08 UTC (rev 273286)
@@ -165,6 +165,8 @@
 {
     loadParameters.dataDetectionContext = m_uiClient->dataDetectionContext();
 
+    loadParameters.networkExtensionSandboxExtensionHandles = createNetworkExtensionsSandboxExtensions(process);
+    
 #if PLATFORM(IOS)
     if (!process.hasManagedSessionSandboxAccess() && [getWebFilterEvaluatorClass() isManagedSession]) {
         SandboxExtension::Handle handle;

Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (273285 => 273286)


--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2021-02-22 23:49:35 UTC (rev 273285)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2021-02-23 00:03:08 UTC (rev 273286)
@@ -81,6 +81,8 @@
 
     m_dataDetectionContext = parameters.dataDetectionContext;
 
+    consumeNetworkExtensionSandboxExtensions(parameters.networkExtensionSandboxExtensionHandles);
+
 #if PLATFORM(IOS)
     if (parameters.contentFilterExtensionHandle)
         SandboxExtension::consumePermanently(*parameters.contentFilterExtensionHandle);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to