subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
from tencentcloud.hunyuan.v20230901 import hunyuan_client, models # noqa: F401 except (ImportError, ModuleNotFoundError): print("[INFO] tencentcloud-sdk-python-hunyuan 未安装,正在安装...", file=sys.stderr) subprocess.check_call( [sys.executable, "-m", "pip", "install", "tencentcloud-sdk-python-hunyuan", "-q"], stdout=sys.stderr, stderr=sys.stderr,- Confidence
- 95% confidence
- Finding
- The code automatically invokes pip at runtime to install a package when the import is missing. Even though the command is hardcoded and does not use shell interpolation, this still expands the file's capabilities from an API wrapper into environment modification and code acquisition from package indexes, which can introduce supply-chain risk and unexpected execution in privileged or production contexts.
