T08 · Insecure Dependencies
Warning
- Location
- scripts/youtube-upload.py:22
- Finding
- Automatic Installation of Unpinned Third-Party Dependencies<![CDATA[ ## Vulnerability Details **File Location**: `scripts/youtube-upload.py:22-62` **Vulnerability Type**: Supply-chain exposure through unpinned runtime dependency installation **Risk Level**: Medium ### Vulnerable Code ```python REQUIRED_PACKAGES = [ ("googleapiclient", "google-api-python-client"), ("google_auth_oauthlib", "google-auth-oauthlib"), ("google.auth.transport.requests", "google-auth-httplib2"), ] VENV_DIR = Path.home() / ".openclaw" / "youtube" / ".venv" def _in_venv() -> bool: """Check if running inside our dedicated venv.""" return any(str(VENV_DIR) in p for p in sys.path) def ensure_dependencies(): """Install missing Google API packages into a dedicated venv.""" venv_python = VENV_DIR / "bin" / "python3" # If running outside the venv and it exists, re-exec into it directly if venv_python.exists() and not _in_venv(): os.execv(str(venv_python), [str(venv_python), *sys.argv]) # Check if imports are available missing = [] for module_name, pip_name in REQUIRED_PACKAGES: try: __import__(module_name) except ImportError: missing.append(pip_name) if not missing: return # Create venv if needed (first run) if not venv_python.exists(): print("Creating virtual environment for YouTube skill...", file=sys.stderr) subprocess.check_call([sys.executable, "-m", "venv", str(VENV_DIR)]) print(f"Installing dependencies: {', '.join(missing)}", file=sys.stderr) subprocess.check_call([str(venv_python), "-m", "pip", "install", "--quiet", *missing]) # Re-exec inside the venv so imports resolve os.execv(str(venv_python), [str(venv_python), *sys.argv]) ``` ### Technical Analysis The script automatically creates a virtual environment and installs packages from the configured Python package index whenever required imports are unavailable. Package names are not constrained by exact versions, cryptographic hashes ...[truncated 1876 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove automatic dependency installation from normal script execution. 2. Declare dependencies through a reviewed package manifest and lock file. 3. Pin every direct and transitive dependency to an approved version. 4. Record cryptographic hashes and install with `pip --require-hashes`. 5. Install dependencies during an explicit setup or deployment phase requiring user consent. 6. Use a controlled package repository or verified internal mirror where appropriate. 7. Document all dependencies and installation behavior in `SKILL.md` and Skill metadata. 8. Regularly audit pinned dependencies for known vulnerabilities and update them through a controlled review process. 9. Apply restrictive permissions to the virtual environment and prevent less-trusted users from modifying it. ]]>
