subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
script = os.path.join(GS_SCRIPTS_DIR, "gs_stock_market_query.py") try: result = subprocess.run( ["python3", script, "single_hq", "--code", symbol, "--set_code", str(set_code)], capture_output=True, text=True, timeout=20, env={**os.environ}- Confidence
- 91% confidence
- Finding
- This code executes a local Python script from a user-writable path under the home directory and passes through the full inherited environment. While it avoids shell injection by using an argument list, it still creates a code-execution trust boundary: if the referenced script or environment is tampered with, running this adapter will execute attacker-controlled code with the user's privileges.
