Title: [269906] trunk/Source
Revision
269906
Author
pvol...@apple.com
Date
2020-11-17 09:21:49 -0800 (Tue, 17 Nov 2020)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (269905 => 269906)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-11-17 17:09:11 UTC (rev 269905)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-11-17 17:21:49 UTC (rev 269906)
@@ -1,3 +1,15 @@
+2020-11-17  Per Arne Vollan  <pvol...@apple.com>
+
+        [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.
+
+        Add typedef for TCC authentication callback.
+
+        * pal/spi/mac/HIServicesSPI.h:
+
 2020-11-17  Kimmo Kinnunen  <kkinnu...@apple.com>
 
         Build fails on internal simulator builds due to missing enum kCVPixelFormatType_AGX_420YpCbCr8BiPlanarVideoRange

Modified: trunk/Source/WebCore/PAL/pal/spi/mac/HIServicesSPI.h (269905 => 269906)


--- trunk/Source/WebCore/PAL/pal/spi/mac/HIServicesSPI.h	2020-11-17 17:09:11 UTC (rev 269905)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/HIServicesSPI.h	2020-11-17 17:21:49 UTC (rev 269906)
@@ -156,4 +156,10 @@
 
 #endif // USE(APPLE_INTERNAL_SDK)
 
+WTF_EXTERN_C_BEGIN
+
+typedef Boolean (*AXAuditTokenIsAuthenticatedCallback)(audit_token_t);
+
+WTF_EXTERN_C_END
+
 #define kAXClientTypeWebKitTesting 999999

Modified: trunk/Source/WebKit/ChangeLog (269905 => 269906)


--- trunk/Source/WebKit/ChangeLog	2020-11-17 17:09:11 UTC (rev 269905)
+++ trunk/Source/WebKit/ChangeLog	2020-11-17 17:21:49 UTC (rev 269906)
@@ -1,3 +1,25 @@
+2020-11-17  Per Arne Vollan  <pvol...@apple.com>
+
+        [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.
+
+        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):
+
 2020-11-17  Brian Burg  <bb...@apple.com>
 
         [Cocoa] _WKInspectorExtensionHost should conform to NSObject protocol

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm (269905 => 269906)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm	2020-11-17 17:09:11 UTC (rev 269905)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm	2020-11-17 17:21:49 UTC (rev 269906)
@@ -49,6 +49,14 @@
 #import <_javascript_Core/RemoteInspectorConstants.h>
 #endif
 
+#if PLATFORM(MAC)
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_PRIVATE_FRAMEWORK(TCC)
+SOFT_LINK(TCC, TCCAccessCheckAuditToken, Boolean, (CFStringRef service, audit_token_t auditToken, CFDictionaryRef options), (service, auditToken, options))
+SOFT_LINK_CONSTANT(TCC, kTCCServiceAccessibility, CFStringRef)
+#endif
+
 namespace WebKit {
 
 static const Seconds unexpectedActivityDuration = 10_s;
@@ -258,4 +266,12 @@
     return overrideLanguages;
 }
 
+#if PLATFORM(MAC)
+void WebProcessProxy::isAXAuthenticated(audit_token_t auditToken, CompletionHandler<void(bool)>&& completionHandler)
+{
+    auto authenticated = TCCAccessCheckAuditToken(getkTCCServiceAccessibility(), auditToken, nullptr);
+    completionHandler(authenticated);
 }
+#endif
+
+}

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (269905 => 269906)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h	2020-11-17 17:09:11 UTC (rev 269905)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h	2020-11-17 17:21:49 UTC (rev 269906)
@@ -508,6 +508,10 @@
 
     void systemBeep();
     
+#if PLATFORM(MAC)
+    void isAXAuthenticated(audit_token_t, CompletionHandler<void(bool)>&&);
+#endif
+
     enum class IsWeak { No, Yes };
     template<typename T> class WeakOrStrongPtr {
     public:

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in (269905 => 269906)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in	2020-11-17 17:09:11 UTC (rev 269905)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in	2020-11-17 17:21:49 UTC (rev 269906)
@@ -88,4 +88,8 @@
     DestroySpeechRecognitionServer(WebCore::PageIdentifier identifier)
 
     SystemBeep()
+    
+#if PLATFORM(MAC)
+    IsAXAuthenticated(audit_token_t auditToken) -> (bool authenticated) Synchronous
+#endif
 }

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (269905 => 269906)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-11-17 17:09:11 UTC (rev 269905)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-11-17 17:21:49 UTC (rev 269906)
@@ -151,6 +151,11 @@
 #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__)
 
+#if PLATFORM(MAC)
+SOFT_LINK_FRAMEWORK_IN_UMBRELLA(ApplicationServices, HIServices)
+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, HIServices, _AXSetAuditTokenIsAuthenticatedCallback, void, (AXAuditTokenIsAuthenticatedCallback callback), (callback))
+#endif
+
 namespace WebKit {
 using namespace WebCore;
 
@@ -174,6 +179,16 @@
 }
 #endif
 
+
+#if PLATFORM(MAC)
+static Boolean isAXAuthenticatedCallback(audit_token_t auditToken)
+{
+    bool authenticated = false;
+    WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebProcessProxy::IsAXAuthenticated(auditToken), Messages::WebProcessProxy::IsAXAuthenticated::Reply(authenticated), 0);
+    return authenticated;
+}
+#endif
+
 void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
 {
     SandboxExtension::consumePermanently(parameters.diagnosticsExtensionHandles);
@@ -361,6 +376,11 @@
     updateProcessName();
     
     SystemSoundManager::singleton().setSystemSoundDelegate(makeUnique<WebSystemSoundDelegate>());
+
+#if PLATFORM(MAC)
+    if (canLoad_HIServices__AXSetAuditTokenIsAuthenticatedCallback())
+        softLink_HIServices__AXSetAuditTokenIsAuthenticatedCallback(isAXAuthenticatedCallback);
+#endif
 }
 
 void WebProcess::platformSetWebsiteDataStoreParameters(WebProcessDataStoreParameters&& parameters)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to