T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:57
- Finding
- Unpinned third-party packages are downloaded and executed with unnecessary global scope<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:57-60`, `SKILL.md:83-86`, and `SKILL.md:96` **Vulnerability Type**: Unpinned dependency installation and immediate execution of remotely retrieved packages **Risk Level**: Medium ### Complete Code Snippets ```bash npm i -g @iqinghu/qhkit ``` The documentation also instructs the Agent to use an alternative npm registry when the official registry is slow and permits execution through `npx`. ```bash npm i -g @iqinghu/qhkit@latest ``` For image compression, additional unpinned packages may be installed or executed: ```bash pip install pillow -i https://pypi.tuna.tsinghua.edu.cn/simple npx --yes sharp-cli -i ORIGINAL_IMAGE -o COMPRESSED_IMAGE.jpg resize 2048 ``` ### Technical Analysis These instructions retrieve mutable third-party packages and execute their code without pinning reviewed versions or verifying package integrity. In particular: - `@iqinghu/qhkit` is installed globally without a fixed version. - The upgrade instruction explicitly installs the mutable `latest` release. - `npx --yes sharp-cli` automatically downloads and executes the currently resolved package without interactive approval. - npm packages may run lifecycle scripts during installation. - Alternative npm and Python package mirrors expand the supply-chain trust boundary. - A global npm installation modifies the user's persistent executable environment, although the declared image-generation function only requires a task-scoped CLI. Consequently, the effective code executed by the Skill can change after this document has been audited. A compromised publisher account, malicious new release, registry compromise, dependency compromise, or unsafe mirror response could introduce arbitrary code. The Node archive installation at `SKILL.md:65-66` is not a `curl | bash` pattern. It downloads an archive and verifies it against the corresponding checksum manifest before extraction. However, the documented mirror fallback obtains b ...[truncated 1659 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin every dependency to a specific reviewed version rather than using an implicit current version or `@latest`. 2. Record and verify package integrity hashes or use a lockfile generated from a trusted dependency review. 3. Prefer a project-local, isolated installation over `npm -g`; expose the executable through a controlled wrapper or fixed local path. 4. Replace `npx --yes sharp-cli` with a pinned and preinstalled image-processing dependency. 5. Use a virtual environment for Python dependencies and pin Pillow to a reviewed version with a verified hash. 6. Avoid automatically switching registries. If mirrors are required, maintain an explicit allowlist and apply independent integrity verification. 7. Consider disabling npm lifecycle scripts during installation where package functionality permits it. 8. Require user approval before installing or upgrading executable dependencies. 9. Pin the trusted Node archive digest directly in the Skill or another independently controlled manifest so archive validation does not rely solely on a checksum downloaded from the same host or mirror. 10. Document cleanup procedures for local dependencies and avoid persistent host modification unless explicitly requested. ]]>
