Skip to content

Commit

Permalink
[Catalyst] Block tccd access
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=269570
rdar://123085704

Reviewed by Brent Fulgham.

In order to block tccd in the WebContent process on Catalyst, we can make use of an existing technique
to route the tccd access via the UI process. This has been enabled on macOS for a long time.

* Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Source/WebKit/UIProcess/WebProcessProxy.messages.in:
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
* Source/WebKit/WebProcess/com.apple.WebProcess.sb.in:

Canonical link: https://commits.webkit.org/274908@main
  • Loading branch information
pvollan committed Feb 17, 2024
1 parent 804c640 commit a9bbd04
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#import "WindowServerConnection.h"
#endif

#if PLATFORM(MAC)
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
#import "TCCSoftLink.h"
#endif

Expand Down Expand Up @@ -246,7 +246,7 @@ bool shouldTransformObject(id object) const override
m_hasSentMessageToUnblockAccessibilityServer = true;
}

#if PLATFORM(MAC)
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
void WebProcessProxy::isAXAuthenticated(CoreIPCAuditToken&& auditToken, CompletionHandler<void(bool)>&& completionHandler)
{
auto authenticated = TCCAccessCheckAuditToken(get_TCC_kTCCServiceAccessibility(), auditToken.auditToken(), nullptr);
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/WebProcessProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ class WebProcessProxy : public AuxiliaryProcessProxy {

void systemBeep();

#if PLATFORM(MAC)
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
void isAXAuthenticated(CoreIPCAuditToken&&, CompletionHandler<void(bool)>&&);
#endif

Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/WebProcessProxy.messages.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ messages -> WebProcessProxy LegacyReceiver {

SystemBeep()

#if PLATFORM(MAC)
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
IsAXAuthenticated(struct WebKit::CoreIPCAuditToken auditToken) -> (bool authenticated) Synchronous
#endif

Expand Down
11 changes: 7 additions & 4 deletions Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,13 @@
#import <WebCore/DisplayConfigurationMonitor.h>
#import <WebCore/ScrollbarThemeMac.h>
#import <pal/spi/cf/CoreTextSPI.h>
#import <pal/spi/mac/HIServicesSPI.h>
#import <pal/spi/mac/NSScrollerImpSPI.h>
#endif

#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
#import <pal/spi/mac/HIServicesSPI.h>
#endif

#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
#import "WebCaptionPreferencesDelegate.h"
#import <WebCore/CaptionUserPreferencesMediaAF.h>
Expand Down Expand Up @@ -196,7 +199,7 @@ - (id)safeValueForKey:(NSString *)key;
#define WEBPROCESS_RELEASE_LOG(channel, fmt, ...) RELEASE_LOG(channel, "%p - [sessionID=%" PRIu64 "] WebProcess::" fmt, this, RELEASE_LOG_SESSION_ID, ##__VA_ARGS__)
#define WEBPROCESS_RELEASE_LOG_ERROR(channel, fmt, ...) RELEASE_LOG_ERROR(channel, "%p - [sessionID=%" PRIu64 "] WebProcess::" fmt, this, RELEASE_LOG_SESSION_ID, ##__VA_ARGS__)

#if PLATFORM(MAC)
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
SOFT_LINK_FRAMEWORK_IN_UMBRELLA(ApplicationServices, HIServices)
SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebKit, HIServices, _AXSetAuditTokenIsAuthenticatedCallback, void, (AXAuditTokenIsAuthenticatedCallback callback), (callback))
#endif
Expand Down Expand Up @@ -268,7 +271,7 @@ static void preventAppKitFromContactingLaunchServices(NSApplication*, SEL)
#endif
#endif

#if PLATFORM(MAC)
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
static Boolean isAXAuthenticatedCallback(audit_token_t auditToken)
{
bool authenticated = false;
Expand Down Expand Up @@ -550,7 +553,7 @@ static void setVideoDecoderBehaviors(OptionSet<VideoDecoderBehavior> videoDecode
WebCore::CaptionUserPreferencesMediaAF::setCaptionPreferencesDelegate(makeUnique<WebCaptionPreferencesDelegate>());
#endif

#if PLATFORM(MAC)
#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
if (canLoad_HIServices__AXSetAuditTokenIsAuthenticatedCallback())
softLink_HIServices__AXSetAuditTokenIsAuthenticatedCallback(isAXAuthenticatedCallback);
#endif
Expand Down
5 changes: 0 additions & 5 deletions Source/WebKit/WebProcess/com.apple.WebProcess.sb.in
Original file line number Diff line number Diff line change
Expand Up @@ -1323,13 +1323,8 @@
)
#endif

#if PLATFORM(MAC)
(deny mach-lookup (with no-report)
(global-name "com.apple.tccd.system"))
#else
(allow mach-lookup
(global-name "com.apple.tccd.system"))
#endif

(allow mach-lookup
(require-all
Expand Down

0 comments on commit a9bbd04

Please sign in to comment.