T08 · Insecure Dependencies
Error
- Location
- __main__.py:70
- Finding
- Automatic Installation and Execution of an Unpinned Third-Party Package## Vulnerability Details **File Location**: `__main__.py:70-74`, `tui.py:186-189`, `openclaw_setup.py:15-51` **Vulnerability Type**: Unpinned dependency retrieval and automatic execution **Risk Level**: High ### Vulnerable Code ```python # __main__.py:70-74 # --- Always reinstall openclaw (unless user explicitly opted out via flag) --- if setup_openclaw or not skip_verify: # Default behavior: reinstall openclaw at the end print("Reinstalling openclaw (npm i -g openclaw)...", file=sys.stderr) setup_result = install_openclaw_and_onboard(out_root) ``` ```python # openclaw_setup.py:15-35 def install_openclaw_global() -> Tuple[bool, str]: """ Run npm i -g openclaw. Returns (success, message). Uses shell=True so npm is found via the same PATH as the user's terminal (macOS/Linux). """ try: r = subprocess.run( "npm install -g openclaw", capture_output=True, text=True, timeout=120, shell=True, ) if r.returncode != 0: return False, r.stderr or r.stdout or f"npm exit code {r.returncode}" return True, "openclaw installed globally" except FileNotFoundError: return False, "npm not found; ensure Node.js is installed" except subprocess.TimeoutExpired: return False, "npm install timed out" except Exception as e: return False, str(e) ``` ```python # openclaw_setup.py:40-60 def run_openclaw_onboard(target_dir: Path) -> Tuple[bool, str]: """ Run openclaw onboard with cwd=target_dir. Returns (success, message). Uses shell=True so openclaw is found via PATH (e.g. /usr/local/bin on macOS). """ try: r = subprocess.run( "openclaw onboard", cwd=str(target_dir), capture_output=True, text=True, timeout=60, shell=True ...[truncated 2761 chars]
- Remediation
- ## Remediation Suggestions - Make setup strictly opt-in: ```python if setup_openclaw: setup_result = install_openclaw_and_onboard(out_root) ``` - Add a separate, default-deny confirmation before both global installation and onboarding. - Pin an explicitly approved package version, such as `openclaw@X.Y.Z`. - Validate package provenance and integrity before execution. - Use a project-local or isolated installation rather than a global installation where feasible. - Execute commands without a shell: ```python subprocess.run( ["npm", "install", "-g", "openclaw@X.Y.Z"], shell=False, check=False, ... ) ``` - Resolve the expected executable explicitly rather than relying on arbitrary `PATH` lookup. - Do not run onboarding until the user has reviewed which files and credentials will be accessible to it.
