T08 · Insecure Dependencies
Warning
- Location
- scripts/package.json:6
- Finding
- Security-Sensitive Third-Party Dependency Executes Automatically During Installation## Vulnerability Details **File Location**: `scripts/package.json:6-10`, with delegated execution in `scripts/setup.mjs:11-25` **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium ### Vulnerable Code `scripts/package.json:6-10`: ```json "dependencies": { "@hypelens/hypelens-agent-rail": "0.1.28" }, "scripts": { "postinstall": "node setup.mjs || node -e \"console.error('[hypelens] setup incomplete — run: node setup.mjs (start-mcp/place refused until .setup-ok + maxBuilderFee>=10)')\"", ``` `scripts/setup.mjs:11-25`: ```js async function main() { let entry; try { const pkgJson = require.resolve('@hypelens/hypelens-agent-rail/package.json'); entry = join(dirname(pkgJson), 'bin', 'hypelens-setup.js'); } catch { entry = null; } if (!entry || !existsSync(entry)) { console.error('Missing @hypelens/hypelens-agent-rail. Run: npm install (in this scripts/ folder)'); process.exit(1); } // Pass --scripts-dir so MCP entry points at local start-mcp.mjs process.argv.push('--scripts-dir', scriptsDir); await import(pathToFileURL(entry).href); } ``` ### Technical Analysis Running `npm install` automatically invokes the local `postinstall` lifecycle command. That command executes `setup.mjs`, which resolves and dynamically imports the third-party package's `bin/hypelens-setup.js`. The effective setup implementation is therefore supplied by a registry dependency and is not contained in the audited project. Although the dependency is pinned to version `0.1.28`, the project does not include a lockfile with artifact integrity metadata. Version pinning limits ordinary version drift but does not independently establish the integrity or safety of the registry artifact. This is security-sensitive because the documented setup process wires a trading MCP, handles builder-fee approval, and may be rerun in an environment containing `HYPERLIQUID_PRIVATE_KEY`. The unaudited dependency consequently executes in a financial ...[truncated 1636 chars]
- Remediation
- ## Remediation Suggestions 1. Commit a generated `package-lock.json` containing integrity hashes and use `npm ci` in deployment and installation workflows. 2. Obtain dependencies only from a trusted, explicitly configured registry and enforce registry provenance or package-signature verification where supported. 3. Independently audit or vendor the exact `@hypelens/hypelens-agent-rail@0.1.28` artifact, especially its setup and MCP entry points. 4. Separate dependency installation from wallet initialization. Avoid running financial setup automatically through `postinstall`; require a distinct, explicit setup command after installation and review. 5. Consider installing dependencies with lifecycle scripts disabled, such as `npm ci --ignore-scripts`, before explicitly invoking reviewed setup code. 6. Do not expose a master private key directly to an unaudited package. Prefer a hardware wallet, isolated signer, narrowly scoped signing service, or constrained approval flow. 7. Run setup under a dedicated low-privilege operating-system account or sandbox with restricted filesystem and network access. 8. Validate the resolved package path and expected artifact hash before dynamically importing the dependency entry point. 9. Display the exact approval target, fee limit, network, and payload to the user and require explicit confirmation before signing.
