subprocess module call
- Category
- Dangerous Code Execution
- Confidence
- 96% confidence
- Finding
The script automatically executes
pip install sentence-transformersat runtime when the dependency is missing. This introduces unauthorized code execution and supply-chain risk in a tool whose stated purpose is offline retrieval evaluation, because it changes the host environment and fetches third-party code without explicit user consent.- Content
python import subprocess try: pip_cmd = "pip" if _PINFO.is_windows else "pip3" subprocess.run([pip_cmd, "install", "sentence-transformers"], capture_output=True, check=True, timeout=120) # 安装成功 → 重新导入 from sentence_transformers import SentenceTransformer
