T08 · Insecure Dependencies
Error
- Location
- scripts/setup.mjs:12
- Finding
- Security-Critical Behavior Is Delegated to Unreviewed Third-Party Executable Code<![CDATA[ ## Vulnerability Details **File Location**: `scripts/package.json:6-8`, `scripts/setup.mjs:12-23`, `scripts/start-mcp.mjs:10-17`, `scripts/start-watcher.mjs:10-14` **Vulnerability Type**: Third-party supply-chain exposure and execution of code outside the audited project **Risk Level**: High ### Evidence `scripts/package.json:6-8`: ```json "dependencies": { "@hypelens/hypelens-agent-guard": "0.1.18" } ``` `scripts/setup.mjs:12-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-mcp.mjs:10-17`: ```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); ``` `scripts/start-watcher.mjs:10-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); ``` ### Technical Analysis The project contains almost no implementation of its claimed security and trading functions. Instead, setup, MCP operation, wallet monitoring, and transaction enforcement are delegated to executable files supplied by `@hypelens/hypelens-agent-guard`. The dependency's source ...[truncated 2604 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Vendor the exact reviewed dependency source or distribution artifact into the project. 2. Commit a lockfile that records package versions and registry integrity hashes. 3. Verify the downloaded package against an independently published checksum or signature before execution. 4. Audit all dependency lifecycle scripts, binary mappings, transitive dependencies, network endpoints, and private-key handling. 5. Remove the `../../bin` fallback paths or restrict execution to a canonical file located inside the installed and verified package. 6. Resolve expected binary names explicitly instead of trusting mutable package metadata. 7. Run the watcher in an isolated container or dedicated operating-system account with: - A read-only root filesystem. - Access only to required policy and state directories. - Restricted outbound network destinations. - No access to unrelated user files or host sockets. 8. Use automated dependency scanning and require review before changing the pinned package artifact. ]]>
