fix(security): replace shell=True subprocess calls with list args (B602)

- factor.py: check_output([python_bin, path]) instead of shell string
- env.py QlibCondaEnv: all four conda commands use list args

Shell=True with a constructed string allows shell injection if
python_bin or path contain shell metacharacters.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
TPTBusiness
2026-04-30 09:34:41 +02:00
parent 3823efa057
commit c2a50feb56
2 changed files with 8 additions and 11 deletions
@@ -161,8 +161,7 @@ class FactorFBWorkspace(FBWorkspace):
try:
subprocess.check_output(
f"{FACTOR_COSTEER_SETTINGS.python_bin} {execution_code_path}",
shell=True,
[FACTOR_COSTEER_SETTINGS.python_bin, str(execution_code_path)],
cwd=self.workspace_path,
stderr=subprocess.STDOUT,
timeout=FACTOR_COSTEER_SETTINGS.file_based_execution_timeout,