T08 · Insecure Dependencies
- Location
scripts/youtube_download.py:24- Finding
Unpinned Dependency Installation and Automatic Code Updates
- Content
View full analysis
Vulnerability Details
File Location:
scripts/youtube_download.py:24-25, 88-104
Vulnerability Type: Unpinned third-party dependency installation and automatic executable updates
Risk Level: HighVulnerable Code
python def pip_install_or_upgrade() -> None: run([sys.executable, "-m", "pip", "install", "--user", "-U", "yt-dlp"])python def ensure_yt_dlp(*, skip_update: bool) -> Command: yt_dlp = find_yt_dlp() if yt_dlp is None: print("yt-dlp not found; installing latest yt-dlp with pip.", flush=True) pip_install_or_upgrade() yt_dlp = find_yt_dlp(prefer_user=True) if yt_dlp is None: raise SystemExit( "yt-dlp installation completed, but yt-dlp was not found as an executable " "or importable Python module." ) if skip_update: return yt_dlp update = subprocess.run([*yt_dlp, "-U"], text=True) if update.returncode != 0: print("yt-dlp self-update failed or is disabled; upgrading with pip instead.", flush=True) pip_install_or_upgrade() yt_dlp = find_yt_dlp(prefer_user=True) or yt_dlp return yt_dlpTechnical Analysis
The helper installs the latest available
yt-dlprelease from the package index when the dependency is missing. It also attempts to update an existing executable during every normal run unless the user supplies--skip-update. If self-update fails, it performs another unpinned pip upgrade.Neither installation path enforces a reviewed version, artifact hash, signature, lock file, or trusted immutable package source. The code executed by the Skill can therefore change after the Skill itself has been audited. This creates a supply-chain boundary in which compromise of the package release, package index, distribution channel, or self-update mechanism could introduce attacker-controlled code.
The use of an argv list prevents ...[truncated 1686 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin
yt-dlpto a specifically reviewed version instead of using an unconstrained-Uinstallation. - Verify downloaded artifacts with approved cryptographic hashes or trusted signatures. Use a lock file with hash enforcement where supported.
- Remove automatic updates from the routine download path. Make dependency upgrades an explicit maintenance operation requiring user approval.
- Install the dependency in a dedicated virtual environment rather than modifying the user's general Python environment.
- Configure pip to use an explicitly trusted package repository and reject unexpected alternate indexes.
- After an approved upgrade, rerun security review and functional tests before making the version available to normal Skill execution.
- If self-update must remain available, require an explicit update flag, validate the update source and artifact, and display the current and target versions before proceeding.
- Run media downloads with the minimum required filesystem access. Avoid exposing browser cookies unless necessary, and prefer a narrowly scoped cookie file when authentication is required.
- Pin
