⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 263287 in webkit


Ignore:
Timestamp:
Jun 19, 2020, 2:12:16 PM (6 years ago)
Author:
Brent Fulgham
Message:

[iOS, macOS] Allow access to the container manager to support Mail InjectedBundle
https://bugs.webkit.org/show_bug.cgi?id=213357
<rdar://problem/63837247>

Reviewed by Darin Adler.

The Mail Injected Bundle requires access to the container manager to support certain OS operations. We do not need
this access for web browsing, and should limit this access to this one case.

This patch creates a dynamic mach extension to the container manager for this single use case. It also denies the
non-extension access case with a backtrace so we can see if any other clients are hitting this.

  • Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
  • Shared/WebProcessCreationParameters.cpp:

(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):

  • Shared/WebProcessCreationParameters.h:
  • UIProcess/Cocoa/WebProcessPoolCocoa.mm:

(WebKit::WebProcessPool::platformInitializeWebProcess):

  • WebProcess/cocoa/WebProcessCocoa.mm:

(WebKit::WebProcess::platformInitializeWebProcess):

  • WebProcess/com.apple.WebProcess.sb.in:
Location:
trunk/Source/WebKit
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r263285 r263287  
     12020-06-19  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [iOS, macOS] Allow access to the container manager to support Mail InjectedBundle
     4        https://bugs.webkit.org/show_bug.cgi?id=213357
     5        <rdar://problem/63837247>
     6
     7        Reviewed by Darin Adler.
     8
     9        The Mail Injected Bundle requires access to the container manager to support certain OS operations. We do not need
     10        this access for web browsing, and should limit this access to this one case.
     11
     12        This patch creates a dynamic mach extension to the container manager for this single use case. It also denies the
     13        non-extension access case with a backtrace so we can see if any other clients are hitting this.
     14
     15        * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
     16        * Shared/WebProcessCreationParameters.cpp:
     17        (WebKit::WebProcessCreationParameters::encode const):
     18        (WebKit::WebProcessCreationParameters::decode):
     19        * Shared/WebProcessCreationParameters.h:
     20        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     21        (WebKit::WebProcessPool::platformInitializeWebProcess):
     22        * WebProcess/cocoa/WebProcessCocoa.mm:
     23        (WebKit::WebProcess::platformInitializeWebProcess):
     24        * WebProcess/com.apple.WebProcess.sb.in:
     25
    1262020-06-19  Andres Gonzalez  <andresg_22@apple.com>
    227
  • trunk/Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb

    r262860 r263287  
    941941    (with no-log))
    942942
     943(deny mach-lookup (with telemetry-backtrace)
     944    (global-name "com.apple.containermanagerd")
     945)
     946
    943947(allow mach-lookup
    944948    (require-all
     
    947951            "com.apple.cfprefsd.agent"
    948952            "com.apple.cfprefsd.daemon"
     953            "com.apple.containermanagerd"
    949954            "com.apple.diagnosticd"
    950955            "com.apple.iphone.axserver-systemwide"
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp

    r263094 r263287  
    162162#endif
    163163
     164    encoder << containerManagerExtensionHandle;
     165   
    164166#if PLATFORM(IOS_FAMILY)
    165167    encoder << diagnosticsExtensionHandles;
     
    436438#endif
    437439
     440    Optional<Optional<SandboxExtension::Handle>> containerManagerExtensionHandle;
     441    decoder >> containerManagerExtensionHandle;
     442    if (!containerManagerExtensionHandle)
     443        return false;
     444    parameters.containerManagerExtensionHandle = WTFMove(*containerManagerExtensionHandle);
     445
    438446#if PLATFORM(IOS_FAMILY)
    439447    Optional<SandboxExtension::HandleArray> diagnosticsExtensionHandles;
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.h

    r263094 r263287  
    206206#endif
    207207
     208    Optional<SandboxExtension::Handle> containerManagerExtensionHandle;
     209
    208210#if PLATFORM(IOS_FAMILY)
    209211    SandboxExtension::HandleArray diagnosticsExtensionHandles;
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r263061 r263287  
    293293#endif
    294294
     295static bool requiresContainerManagerAccess()
     296{
     297#if PLATFORM(MAC)
     298    return WebCore::MacApplication::isAppleMail();
     299#elif PLATFORM(IOS)
     300    return WebCore::IOSApplication::isMobileMail();
     301#else
     302    return false;
     303#endif
     304}
     305
     306
    295307void WebProcessPool::platformInitializeWebProcess(const WebProcessProxy& process, WebProcessCreationParameters& parameters)
    296308{
     
    440452#endif
    441453   
     454    if (requiresContainerManagerAccess()) {
     455        SandboxExtension::Handle handle;
     456        SandboxExtension::createHandleForMachLookup("com.apple.containermanagerd", WTF::nullopt, handle);
     457        parameters.containerManagerExtensionHandle = WTFMove(handle);
     458    }
     459
    442460#if PLATFORM(IOS_FAMILY)
    443461    parameters.currentUserInterfaceIdiomIsPad = currentUserInterfaceIdiomIsPad();
  • trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

    r262922 r263287  
    284284#endif
    285285
     286    if (parameters.containerManagerExtensionHandle)
     287        SandboxExtension::consumePermanently(*parameters.containerManagerExtensionHandle);
     288   
    286289#if PLATFORM(IOS_FAMILY)
    287290    SandboxExtension::consumePermanently(parameters.diagnosticsExtensionHandles);
  • trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in

    r263061 r263287  
    899899    (with no-log))
    900900
     901#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
     902(deny mach-lookup (with telemetry-backtrace)
     903    (global-name "com.apple.containermanagerd")
     904)
     905#endif
     906
    901907(allow mach-lookup
    902908    (require-all
     
    912918            "com.apple.cfprefsd.agent"
    913919            "com.apple.cfprefsd.daemon"
     920            "com.apple.containermanagerd"
    914921            "com.apple.tccd"
    915922            "com.apple.lsd.mapdb"
Note: See TracChangeset for help on using the changeset viewer.