T08 · Insecure Dependencies
- Location
scripts/generate_agenda.py:22- Finding
Automatic Installation of Unpinned Runtime Dependencies
- Content
View full analysis
Vulnerability Details
File Location:
scripts/generate_agenda.py, lines 22–35
Vulnerability Type: Runtime supply-chain exposure through unpinned package installation
Risk Level: MediumVulnerable Code:
python def ensure_deps(): import importlib.util missing = [] for pkg, import_name in [("python-docx", "docx"), ("docx2pdf", "docx2pdf")]: if importlib.util.find_spec(import_name) is None: missing.append(pkg) if missing: import subprocess subprocess.check_call( [sys.executable, "-m", "pip", "install", "--quiet"] + missing ) ensure_deps()Technical Analysis
The script automatically invokes
pipwhenever either dependency is absent. Neither package version nor an artifact hash is pinned, so the code installed at runtime depends on the current state of the configured package index and the localpipconfiguration.Python package installation can execute package build and installation logic. Consequently, compromise of a package release, package repository, dependency resolution path, or configured package index could result in arbitrary code execution during Skill invocation. Runtime installation also modifies the active Python environment without explicit user approval.
The use of an argument list prevents shell injection through these fixed package names, but it does not mitigate the package supply-chain risk.
Attack Path
- The Skill invokes
scripts/generate_agenda.py. ensure_deps()discovers thatpython-docxordocx2pdfis unavailable.- The script executes
python -m pip install --quietusing mutable, unpinned package names. pipresolves packages from the environment's configured index and downloads the currently selected artifacts.- If the selected artifact or repository is compromised, malicious installation logic or package code executes with the privileges of the Ski ...[truncated 593 chars]
- The Skill invokes
- Remediation
View remediation
Remediation Suggestions
- Remove automatic package installation from application execution.
- Declare dependencies in a trusted dependency manifest and lockfile with exact versions.
- Require artifact hashes, such as through
pip install --require-hashes, to verify downloaded packages. - Install dependencies during a controlled setup or build phase rather than when processing user input.
- Use a dedicated virtual environment or isolated container with only the required dependencies.
- Restrict package resolution to an approved repository and review transitive dependencies.
- If dependencies are missing at runtime, terminate with a clear error rather than modifying the environment automatically.
- Reconcile the documentation with the implementation:
SKILL.mdrefers toreportlab, while the script installs and usesdocx2pdf.
