T08 · Insecure Dependencies
Warning
- Location
- scripts/ziwei_chart.py:228
- Finding
- Unpinned and Unlocked Third-Party Dependencies<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/ziwei_chart.py:228-233` - `scripts/ziwei_chart.py:838-847` - `scripts/ziwei_engine_js.mjs:2` **Vulnerability Type**: Third-party supply-chain exposure through unpinned installation guidance and missing dependency lockfiles **Risk Level**: Medium ### Vulnerable Code ```python def _ensure_iztro_py() -> Any: try: from iztro_py import astro except ModuleNotFoundError as exc: raise RuntimeError("未安装 iztro-py,请先安装:pip install iztro-py") from exc return astro ``` ```python def render_jpg_cairosvg(svg: str, quality: int = 92) -> bytes: try: import cairosvg except ModuleNotFoundError as exc: raise RuntimeError("生成 JPG 需要 cairosvg,请先安装:pip install cairosvg") from exc try: from PIL import Image except ModuleNotFoundError as exc: raise RuntimeError("生成 JPG 需要 pillow,请先安装:pip install pillow") from exc ``` ```javascript import { astro } from 'iztro'; ``` ### Technical Analysis The runtime error messages recommend installing `iztro-py`, `cairosvg`, and `pillow` without exact version constraints or package hashes. The JavaScript engine imports `iztro`, but the audited project contains no `package.json`, package lockfile, or integrity metadata defining the reviewed dependency version. The payload includes broad version requirements such as `iztro-py >=0.3.4` and `iztro >=2.5.7`, but these are informational values rather than enforced, reproducible dependency controls. An installation can therefore resolve to a newer and materially different package or transitive dependency than the version reviewed by the project author. The project does not automatically run a package manager and contains no evidence that the named dependencies are currently malicious. Exploitation is conditional on a user or deployment process following the unrestricted installation guidance or otherwise installing dependencies without a trusted lockfile. ### A ...[truncated 1622 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Add a reviewed Python dependency manifest with exact versions, such as a fully pinned `requirements.txt` or lockfile. 2. Generate and verify cryptographic hashes for Python artifacts, and install them with hash enforcement, for example through `pip install --require-hashes`. 3. Add `package.json` and a committed package lockfile for the JavaScript engine. Use reproducible installation commands such as `npm ci`. 4. Pin the exact reviewed `iztro`, `iztro-py`, `cairosvg`, and Pillow versions rather than relying on open-ended minimum versions. 5. Review and lock all transitive dependencies, not only direct dependencies. 6. Use an approved package registry or internal mirror and enable dependency provenance, vulnerability, and integrity checks where supported. 7. Replace unrestricted runtime installation suggestions with references to the project's locked installation procedure. 8. Run dependency installation and chart generation as a non-privileged user in an isolated environment with only the filesystem and network permissions required by the Skill. ]]>
