Title: [265087] trunk/Source/WebKit
- Revision
- 265087
- Author
- pvol...@apple.com
- Date
- 2020-07-30 09:36:29 -0700 (Thu, 30 Jul 2020)
Log Message
Remember to check entitlement before communicating over XPC
https://bugs.webkit.org/show_bug.cgi?id=214825
Reviewed by Brent Fulgham.
Remember to check entitlement before communicating over XPC with another WebKit process. This needs to be done
to make sure that it really is a WebKit process on the other end.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::m_messagePortChannelRegistry):
* Shared/Cocoa/XPCEndpoint.mm:
(WebKit::XPCEndpoint::XPCEndpoint):
* Shared/Cocoa/XPCEndpointClient.mm:
(WebKit::XPCEndpointClient::setEndpoint):
* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::platformDidReceiveLoadParameters):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::handleXPCEndpointMessages const):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (265086 => 265087)
--- trunk/Source/WebKit/ChangeLog 2020-07-30 16:32:51 UTC (rev 265086)
+++ trunk/Source/WebKit/ChangeLog 2020-07-30 16:36:29 UTC (rev 265087)
@@ -1,3 +1,24 @@
+2020-07-30 Per Arne Vollan <pvol...@apple.com>
+
+ Remember to check entitlement before communicating over XPC
+ https://bugs.webkit.org/show_bug.cgi?id=214825
+
+ Reviewed by Brent Fulgham.
+
+ Remember to check entitlement before communicating over XPC with another WebKit process. This needs to be done
+ to make sure that it really is a WebKit process on the other end.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::m_messagePortChannelRegistry):
+ * Shared/Cocoa/XPCEndpoint.mm:
+ (WebKit::XPCEndpoint::XPCEndpoint):
+ * Shared/Cocoa/XPCEndpointClient.mm:
+ (WebKit::XPCEndpointClient::setEndpoint):
+ * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+ (WebKit::WebPage::platformDidReceiveLoadParameters):
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::handleXPCEndpointMessages const):
+
2020-07-30 Kate Cheney <katherine_che...@apple.com>
REGRESSION (r264925): run-safari --debug no longer works
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (265086 => 265087)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2020-07-30 16:32:51 UTC (rev 265086)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2020-07-30 16:36:29 UTC (rev 265087)
@@ -165,7 +165,7 @@
#if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
addSupplement<LegacyCustomProtocolManager>();
#endif
-#if PLATFORM(COCOA)
+#if HAVE(LSDATABASECONTEXT)
addSupplement<LaunchServicesDatabaseObserver>();
#endif
#if PLATFORM(COCOA) && ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
Modified: trunk/Source/WebKit/Shared/Cocoa/XPCEndpoint.mm (265086 => 265087)
--- trunk/Source/WebKit/Shared/Cocoa/XPCEndpoint.mm 2020-07-30 16:32:51 UTC (rev 265086)
+++ trunk/Source/WebKit/Shared/Cocoa/XPCEndpoint.mm 2020-07-30 16:36:29 UTC (rev 265087)
@@ -41,13 +41,11 @@
if (type == XPC_TYPE_CONNECTION) {
OSObjectPtr<xpc_connection_t> connection = message;
- audit_token_t auditToken;
- xpc_connection_get_audit_token(connection.get(), &auditToken);
+ auto pid = xpc_connection_get_pid(connection.get());
- if (!WTF::hasEntitlement(auditToken, "com.apple.private.webkit.use-xpc-endpoint")) {
- // Uncomment before landing; this is commented out because the bots does not seem to update the entitlements on incremental builds.
- // WTFLogAlways("Audit token does not have required entitlement");
- // return;
+ if (pid != getpid() && !WTF::hasEntitlement(connection.get(), "com.apple.private.webkit.use-xpc-endpoint")) {
+ WTFLogAlways("Audit token does not have required entitlement com.apple.private.webkit.use-xpc-endpoint");
+ return;
}
xpc_connection_set_target_queue(connection.get(), dispatch_get_main_queue());
xpc_connection_set_event_handler(connection.get(), ^(xpc_object_t event) {
Modified: trunk/Source/WebKit/Shared/Cocoa/XPCEndpointClient.mm (265086 => 265087)
--- trunk/Source/WebKit/Shared/Cocoa/XPCEndpointClient.mm 2020-07-30 16:32:51 UTC (rev 265086)
+++ trunk/Source/WebKit/Shared/Cocoa/XPCEndpointClient.mm 2020-07-30 16:36:29 UTC (rev 265087)
@@ -56,12 +56,11 @@
auto connection = xpc_dictionary_get_remote_connection(message);
if (!connection)
return;
- audit_token_t auditToken;
- xpc_connection_get_audit_token(connection, &auditToken);
- if (!WTF::hasEntitlement(auditToken, "com.apple.private.webkit.use-xpc-endpoint")) {
- // Uncomment before landing; this is commented out because the bots does not seem to update the entitlements on incremental builds.
- // WTFLogAlways("Audit token does not have required entitlement");
- // return;
+
+ auto pid = xpc_connection_get_pid(connection);
+ if (pid != getpid() && !WTF::hasEntitlement(connection, "com.apple.private.webkit.use-xpc-endpoint")) {
+ WTFLogAlways("Audit token does not have required entitlement com.apple.private.webkit.use-xpc-endpoint");
+ return;
}
handleEvent(message);
});
Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (265086 => 265087)
--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2020-07-30 16:32:51 UTC (rev 265086)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2020-07-30 16:36:29 UTC (rev 265087)
@@ -64,10 +64,12 @@
void WebPage::platformDidReceiveLoadParameters(const LoadParameters& parameters)
{
+#if HAVE(LSDATABASECONTEXT)
bool databaseUpdated = LaunchServicesDatabaseManager::singleton().waitForDatabaseUpdate(5_s);
ASSERT_UNUSED(databaseUpdated, databaseUpdated);
if (!databaseUpdated)
WTFLogAlways("Timed out waiting for Launch Services database update.");
+#endif
m_dataDetectionContext = parameters.dataDetectionContext;
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (265086 => 265087)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-07-30 16:32:51 UTC (rev 265086)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2020-07-30 16:36:29 UTC (rev 265087)
@@ -188,11 +188,13 @@
if (messageName.isEmpty())
return;
+#if HAVE(LSDATABASECONTEXT)
if (messageName == LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseXPCEndpointMessageName) {
auto endpoint = xpc_dictionary_get_value(event, LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseXPCEndpointNameKey);
LaunchServicesDatabaseManager::singleton().setEndpoint(endpoint);
return;
}
+#endif
});
xpc_connection_resume(connection);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes