summaryrefslogtreecommitdiff
path: root/src/nautilus-directory-async.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2017-02-06 18:47:54 +0100
committerCarlos Soriano <csoriano@gnome.org>2017-02-06 18:53:08 +0100
commit1630f53481f445ada0a455e9979236d31a8d3bb0 (patch)
treeb578cab6a04fe6abbe75775fb78fd2e872d35276 /src/nautilus-directory-async.c
parentcc6910ff6511a5a2939cf36a49ca81fb62005382 (diff)
downloadnautilus-1630f53481f445ada0a455e9979236d31a8d3bb0.tar.gz
mime-actions: use file metadata for trusting desktop files
Currently we only trust desktop files that have the executable bit set, and don't replace the displayed icon or the displayed name until it's trusted, which prevents for running random programs by a malicious desktop file. However, the executable permission is preserved if the desktop file comes from a compressed file. To prevent this, add a metadata::trusted metadata to the file once the user acknowledges the file as trusted. This adds metadata to the file, which cannot be added unless it has access to the computer. Also remove the SHEBANG "trusted" content we were putting inside the desktop file, since that doesn't add more security since it can come with the file itself. https://bugzilla.gnome.org/show_bug.cgi?id=777991
Diffstat (limited to 'src/nautilus-directory-async.c')
-rw-r--r--src/nautilus-directory-async.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nautilus-directory-async.c b/src/nautilus-directory-async.c
index e8a10cd3b..b02e3de87 100644
--- a/src/nautilus-directory-async.c
+++ b/src/nautilus-directory-async.c
@@ -30,6 +30,7 @@
#include "nautilus-global-preferences.h"
#include "nautilus-link.h"
#include "nautilus-profile.h"
+#include "nautilus-metadata.h"
#include <eel/eel-glib-extensions.h>
#include <gtk/gtk.h>
#include <libxml/parser.h>
@@ -3580,13 +3581,17 @@ is_link_trusted (NautilusFile *file,
{
GFile *location;
gboolean res;
+ g_autofree gchar* trusted = NULL;
if (!is_launcher)
{
return TRUE;
}
- if (nautilus_file_can_execute (file))
+ trusted = nautilus_file_get_metadata (file,
+ NAUTILUS_METADATA_KEY_DESKTOP_FILE_TRUSTED,
+ NULL);
+ if (nautilus_file_can_execute (file) && trusted != NULL)
{
return TRUE;
}