[tracker/wip/carlosg/portal: 44/47] portal: Handle missing .flatpak-info file



commit 59ed6b4d3c7ce9571e50a969f593c102dfa1b56c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jan 24 17:59:40 2020 +0100

    portal: Handle missing .flatpak-info file
    
    The helper function may return NULL keyfile and no error if the
    .flatpak-info file does not exist.
    
    If that is the case, there is good chance we are talking with a
    client outside a sandbox. Still be overly restrictive and allow
    access to an empty set of graphs, the client shouldn't be talking
    to the portal in that case.

 src/portal/tracker-portal.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/portal/tracker-portal.c b/src/portal/tracker-portal.c
index 08a9234a7..02098756c 100644
--- a/src/portal/tracker-portal.c
+++ b/src/portal/tracker-portal.c
@@ -200,13 +200,23 @@ load_client_configuration (GDBusMethodInvocation  *invocation,
                            GError                **error)
 {
        g_autoptr (GKeyFile) flatpak_info = NULL;
+       GError *inner_error = NULL;
        GStrv graphs;
 
        flatpak_info = tracker_invocation_lookup_app_info_sync (invocation,
-                                                               NULL, error);
+                                                               NULL, &inner_error);
        if (!flatpak_info) {
-               g_debug ("No .flatpak-info found, forbidden access.");
-               return NULL;
+               GStrv default_graphs = { NULL };
+
+               if (inner_error) {
+                       g_warning ("Error reading .flatpak-info.");
+                       g_propagate_error (error, inner_error);
+                       return NULL;
+               }
+
+               g_debug ("No .flatpak-info found, peer is not sandboxed");
+               /* Still, fishy. Allow access to no graphs */
+               return g_strdupv (default_graphs);
        }
 
        graphs = g_key_file_get_string_list (flatpak_info,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]