T08 · Insecure Dependencies
Warning
- Location
- scripts/planning.py:18
- Finding
- Automatic Installation of an Unpinned Runtime Dependency## Vulnerability Details **File Location**: `scripts/planning.py`, lines 18-33 **Vulnerability Type**: Unpinned dependency installation and supply-chain exposure **Risk Level**: Medium ### Vulnerable 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 1. The Skill is invoked in an environment where `import yaml` fails. 2. `_bootstrap_venv()` creates a virtual environment under the user's home directory. 3. The script contacts the package source configured for `pip`. 4. `pip ...[truncated 935 chars]
- Remediation
- ## Remediation Suggestions 1. Remove automatic dependency installation from normal command execution. 2. Declare dependencies through a lock file or packaging metadata and require an explicit setup step. 3. Pin PyYAML to an audited exact version rather than installing an unconstrained latest release. 4. Use cryptographic hashes, such as `pip install --require-hashes`, to verify downloaded artifacts. 5. Use a trusted, controlled package index and disable untrusted supplemental indexes. 6. If bootstrap behavior must remain, obtain explicit user confirmation and clearly disclose the network access and installation destination. 7. Treat the cached environment as mutable state and provide a documented mechanism to verify, update, or remove it securely.
