T08 · Insecure Dependencies
Warning
- Location
- download_latest.py:16
- Finding
- Unpinned Runtime Dependency Installation into the System Python Environment## Vulnerability Details **File Location**: `download_latest.py:16-28` **Additional Location**: `SKILL.md:19-25` **Vulnerability Type**: Unsafe and unpinned runtime dependency installation **Risk Level**: Medium ### Vulnerable Code ```python def check_ytdlp(): """Vérifie que yt-dlp est installé.""" try: result = subprocess.run(["yt-dlp", "--version"], capture_output=True, text=True) print(f"✅ yt-dlp {result.stdout.strip()}") return True except FileNotFoundError: print("❌ yt-dlp non trouvé. Installation...") subprocess.run([sys.executable, "-m", "pip", "install", "-U", "yt-dlp", "--break-system-packages"], check=False) return True ``` The corresponding documented installation command is: ```bash pip install -U yt-dlp --break-system-packages 2>/dev/null || pip install yt-dlp yt-dlp --version ``` ### Technical Analysis When `yt-dlp` is unavailable, the script automatically installs the latest available release from the Python package index configured in the execution environment. No exact version or package hash is specified. Consequently, the dependency resolved during a future invocation may differ from the component that existed when the Skill was reviewed. The use of `--break-system-packages` bypasses Python's externally managed environment protection and permits modification of the system Python environment. This expands the scope of a dependency compromise because installation may alter packages used by unrelated applications. Although the package name is not an apparent typo and no malicious package is embedded in the project, the mutable runtime installation creates a supply-chain trust boundary. A compromised package release, package index, mirror, DNS/network path, or local `pip` configuration could supply attacker-controlled code. Python packages can execute code during installation and subsequently when thei ...[truncated 1628 chars]
- Remediation
- ## Remediation Suggestions 1. Remove automatic dependency installation from normal Skill execution. Detect a missing dependency, fail closed, and provide a controlled installation procedure. 2. Pin `yt-dlp` to an exact reviewed version rather than using an unconstrained latest release. 3. Verify package hashes, for example through a lock file or requirements file used with `pip install --require-hashes`. 4. Install dependencies into a dedicated virtual environment or immutable container instead of the system Python environment. 5. Remove `--break-system-packages`; do not bypass externally managed environment protections. 6. Use an explicitly trusted package index and disable unintended extra indexes where operationally possible. 7. Check the installation return code and verify the installed executable and version before continuing. 8. Update dependencies through a separate reviewed release process that includes integrity verification and vulnerability scanning.
