From f25eb446873cfb2adb2d2b3e4efc22cc418fbf97 Mon Sep 17 00:00:00 2001 From: FailSafe Researcher Date: Tue, 9 Jun 2026 20:22:32 -0700 Subject: [PATCH 1/2] fix: Disable shell=True in agent process launcher to prevent command injection subprocess.Popen() was called with shell=True and a command string that may include user-influenced values. This allows command injection via shell metacharacters (e.g. semicolons, pipes). Replace with shlex.split() + shell=False so the OS executes the binary directly without invoking a shell interpreter. Fixes: OS command injection in agent_flow/utils/agent_manager.py line 198 Signed-off-by: FailSafe Researcher --- python_a2a/agent_flow/utils/agent_manager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python_a2a/agent_flow/utils/agent_manager.py b/python_a2a/agent_flow/utils/agent_manager.py index 454aa21..9e283de 100644 --- a/python_a2a/agent_flow/utils/agent_manager.py +++ b/python_a2a/agent_flow/utils/agent_manager.py @@ -193,9 +193,10 @@ def start_agent_server( logger.info(f"Starting agent server with command: {command}") # Start the server process + import shlex as _shlex process = subprocess.Popen( - command, - shell=True, + _shlex.split(command) if isinstance(command, str) else command, + shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True From e2809f88dbded9ac402561cb3868c8eb8b56cdfb Mon Sep 17 00:00:00 2001 From: FailSafe Researcher Date: Tue, 9 Jun 2026 20:22:32 -0700 Subject: [PATCH 2/2] fix: move shlex import to module level in agent_manager Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: FailSafe Researcher --- python_a2a/agent_flow/utils/agent_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python_a2a/agent_flow/utils/agent_manager.py b/python_a2a/agent_flow/utils/agent_manager.py index 9e283de..68504bb 100644 --- a/python_a2a/agent_flow/utils/agent_manager.py +++ b/python_a2a/agent_flow/utils/agent_manager.py @@ -6,6 +6,7 @@ """ import os +import shlex import time import json import logging @@ -193,9 +194,8 @@ def start_agent_server( logger.info(f"Starting agent server with command: {command}") # Start the server process - import shlex as _shlex process = subprocess.Popen( - _shlex.split(command) if isinstance(command, str) else command, + shlex.split(command) if isinstance(command, str) else command, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE,