Changeset 269906 in webkit


Ignore:
Timestamp:
Nov 17, 2020 9:21:49 AM (3 years ago)
Author:
pvollan@apple.com
Message:

[macOS] Perform AX TCC check in the UI process
https://bugs.webkit.org/show_bug.cgi?id=218870
<rdar://problem/71339830>

Reviewed by Brent Fulgham.

Source/WebCore/PAL:

Add typedef for TCC authentication callback.

  • pal/spi/mac/HIServicesSPI.h:

Source/WebKit:

On behalf of the WebContent process, perform AX TCC check in the UI process on macOS.
This is in preparation of blocking tccd in the WebContent process.

No new tests. It has been manually tested that the WebContent process is allowing VoiceOver
to perform AX requests with this patch.

  • UIProcess/Cocoa/WebProcessProxyCocoa.mm:

(WebKit::WebProcessProxy::isAXAuthenticated):

  • UIProcess/WebProcessProxy.h:
  • UIProcess/WebProcessProxy.messages.in:
  • WebProcess/cocoa/WebProcessCocoa.mm:

(WebKit::isAXAuthenticatedCallback):
(WebKit::WebProcess::platformInitializeWebProcess):

Location:
trunk/Source
Files:
7 edited

Legend:

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

    r269900 r269906  
     12020-11-17  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [macOS] Perform AX TCC check in the UI process
     4        https://bugs.webkit.org/show_bug.cgi?id=218870
     5        <rdar://problem/71339830>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Add typedef for TCC authentication callback.
     10
     11        * pal/spi/mac/HIServicesSPI.h:
     12
    1132020-11-17  Kimmo Kinnunen  <kkinnunen@apple.com>
    214
  • trunk/Source/WebCore/PAL/pal/spi/mac/HIServicesSPI.h

    r265996 r269906  
    157157#endif // USE(APPLE_INTERNAL_SDK)
    158158
     159WTF_EXTERN_C_BEGIN
     160
     161typedef Boolean (*AXAuditTokenIsAuthenticatedCallback)(audit_token_t);
     162
     163WTF_EXTERN_C_END
     164
    159165#define kAXClientTypeWebKitTesting 999999
  • trunk/Source/WebKit/ChangeLog

    r269905 r269906  
     12020-11-17  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [macOS] Perform AX TCC check in the UI process
     4        https://bugs.webkit.org/show_bug.cgi?id=218870
     5        <rdar://problem/71339830>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        On behalf of the WebContent process, perform AX TCC check in the UI process on macOS.
     10        This is in preparation of blocking tccd in the WebContent process.
     11
     12        No new tests. It has been manually tested that the WebContent process is allowing VoiceOver
     13        to perform AX requests with this patch.
     14
     15        * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
     16        (WebKit::WebProcessProxy::isAXAuthenticated):
     17        * UIProcess/WebProcessProxy.h:
     18        * UIProcess/WebProcessProxy.messages.in:
     19        * WebProcess/cocoa/WebProcessCocoa.mm:
     20        (WebKit::isAXAuthenticatedCallback):
     21        (WebKit::WebProcess::platformInitializeWebProcess):
     22
    1232020-11-17  Brian Burg  <bburg@apple.com>
    224
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm

    r269810 r269906  
    5050#endif
    5151
     52#if PLATFORM(MAC)
     53#import <wtf/SoftLinking.h>
     54
     55SOFT_LINK_PRIVATE_FRAMEWORK(TCC)
     56SOFT_LINK(TCC, TCCAccessCheckAuditToken, Boolean, (CFStringRef service, audit_token_t auditToken, CFDictionaryRef options), (service, auditToken, options))
     57SOFT_LINK_CONSTANT(TCC, kTCCServiceAccessibility, CFStringRef)
     58#endif
     59
    5260namespace WebKit {
    5361
     
    259267}
    260268
    261 }
     269#if PLATFORM(MAC)
     270void WebProcessProxy::isAXAuthenticated(audit_token_t auditToken, CompletionHandler<void(bool)>&& completionHandler)
     271{
     272    auto authenticated = TCCAccessCheckAuditToken(getkTCCServiceAccessibility(), auditToken, nullptr);
     273    completionHandler(authenticated);
     274}
     275#endif
     276
     277}
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.h

    r269785 r269906  
    509509    void systemBeep();
    510510   
     511#if PLATFORM(MAC)
     512    void isAXAuthenticated(audit_token_t, CompletionHandler<void(bool)>&&);
     513#endif
     514
    511515    enum class IsWeak { No, Yes };
    512516    template<typename T> class WeakOrStrongPtr {
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in

    r269785 r269906  
    8989
    9090    SystemBeep()
     91   
     92#if PLATFORM(MAC)
     93    IsAXAuthenticated(audit_token_t auditToken) -> (bool authenticated) Synchronous
     94#endif
    9195}
  • trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

    r269647 r269906  
    152152#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__)
    153153
     154#if PLATFORM(MAC)
     155SOFT_LINK_FRAMEWORK_IN_UMBRELLA(ApplicationServices, HIServices)
     156SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, HIServices, _AXSetAuditTokenIsAuthenticatedCallback, void, (AXAuditTokenIsAuthenticatedCallback callback), (callback))
     157#endif
     158
    154159namespace WebKit {
    155160using namespace WebCore;
     
    172177
    173178    return [page->accessibilityRemoteObject() accessibilityFocusedUIElement];
     179}
     180#endif
     181
     182
     183#if PLATFORM(MAC)
     184static Boolean isAXAuthenticatedCallback(audit_token_t auditToken)
     185{
     186    bool authenticated = false;
     187    WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebProcessProxy::IsAXAuthenticated(auditToken), Messages::WebProcessProxy::IsAXAuthenticated::Reply(authenticated), 0);
     188    return authenticated;
    174189}
    175190#endif
     
    362377   
    363378    SystemSoundManager::singleton().setSystemSoundDelegate(makeUnique<WebSystemSoundDelegate>());
     379
     380#if PLATFORM(MAC)
     381    if (canLoad_HIServices__AXSetAuditTokenIsAuthenticatedCallback())
     382        softLink_HIServices__AXSetAuditTokenIsAuthenticatedCallback(isAXAuthenticatedCallback);
     383#endif
    364384}
    365385
Note: See TracChangeset for help on using the changeset viewer.