From de017f69ed2a849d9a5a455b2fa1ff764bec8290 Mon Sep 17 00:00:00 2001 From: Erwan Leroy Date: Mon, 11 Sep 2023 11:26:40 -0700 Subject: [PATCH] Ensure execution policy does not contain special chars Signed-off-by: Erwan Leroy --- src/rezplugins/shell/_utils/powershell_base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rezplugins/shell/_utils/powershell_base.py b/src/rezplugins/shell/_utils/powershell_base.py index 43d7f2bb71..96f4241aa2 100644 --- a/src/rezplugins/shell/_utils/powershell_base.py +++ b/src/rezplugins/shell/_utils/powershell_base.py @@ -203,8 +203,9 @@ def _record_shell(ex, files, bind_rez=True, print_msg=False): cmd += ["-NoLogo"] # Powershell execution policy overrides + # Prevent injections/mistakes by ensuring policy value only contains letters. execution_policy = self.settings.execution_policy - if execution_policy: + if execution_policy and execution_policy.isalpha(): cmd += ["-ExecutionPolicy", execution_policy] # Generic form of sourcing that works in powershell and pwsh