T08 · Insecure Dependencies
- Location
scripts/planning.py:18- Finding
Automatic Installation of an Unpinned Runtime Dependency
- Content
View full analysis
Vulnerability Details
File Location:
scripts/planning.py, lines 18-33
Vulnerability Type: Unpinned dependency installation and supply-chain exposure
Risk Level: MediumVulnerable Code
python def _bootstrap_venv() -> None: """Create a venv with PyYAML (if needed) and re-exec using the venv's python.""" python = str(VENV_DIR / "bin" / "python") if not (VENV_DIR / "bin" / "python").exists(): print(f"PyYAML not found. Bootstrapping venv at {VENV_DIR}...", file=sys.stderr) VENV_DIR.parent.mkdir(parents=True, exist_ok=True) venv.create(str(VENV_DIR), with_pip=True) pip = str(VENV_DIR / "bin" / "pip") subprocess.check_call( [pip, "install", "--quiet", "pyyaml"], stdout=sys.stderr, stderr=sys.stderr, ) print("Done.", file=sys.stderr) os.execv(python, [python, *sys.argv])Technical Analysis
If PyYAML cannot be imported, the script automatically creates a persistent virtual environment and runs
pip install pyyaml. The dependency has no exact version constraint or cryptographic hash, and no controlled package index is specified.Consequently, the code installed at runtime is not necessarily the same code that was evaluated during this audit. Package-index state and the latest eligible PyYAML release may change after publication of the Skill. Installation can also run package build or installation logic with the privileges of the user invoking the Skill.
The documentation states that PyYAML is required, but it does not clearly disclose that the script will automatically download and install the package before re-executing itself.
Attack Path
- The Skill is invoked in an environment where
import yamlfails. _bootstrap_venv()creates a virtual environment under the user's home directory.- The script contacts the package source configured for
pip. - `pip ...[truncated 935 chars]
- The Skill is invoked in an environment where
- Remediation
View remediation
Remediation Suggestions
- Remove automatic dependency installation from normal command execution.
- Declare dependencies through a lock file or packaging metadata and require an explicit setup step.
- Pin PyYAML to an audited exact version rather than installing an unconstrained latest release.
- Use cryptographic hashes, such as
pip install --require-hashes, to verify downloaded artifacts. - Use a trusted, controlled package index and disable untrusted supplemental indexes.
- If bootstrap behavior must remain, obtain explicit user confirmation and clearly disclose the network access and installation destination.
- Treat the cached environment as mutable state and provide a documented mechanism to verify, update, or remove it securely.
