Title: [268492] trunk/Source/WebKit
Revision
268492
Author
pvol...@apple.com
Date
2020-10-14 15:19:18 -0700 (Wed, 14 Oct 2020)

Log Message

[macOS] Issue sandbox extension to additional icon service when attachment element is enabled.
https://bugs.webkit.org/show_bug.cgi?id=217706
<rdar://problem/70291100>

Reviewed by Brent Fulgham.

Issue sandbox extension to 'com.apple.iconservices.store' when attachment element is enabled on macOS.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::attachmentElementServices):
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/com.apple.WebProcess.sb.in:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (268491 => 268492)


--- trunk/Source/WebKit/ChangeLog	2020-10-14 22:13:35 UTC (rev 268491)
+++ trunk/Source/WebKit/ChangeLog	2020-10-14 22:19:18 UTC (rev 268492)
@@ -1,3 +1,27 @@
+2020-10-14  Per Arne Vollan  <pvol...@apple.com>
+
+        [macOS] Issue sandbox extension to additional icon service when attachment element is enabled.
+        https://bugs.webkit.org/show_bug.cgi?id=217706
+        <rdar://problem/70291100>
+
+        Reviewed by Brent Fulgham.
+
+        Issue sandbox extension to 'com.apple.iconservices.store' when attachment element is enabled on macOS.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        (WebKit::WebPageCreationParameters::decode):
+        * Shared/WebPageCreationParameters.h:
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode const):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::attachmentElementServices):
+        (WebKit::WebPageProxy::creationParameters):
+        * WebProcess/WebPage/WebPage.cpp:
+        * WebProcess/com.apple.WebProcess.sb.in:
+
 2020-10-14  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, reverting r268431 and r268443.

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (268491 => 268492)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2020-10-14 22:13:35 UTC (rev 268491)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp	2020-10-14 22:19:18 UTC (rev 268492)
@@ -97,8 +97,7 @@
 #endif
 
 #if ENABLE(ATTACHMENT_ELEMENT)
-    encoder << frontboardExtensionHandle;
-    encoder << iconServicesExtensionHandle;
+    encoder << attachmentElementExtensionHandles;
 #endif
 
 #if PLATFORM(IOS_FAMILY)
@@ -328,17 +327,11 @@
 #endif
 
 #if ENABLE(ATTACHMENT_ELEMENT)
-    Optional<Optional<SandboxExtension::Handle>> frontboardExtensionHandle;
-    decoder >> frontboardExtensionHandle;
-    if (!frontboardExtensionHandle)
+    Optional<Optional<SandboxExtension::HandleArray>> attachmentElementExtensionHandles;
+    decoder >> attachmentElementExtensionHandles;
+    if (!attachmentElementExtensionHandles)
         return WTF::nullopt;
-    parameters.frontboardExtensionHandle = WTFMove(*frontboardExtensionHandle);
-
-    Optional<Optional<SandboxExtension::Handle>> iconServicesExtensionHandle;
-    decoder >> iconServicesExtensionHandle;
-    if (!iconServicesExtensionHandle)
-        return WTF::nullopt;
-    parameters.iconServicesExtensionHandle = WTFMove(*iconServicesExtensionHandle);
+    parameters.attachmentElementExtensionHandles = WTFMove(*attachmentElementExtensionHandles);
 #endif
 
 #if PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (268491 => 268492)


--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2020-10-14 22:13:35 UTC (rev 268491)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h	2020-10-14 22:19:18 UTC (rev 268492)
@@ -158,8 +158,7 @@
     Optional<WebCore::ViewportArguments> overrideViewportArguments;
 #endif
 #if ENABLE(ATTACHMENT_ELEMENT)
-    Optional<SandboxExtension::Handle> frontboardExtensionHandle;
-    Optional<SandboxExtension::Handle> iconServicesExtensionHandle;
+    Optional<SandboxExtension::HandleArray> attachmentElementExtensionHandles;
 #endif
 #if PLATFORM(IOS_FAMILY)
     WebCore::FloatSize screenSize;

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (268491 => 268492)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-10-14 22:13:35 UTC (rev 268491)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-10-14 22:19:18 UTC (rev 268492)
@@ -7654,6 +7654,22 @@
     m_process->processTerminated();
 }
 
+#if ENABLE(ATTACHMENT_ELEMENT) && PLATFORM(COCOA)
+static const Vector<ASCIILiteral>& attachmentElementServices()
+{
+    static const auto services = makeNeverDestroyed(Vector<ASCIILiteral> {
+#if PLATFORM(IOS_FAMILY)
+        "com.apple.frontboard.systemappservices"_s,
+#endif
+        "com.apple.iconservices"_s,
+#if PLATFORM(MAC)
+        "com.apple.iconservices.store"_s,
+#endif
+    });
+    return services;
+}
+#endif
+
 WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& process, DrawingAreaProxy& drawingArea, RefPtr<API::WebsitePolicies>&& websitePolicies)
 {
     WebPageCreationParameters parameters;
@@ -7821,13 +7837,7 @@
 
 #if ENABLE(ATTACHMENT_ELEMENT) && PLATFORM(COCOA)
     if (m_preferences->attachmentElementEnabled() && !m_process->hasIssuedAttachmentElementRelatedSandboxExtensions()) {
-        SandboxExtension::Handle handle;
-#if PLATFORM(IOS_FAMILY)
-        SandboxExtension::createHandleForMachLookup("com.apple.frontboard.systemappservices"_s, WTF::nullopt, handle);
-        parameters.frontboardExtensionHandle = WTFMove(handle);
-#endif
-        SandboxExtension::createHandleForMachLookup("com.apple.iconservices"_s, WTF::nullopt, handle);
-        parameters.iconServicesExtensionHandle = WTFMove(handle);
+        parameters.attachmentElementExtensionHandles = SandboxExtension::createHandlesForMachLookup(attachmentElementServices(), WTF::nullopt);
         m_process->setHasIssuedAttachmentElementRelatedSandboxExtensions();
     }
 #endif

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (268491 => 268492)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-10-14 22:13:35 UTC (rev 268491)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-10-14 22:19:18 UTC (rev 268492)
@@ -571,10 +571,8 @@
         CrossOriginAccessControlCheckDisabler::singleton().setCrossOriginAccessControlCheckEnabled(false);
 
 #if ENABLE(ATTACHMENT_ELEMENT)
-    if (parameters.frontboardExtensionHandle)
-        SandboxExtension::consumePermanently(*parameters.frontboardExtensionHandle);
-    if (parameters.iconServicesExtensionHandle)
-        SandboxExtension::consumePermanently(*parameters.iconServicesExtensionHandle);
+    if (parameters.attachmentElementExtensionHandles)
+        SandboxExtension::consumePermanently(*parameters.attachmentElementExtensionHandles);
 #endif
 
     m_page = makeUnique<Page>(WTFMove(pageConfiguration));

Modified: trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in (268491 => 268492)


--- trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in	2020-10-14 22:13:35 UTC (rev 268491)
+++ trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in	2020-10-14 22:19:18 UTC (rev 268492)
@@ -999,6 +999,7 @@
             "com.apple.containermanagerd"
             "com.apple.diagnosticd"
             "com.apple.iconservices"
+            "com.apple.iconservices.store"
             "com.apple.tccd"
             "com.apple.BluetoothServices"
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to