[gnome-builder] libide/foundry: ignore commands that cannot be default



commit 2d1031c9892a8502f164c3995f3ab52f200ca1b3
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jul 19 16:43:07 2022 -0700

    libide/foundry: ignore commands that cannot be default
    
    Make sure we ignore commands that do not have "can-default" set to TRUE so
    that we don't accidentally run a shellcmd that could be wiping out user
    data or something like that.

 src/libide/foundry/ide-run-manager.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/libide/foundry/ide-run-manager.c b/src/libide/foundry/ide-run-manager.c
index 5fa23e1ae..232d44b80 100644
--- a/src/libide/foundry/ide-run-manager.c
+++ b/src/libide/foundry/ide-run-manager.c
@@ -1536,6 +1536,14 @@ ide_run_manager_discover_run_command_cb (GObject      *object,
           IDE_EXIT;
         }
 
+      /* Don't allow using this as a default/fallback unless the command
+       * is explicitely marked as capable of that. Otherwise, we risk things
+       * like a "destroy my hard drive" commands in shellcmd being run as
+       * the default run command.
+       */
+      if (!ide_run_command_get_can_default (run_command))
+        continue;
+
       if (best == NULL || priority < best_priority)
         {
           g_set_object (&best, run_command);


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