subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def run_command(cmd): """执行 shell 命令并返回结果""" try: result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=30) return result.stdout.strip() except Exception as e: return f"Error: {e}"- Confidence
- 97% confidence
- Finding
- The code executes shell commands through subprocess.run with shell=True, which is inherently dangerous because it invokes a shell interpreter and expands metacharacters, redirects, and other shell syntax. In this file the current call sites use hardcoded curl commands, but the helper is generic and enables arbitrary command execution if reused with user-controlled input later, which is unjustified for a market-reporting skill.
