From e426b7726ba56b33415c622c62fa074b0f26c844 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 2 May 2018 15:31:20 +0200 Subject: [PATCH] service-client: Verify 'DesktopId' against Flatpak ID And refuse to serve applications that have different values for both. This makes it easier to detect applications which would lie about their IDs when run outside Flatpak, as well as making sure that settings are shared for Flatpak'ed and non-Flatpak'ed versions of the application. https://bugs.freedesktop.org/show_bug.cgi?id=97776 --- src/gclue-service-client.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gclue-service-client.c b/src/gclue-service-client.c index d7b3626..48fb821 100644 --- a/src/gclue-service-client.c +++ b/src/gclue-service-client.c @@ -541,6 +541,17 @@ gclue_service_client_handle_start (GClueDBusClient *client, "'DesktopId' property must be set"); return TRUE; } + } else { + const char *property; + + property = gclue_dbus_client_get_desktop_id (client); + if (property != NULL && g_strcmp0 (property, desktop_id) != 0) { + g_dbus_method_invocation_return_error_literal (invocation, + G_DBUS_ERROR, + G_DBUS_ERROR_ACCESS_DENIED, + "'DesktopId' property does not match Flatpak information"); + return TRUE; + } } config = gclue_config_get_singleton (); -- 2.17.0