Title: [261387] trunk/Source
Revision
261387
Author
[email protected]
Date
2020-05-08 09:33:21 -0700 (Fri, 08 May 2020)

Log Message

[Cocoa] Close connections to Launch Services after revoking extension
https://bugs.webkit.org/show_bug.cgi?id=211594

Reviewed by Brent Fulgham.

Source/WebCore/PAL:

Declare _LSDService class.

* pal/spi/cocoa/LaunchServicesSPI.h:

Source/WebKit:

In <https://trac.webkit.org/changeset/258915/webkit>, connections to the Launch Services database mapping
services were denied, by creating a temporary extension. After revoking this extension in the WebContent
process, it is important to close any open connections to Launch Services initiated by the mapping.

No new tests, covered by existing UTI/MIME type tests.

* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (261386 => 261387)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-05-08 16:23:22 UTC (rev 261386)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-05-08 16:33:21 UTC (rev 261387)
@@ -1,3 +1,14 @@
+2020-05-08  Per Arne Vollan  <[email protected]>
+
+        [Cocoa] Close connections to Launch Services after revoking extension
+        https://bugs.webkit.org/show_bug.cgi?id=211594
+
+        Reviewed by Brent Fulgham.
+
+        Declare _LSDService class.
+
+        * pal/spi/cocoa/LaunchServicesSPI.h:
+
 2020-05-07  Darin Adler  <[email protected]>
 
         Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h (261386 => 261387)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h	2020-05-08 16:23:22 UTC (rev 261386)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h	2020-05-08 16:33:21 UTC (rev 261387)
@@ -85,6 +85,11 @@
 
 #endif // !USE(APPLE_INTERNAL_SDK)
 
+@interface _LSDService : NSObject <NSXPCListenerDelegate>
++ (NSArray<Class> *)allServiceClasses;
++ (NSXPCConnection *)XPCConnectionToService;
+@end
+
 #if PLATFORM(MAC)
 
 typedef const struct CF_BRIDGED_TYPE(id) __LSASN* LSASNRef;

Modified: trunk/Source/WebKit/ChangeLog (261386 => 261387)


--- trunk/Source/WebKit/ChangeLog	2020-05-08 16:23:22 UTC (rev 261386)
+++ trunk/Source/WebKit/ChangeLog	2020-05-08 16:33:21 UTC (rev 261387)
@@ -1,3 +1,19 @@
+2020-05-08  Per Arne Vollan  <[email protected]>
+
+        [Cocoa] Close connections to Launch Services after revoking extension
+        https://bugs.webkit.org/show_bug.cgi?id=211594
+
+        Reviewed by Brent Fulgham.
+
+        In <https://trac.webkit.org/changeset/258915/webkit>, connections to the Launch Services database mapping
+        services were denied, by creating a temporary extension. After revoking this extension in the WebContent
+        process, it is important to close any open connections to Launch Services initiated by the mapping.
+
+        No new tests, covered by existing UTI/MIME type tests.
+
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+
 2020-05-08  Youenn Fablet  <[email protected]>
 
         Handle remote audio capture IPC messages in a background thread

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (261386 => 261387)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-05-08 16:23:22 UTC (rev 261386)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-05-08 16:33:21 UTC (rev 261387)
@@ -86,6 +86,7 @@
 #import <stdio.h>
 #import <wtf/FileSystem.h>
 #import <wtf/ProcessPrivilege.h>
+#import <wtf/SoftLinking.h>
 #import <wtf/cocoa/NSURLExtras.h>
 #import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
 #import <wtf/cocoa/VectorCocoa.h>
@@ -135,6 +136,10 @@
 #import <os/state_private.h>
 #endif
 
+SOFT_LINK_FRAMEWORK(CoreServices)
+SOFT_LINK_CLASS(CoreServices, _LSDService)
+SOFT_LINK_CLASS(CoreServices, _LSDOpenService)
+
 #define RELEASE_LOG_SESSION_ID (m_sessionID ? m_sessionID->toUInt64() : 0)
 #define RELEASE_LOG_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), channel, "%p - [sessionID=%" PRIu64 "] WebProcess::" fmt, this, RELEASE_LOG_SESSION_ID, ##__VA_ARGS__)
 #define RELEASE_LOG_ERROR_IF_ALLOWED(channel, fmt, ...) RELEASE_LOG_ERROR_IF(isAlwaysOnLoggingAllowed(), channel, "%p - [sessionID=%" PRIu64 "] WebProcess::" fmt, this, RELEASE_LOG_SESSION_ID, ##__VA_ARGS__)
@@ -203,6 +208,14 @@
         auto uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, CFSTR("text/html"), 0));
         ok = extension->revoke();
         ASSERT_UNUSED(ok, ok);
+
+        auto services = [get_LSDServiceClass() allServiceClasses];
+        for (Class cls in services) {
+            auto connection = [cls XPCConnectionToService];
+            [connection invalidate];
+        }
+
+        ASSERT(String(uti.get()) = String(adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, CFSTR("text/html"), 0)).get()));
     }
 
 #if PLATFORM(IOS_FAMILY)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to