T08 · Insecure Dependencies
Error
- Location
- scripts/package.json:6
- Finding
- External Dependency Executes with Wallet and Trading Authority Without Locally Auditable Source<![CDATA[ ## Vulnerability Details **File Location**: `scripts/package.json:6-8`; `scripts/setup.mjs:10-23`; `scripts/start-watcher.mjs:9-14`; `scripts/start-mcp.mjs:9-16` **Vulnerability Type**: Supply-chain trust boundary violation **Risk Level**: High ### Vulnerable Code `scripts/package.json:6-8`: ```json "dependencies": { "@hypelens/hypelens-agent-guard": "0.1.17" } ``` `scripts/setup.mjs:10-23`: ```js let entry; try { const pkgJson = require.resolve('@hypelens/hypelens-agent-guard/package.json'); entry = join(dirname(pkgJson), 'bin', 'agent-guard.js'); } catch { entry = join(scriptsDir, '..', '..', 'bin', 'agent-guard.js'); } if (!existsSync(entry)) { console.error('Missing @hypelens/hypelens-agent-guard. Run: npm install'); process.exit(1); } process.argv = [process.argv[0], entry, 'setup', '--scripts-dir', scriptsDir, ...process.argv.slice(2)]; await import(pathToFileURL(entry).href); ``` `scripts/start-watcher.mjs:9-14`: ```js try { const pkgJson = require.resolve('@hypelens/hypelens-agent-guard/package.json'); const pkg = require(pkgJson); const binRel = (pkg.bin && pkg.bin['agent-guard-watcher']) || 'bin/agent-guard-watcher.js'; const entry = join(dirname(pkgJson), binRel); await import(pathToFileURL(entry).href); ``` `scripts/start-mcp.mjs:9-16`: ```js try { const pkgJson = require.resolve('@hypelens/hypelens-agent-guard/package.json'); const pkg = require(pkgJson); const binRel = (pkg.bin && (pkg.bin['agent-guard-mcp'] || pkg.bin['agent-guard'])) || 'bin/agent-guard-mcp.js'; const entry = join(dirname(pkgJson), binRel); await import(pathToFileURL(entry).href); ``` ### Technical Analysis The project’s local scripts do not implement the substantive setup, watcher, MCP, or trading logic. Instead, they dynamically resolve and import executable modules from `@hypelens/hypelens-agent-guard`. The source of those executable modules is not present in the audited project, preventing this audit from verifying ...[truncated 2230 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Vendor the exact executable dependency source into the reviewed release or include it as an auditable workspace package. 2. Perform a separate source audit of `@hypelens/hypelens-agent-guard@0.1.17`, particularly its signer, networking, MCP, configuration, and order-placement paths. 3. Continue pinning an exact version and lockfile integrity value, and use `npm ci` rather than `npm install` in deployment. 4. Consider `npm ci --ignore-scripts` unless dependency lifecycle scripts have been explicitly reviewed and are required. 5. Verify the expected package archive or critical executable files against independently maintained cryptographic hashes before importing them. 6. Run the watcher in a restricted container or operating-system account with: - A read-only root filesystem where practical. - Minimal writable state directories. - An outbound network allowlist. - No access to unrelated user files or credentials. 7. Use a dedicated signer with narrowly scoped authority, strict position and order limits, and no authority over unrelated funds. 8. Add runtime safeguards such as maximum order size, maximum cumulative daily exit amount, destination and market allowlists, and explicit operator confirmation for exceptional orders. ]]>
