T08 · Insecure Dependencies
- Location
README.md:83- Finding
Unpinned Third-Party Dependencies Allow Supply-Chain Code Execution
- Content
View full analysis
Vulnerability Details
File Location:
README.md:83-86; related runtime imports atscripts/market_panels.py:29-32andscripts/market_panels.py:220-225
Vulnerability Type: Unpinned and integrity-unverified third-party dependencies
Risk Level: MediumVulnerable Code
README.md:83-86:markdown #### 1) Install optional dependencies ```bash pip install finshare aksharetext `scripts/market_panels.py:29-32`: ```python try: import akshare as ak # type: ignore except Exception: # noqa: BLE001 ak = Nonescripts/market_panels.py:220-225:python try: import finshare as fs # type: ignore except Exception as exc: # noqa: BLE001 return {"ok": False, "symbol": symbol, "error": f"finshare unavailable: {exc}"}Technical Analysis
The installation instructions retrieve the latest available
finshareandaksharereleases without version constraints, cryptographic hashes, or a lock file. The script subsequently imports and invokes these packages during normal market-data collection. The defaultfinsharemode isfirst, making that dependency the preferred data provider when installed.Python packages can execute arbitrary code during installation and module initialization. Consequently, a compromised upstream release, package-index account, distribution channel, or dependency subtree could introduce executable code after this Skill has been reviewed. Future incompatible releases could also silently alter data-source behavior or return manipulated market information.
The source code does not demonstrate that either current package is malicious. The confirmed issue is the absence of dependency pinning and integrity controls, which leaves runtime behavior dependent on mutable external artifacts.
Attack Path
- An attacker compromises the publishing account, release process, distribution path, or transitive dependency of
finshareorakshare. - The attacker publishes a malicious or backdoored ...[truncated 1195 chars]
- An attacker compromises the publishing account, release process, distribution path, or transitive dependency of
- Remediation
View remediation
Remediation Suggestions
- Pin each dependency to a reviewed, exact version rather than installing the latest release:
text finshare==REVIEWED_VERSION akshare==REVIEWED_VERSION- Generate a lock file containing cryptographic hashes and require hash verification during installation, for example with:
bash python -m pip install --require-hashes -r requirements.lock-
Review and lock all transitive dependencies, not only the two direct packages.
-
Install dependencies in a dedicated virtual environment or restricted container using a non-privileged service account.
-
Configure an explicit trusted package index or an internally controlled package mirror. Avoid allowing untrusted supplemental indexes that could enable dependency confusion.
-
Keep optional providers disabled until the user explicitly enables them. In particular, consider changing the default finshare mode from
firsttooffor requiring an explicit opt-in after installation. -
Add automated dependency scanning, release provenance verification, and periodic review before updating locked versions.
-
Document the packages’ network behavior and ensure secrets such as
FRED_API_KEYare not exposed to optional provider code unless required.
