Tainted flow: 'clean_env' from os.environ.get (line 108, credential/environment) → subprocess.run (code execution)
Medium
- Category
- Data Flow
- Content
clean_env["PATH"] = f"{venv}/bin:{clean_env['PATH']}" try: proc = subprocess.run( [sys.executable, str(script_path)], capture_output=True, text=True, timeout=timeout, cwd=tmpdir, env=clean_env,- Confidence
- 88% confidence
- Finding
- The code advertises a clean execution environment for untrusted user scripts, but it forwards host-derived PATH and optionally VIRTUAL_ENV into the child process. That leaks execution context from the parent and can let the untrusted subprocess resolve binaries and Python environment details from the host, weakening isolation and potentially exposing sensitive path structure or enabling misuse of inherited tooling.
