T08 · Insecure Dependencies
Error
- Location
- SKILL.md:29
- Finding
- Execution of an Unpinned npm Package from the Mutable Latest Release<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 29-35; additional occurrence at line 61 **Vulnerability Type**: Supply-chain risk caused by unpinned remote package execution **Risk Level**: High ### Vulnerable Code ```bash npx -y socialdatax-skills@latest xhs detail \ --note-id "<note_id>" --pretty --source-client socialdatax-skills \ --source-platform clawhub --source-skill socialdatax-xhs-detail npx -y socialdatax-skills@latest xhs detail \ --url "<note_url_or_share_text>" --pretty --source-client socialdatax-skills \ --source-platform clawhub --source-skill socialdatax-xhs-detail ``` The same unsafe package reference is used by the media-download instruction at line 61: ```text When the user wants to save XHS images or videos after detail, pass each returned `image_items[].image_url`, `image_items[].live_photo.video_url`, or `video.video_url` to `npx -y socialdatax-skills@latest xhs download-media --url "<media_url>" --output-dir <directory> --pretty`; this local save command does not require `SOCIALDATAX_API_KEY`. ``` ### Technical Analysis The skill directs the agent to execute `socialdatax-skills@latest` through `npx -y`. The `latest` npm tag is mutable and does not identify the specific package version that was reviewed. The `-y` option also allows installation and execution without an interactive confirmation step. Consequently, the effective code executed by the skill can change after this document has been audited. A malicious future release, compromised publisher account, or compromised npm distribution path could cause arbitrary package code to execute locally. Package lifecycle scripts or the package CLI may execute with the same operating-system privileges and environment access as the agent process. This is a supply-chain weakness rather than evidence that the current package release is malicious. ### Attack Path 1. An attacker compromises the npm publisher account, release pipeline, or another mechanism ...[truncated 1270 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace `@latest` with an exact, reviewed package version, such as `socialdatax-skills@X.Y.Z`. 2. Install dependencies through a committed lockfile that records exact transitive versions and package integrity hashes. 3. Prefer a preinstalled, reviewed package over downloading executable code during each skill invocation. 4. Verify package provenance and integrity through npm signatures, trusted publishing metadata, or an internally approved registry. 5. Disable npm lifecycle scripts where they are unnecessary, for example by using an installation process configured with `--ignore-scripts`. 6. Run the CLI in a sandbox with minimal filesystem and network permissions. 7. Expose `SOCIALDATAX_API_KEY` only to the specific process that requires it, and avoid placing unrelated credentials in that process environment. 8. Apply the same version pinning and verification controls to both detail retrieval and `download-media` commands. ]]>
