T08 · Insecure Dependencies
- Location
SKILL.md:750- Finding
Unpinned npm dependencies and remote package execution
- Content
View full analysis
npm install npm install -D @dcloudio/types @types/node # Run in HBuilderX or with CLI: npx @dcloudio/uvm npm run dev:mp-weixin ``` ### Technical Analysis The Skill tells users to install dependencies and execute `@dcloudio/uvm` through `npx` without specifying reviewed versions, requiring a lockfile, or verifying package integrity. When the requested package is not already available locally, `npx` can retrieve it from the configured npm registry and immediately execute its entry point. The effective code can therefore change after the Skill has been audited. Similarly, unpinned `npm install` operations may resolve mutable direct or transitive dependency versions and execute package lifecycle scripts such as `preinstall`, `install`, or `postinstall`. This behavior is not required for the core source-conversion operation itself. Installation and execution should be an explicit, separately approved post-conversion step with reproducible dependency controls. ### Attack Path 1. A user follows the post-conversion commands documented by the Skill. 2. npm resolves the unpinned packages from the user's configured registry. 3. A compromised package release, maintainer account, registry response, transitive dependency, or unexpected future version supplies malicious code. 4. npm lifecycle scripts or the `npx @dcloudio/uvm` entry point execute that code under the user's account. 5. The executed code can access resources available to that account, including the converted project, local configuration, environment variables, npm credentials, SSH material, and other readable files. 6. The malicious code may alter generated output, steal accessible data, or establish additional execution mechanisms subject to the user's operating-s ...[truncated 962 chars]- Remediation
View remediation
``` 2. Generate and commit a reviewed `package-lock.json`, then use reproducible installation: ```bash npm ci ``` 3. Use `npm ci --ignore-scripts` where package lifecycle scripts are unnecessary. If scripts are required, review and explicitly allow them before execution. 4. Separate conversion from dependency installation. Ask for explicit user approval before performing any network-backed installation or package execution. 5. Verify package provenance, registry configuration, checksums, maintainers, and transitive dependencies before recommending a version. 6. Prefer executing a locally installed, lockfile-pinned binary rather than allowing `npx` to retrieve mutable code: ```bash npm install --save-dev --save-exact @dcloudio/uvm@ npm ci ./node_modules/.bin/uvm ``` 7. Run installation and build commands in an isolated container or restricted build account without access to unrelated credentials or sensitive host files. ]]>
