T08 · Insecure Dependencies
Warning
- Location
- scripts/init.sh:98
- Finding
- Unpinned Third-Party Packages Are Installed and Executed## Vulnerability Details **File Location**: `scripts/init.sh:98-115, 142-145`; `SKILL.md:49-53` **Vulnerability Type**: Unpinned npm dependency installation and execution **Risk Level**: Medium ### Vulnerable Code `scripts/init.sh:98-115`: ```bash if [ ! -f "$WORKSPACE/package.json" ]; then cat > "$WORKSPACE/package.json" <<'PKGJSON' { "name": "token-image-workspace", "private": true, "type": "module", "scripts": { "render": "token-image render", "render:2x": "token-image render --scale 2", "editor": "token-image editor" }, "dependencies": { "@zane-chen/token-image": "^0.1.0", "react": "^18.3.0" }, "devDependencies": { "tsx": "^4.0.0", "typescript": "^5.0.0", "@types/node": "^20.0.0", "@types/react": "^18.0.0" } } ``` `scripts/init.sh:142-145`: ```bash # 6. Install dependencies echo " Installing dependencies..." (cd "$WORKSPACE" && npm install --quiet) echo " ✓ Dependencies installed" ``` `SKILL.md:49-53`: ```bash Ensure Playwright browsers are installed: ```bash npx playwright install chromium ``` ``` ### Technical Analysis The generated workspace uses caret-based semantic version ranges rather than exact package versions and does not include a reviewed lockfile. Running `npm install` therefore allows npm to resolve newer compatible package releases after the Skill has been audited. npm installation may execute package lifecycle scripts with the permissions of the user running the Skill. The installed `@zane-chen/token-image` package is subsequently invoked by the `render` and `editor` scripts, giving resolved package code an additional execution path. The pre-flight command also invokes `npx playwright` without an explicit version. If Playwright is not already available locally, `npx` may retrieve and execute a registry package whose contents were not included in this audit. These b ...[truncated 1908 chars]
- Remediation
- ## Remediation Suggestions 1. Replace all caret ranges with reviewed exact versions, for example `"@zane-chen/token-image": "0.1.0"`. 2. Generate, review, and distribute a `package-lock.json` containing resolved versions and integrity hashes. 3. Use `npm ci` with the committed lockfile instead of `npm install` to enforce deterministic resolution. 4. Add Playwright as an exact, locally installed dependency and invoke its local binary. Avoid an unversioned `npx playwright` command. 5. If `npx` remains necessary, specify an exact reviewed version and disable interactive package substitution, such as `npx --no-install playwright ...` after local installation. 6. Evaluate whether dependency lifecycle scripts are required. Where compatible, install with `--ignore-scripts` and explicitly run only reviewed setup operations. 7. Configure an approved npm registry and use provenance, integrity, and package-signing controls where available. 8. Run installation and rendering in a sandbox with minimal filesystem access, no sensitive environment variables, and restricted outbound network access. 9. Avoid `--quiet` in security-sensitive installation workflows so warnings and lifecycle activity remain visible in logs.
