Changeset 261387 in webkit


Ignore:
Timestamp:
May 8, 2020 9:33:21 AM (4 years ago)
Author:
pvollan@apple.com
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):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/PAL/ChangeLog

    r261320 r261387  
     12020-05-08  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [Cocoa] Close connections to Launch Services after revoking extension
     4        https://bugs.webkit.org/show_bug.cgi?id=211594
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Declare _LSDService class.
     9
     10        * pal/spi/cocoa/LaunchServicesSPI.h:
     11
    1122020-05-07  Darin Adler  <darin@apple.com>
    213
  • trunk/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h

    r260366 r261387  
    8686#endif // !USE(APPLE_INTERNAL_SDK)
    8787
     88@interface _LSDService : NSObject <NSXPCListenerDelegate>
     89+ (NSArray<Class> *)allServiceClasses;
     90+ (NSXPCConnection *)XPCConnectionToService;
     91@end
     92
    8893#if PLATFORM(MAC)
    8994
  • trunk/Source/WebKit/ChangeLog

    r261375 r261387  
     12020-05-08  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [Cocoa] Close connections to Launch Services after revoking extension
     4        https://bugs.webkit.org/show_bug.cgi?id=211594
     5
     6        Reviewed by Brent Fulgham.
     7
     8        In <https://trac.webkit.org/changeset/258915/webkit>, connections to the Launch Services database mapping
     9        services were denied, by creating a temporary extension. After revoking this extension in the WebContent
     10        process, it is important to close any open connections to Launch Services initiated by the mapping.
     11
     12        No new tests, covered by existing UTI/MIME type tests.
     13
     14        * WebProcess/cocoa/WebProcessCocoa.mm:
     15        (WebKit::WebProcess::platformInitializeWebProcess):
     16
    1172020-05-08  Youenn Fablet  <youenn@apple.com>
    218
  • trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

    r261296 r261387  
    8787#import <wtf/FileSystem.h>
    8888#import <wtf/ProcessPrivilege.h>
     89#import <wtf/SoftLinking.h>
    8990#import <wtf/cocoa/NSURLExtras.h>
    9091#import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
     
    135136#import <os/state_private.h>
    136137#endif
     138
     139SOFT_LINK_FRAMEWORK(CoreServices)
     140SOFT_LINK_CLASS(CoreServices, _LSDService)
     141SOFT_LINK_CLASS(CoreServices, _LSDOpenService)
    137142
    138143#define RELEASE_LOG_SESSION_ID (m_sessionID ? m_sessionID->toUInt64() : 0)
     
    204209        ok = extension->revoke();
    205210        ASSERT_UNUSED(ok, ok);
     211
     212        auto services = [get_LSDServiceClass() allServiceClasses];
     213        for (Class cls in services) {
     214            auto connection = [cls XPCConnectionToService];
     215            [connection invalidate];
     216        }
     217
     218        ASSERT(String(uti.get()) = String(adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, CFSTR("text/html"), 0)).get()));
    206219    }
    207220
Note: See TracChangeset for help on using the changeset viewer.