T08 · Insecure Dependencies
- Location
scripts/analyze.py:6- Finding
Unpinned Third-Party Package Is Downloaded and Executed at Runtime
- Content
View full analysis
Vulnerability Details
File Location:
scripts/analyze.py:6-14scripts/dividend.py:6-12scripts/hot_scan.py:6-12scripts/portfolio.py:8-14scripts/rumor.py:5-12scripts/score.py:5-12scripts/watchlist.py:8-14
Vulnerability Type: Unpinned runtime dependency installation
Risk Level: MediumVulnerable Code
Representative implementation from
scripts/analyze.py:python def ensure_yfinance(): try: import yfinance return yfinance except ImportError: import subprocess subprocess.check_call([sys.executable, "-m", "pip", "install", "yfinance", "-q"]) import yfinance return yfinanceEquivalent runtime installation logic appears in the other listed scripts.
Technical Analysis
When
yfinanceis unavailable, the Skill invokespip install yfinanceduring normal command execution. The dependency is neither pinned to a reviewed version nor verified using package hashes. Consequently, the code that ultimately executes can change after the Skill itself has been audited.pipmay download the latest availableyfinancerelease and its transitive dependencies from the package index configured in the execution environment. Installation and subsequent import can execute package-controlled Python code with the same operating-system privileges as the Skill process.This creates a supply-chain exposure. Exploitation would require compromise or manipulation of a package release, a transitive dependency, the configured package index, package-resolution settings, or the network trust path. The audit found no evidence that the Skill intentionally selects a malicious package or unsafe nonstandard repository; the weakness is the uncontrolled runtime retrieval and execution model.
Attack Path
- An attacker compromises a package version, transitive dependency, or package source used by the local
pipconf ...[truncated 1042 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove all automatic
pip installcalls from runtime command paths. - Declare
yfinanceand its required transitive dependencies in a controlled dependency manifest. - Pin dependencies to reviewed versions and use a lockfile with cryptographic hashes.
- Install dependencies during a separate, explicit setup phase rather than while processing a user request.
- Use an isolated virtual environment with only the permissions required for finance analysis.
- Configure installation to use an approved package repository and require integrity verification.
- If the dependency is absent at runtime, fail safely with an actionable error instead of downloading executable code.
- Add automated dependency scanning and a documented update-review process.
- Remove all automatic
