T08 · Insecure Dependencies
- Location
scripts/amtk_fetch.py:1- Finding
Unpinned Runtime Dependencies Permit Supply-Chain Compromise
- Content
View full analysis
=3.13" # dependencies = [ # "pandas>=2.2.3", # "pyarrow>=16.1.0", # "python-dotenv>=1.0.1", # "tushare>=1.4.24", # "openpyxl>=3.1.5", # ] # /// ``` `scripts/amtk_query.py:1-8` and `scripts/amtk_analyze.py:1-8`: ```python # /// script # requires-python = ">=3.13" # dependencies = [ # "pandas>=2.2.3", # "pyarrow>=16.1.0", # "python-dotenv>=1.0.1", # "tushare>=1.4.24", # ] # /// ``` `SKILL.md:20-22`: ```markdown 检查依赖: ```! uv sync ``` ``` ### Technical Analysis The scripts use PEP 723 dependency metadata with lower-bound-only constraints. For example, `tushare>=1.4.24` allows any later version accepted by the resolver. The audited project does not contain a lockfile or dependency hashes that bind execution to previously reviewed artifacts. The documented `uv run` and `uv sync` workflows may therefore resolve and download package versions that were not present during the audit. If a permitted package release or configured package index is compromised, the dependency can introduce attacker-controlled code. Several dependencies are imported directly during normal operation, so malicious module initialization code would execute with the privileges of the process running the Skill. This issue is especially relevant to `tushare` and `python-dotenv`, because the fetch workflow loads `TUSHARE_TOKEN` into the process environment. A compromised dependency imported in that process could read and exfiltrate the token, inspect locally stored market data, or perform other actions allowed to the Agent account. The audit found no evidence that the current source intentionally retrieves or ...[truncated 1523 chars]- Remediation
View remediation
", # "pyarrow==", # "python-dotenv==", # "tushare==", # "openpyxl==", # ] ``` 2. Commit a generated `uv.lock` file and require locked or frozen dependency resolution in documented commands and automation. 3. Configure `uv` to use an explicitly trusted package index rather than inheriting arbitrary user or environment index configuration. 4. Verify package artifacts with hashes or another supported integrity-verification mechanism. 5. Review and update dependencies through a controlled process that includes vulnerability scanning and source or artifact provenance checks. 6. Run the fetch workflow in a restricted environment with access only to the project data directory, the Tushare credential, and required network destinations. 7. Keep `TUSHARE_TOKEN` narrowly scoped and rotate it immediately if dependency compromise is suspected. ]]>
