From ef84199f8f54c26525be52c20d0e027a0f91641d Mon Sep 17 00:00:00 2001 From: dualfroz Date: Mon, 12 Oct 2026 19:30:15 +0200 Subject: [PATCH] Reject a non-string execute command with a clear installer error --- lutris/installer/commands.py | 5 +++++ tests/_test_installer.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/lutris/installer/commands.py b/lutris/installer/commands.py index ac022f7..99d91fa 100644 --- a/lutris/installer/commands.py +++ b/lutris/installer/commands.py @@ -119,6 +119,11 @@ class CommandsMixin: exec_path = data.get("file", "") command = data.get("command", "") + if not isinstance(command, str): + raise ScriptingError( + _("The command parameter of the execute command must be a string"), + faulty_data=data, + ) args_string = data.get("args", "") for arg in shlex.split(args_string): args.append(self._substitute(arg)) diff --git a/tests/_test_installer.py b/tests/_test_installer.py index ca9454c..52e6ec3 100644 --- a/tests/_test_installer.py +++ b/tests/_test_installer.py @@ -78,6 +78,12 @@ class TestScriptInterpreter(TestCase): interpreter._map_command({"_substitute": "foo"}) self.assertEqual(ex.exception.message, 'The command "substitute" does not exist.') + def test_execute_rejects_a_command_that_is_not_a_string(self): + interpreter = MockInterpreter(TEST_INSTALLER, None) + with self.assertRaises(ScriptingError) as ex: + interpreter.execute({"command": [["pwd"]]}) + self.assertEqual(ex.exception.message, "The command parameter of the execute command must be a string") + def test_prepare_game_files_resolves_moddb_url(self): moddb_url = "https://www.moddb.com/downloads/test-file" mirror_url = "https://www.moddb.com/downloads/mirror/test-file"