T08 · Insecure Dependencies
Error
- Location
- scripts/package.json:6
- Finding
- Privileged Trading Logic Is Loaded from an Unverified npm Dependency<![CDATA[ ## Vulnerability Details **File Location**: `scripts/package.json:6-8`, `scripts/setup.mjs:9-23`, `scripts/start-mcp.mjs:9-17`, `scripts/start-watcher.mjs:9-15`, `NAUTILUS-SIDECAR.md:49-57` **Vulnerability Type**: Supply-chain execution of externally maintained code without a committed integrity lock **Risk Level**: High ### Complete Code Snippets `scripts/package.json:6-8`: ```json "dependencies": { "@hypelens/hypelens-agent-guard": "0.1.18" } ``` `scripts/setup.mjs:9-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:9-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:9-15`: ```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); ``` `NAUTILUS-SIDECAR.md:49-57`: ```yaml services: agent-guard-watcher: image: node:22-bookworm-slim working_dir: /app command: bash -lc "npm i @hypelens/hypelens-agent-guard@0.1.18 && npx hypelens-agent-guard setup --wallet $FUNDER && npx h ...[truncated 3141 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Commit a package lockfile generated by the selected package manager and require immutable, reproducible installation such as `npm ci`. 2. Record and independently verify npm integrity hashes and package provenance before deployment. 3. Vendor or otherwise include the complete security-sensitive implementation in the review scope. 4. Do not install packages during container startup. Build a reviewed image in CI and deploy it by immutable image digest. 5. Pin the base container image by digest rather than using only `node:22-bookworm-slim`. 6. Audit the complete transitive dependency graph and enable automated dependency and provenance monitoring. 7. Avoid trusting dependency-controlled `bin` paths for privileged launchers. Resolve an explicitly reviewed entry point and verify its artifact hash before import. 8. Run the MCP server and watcher as a dedicated, unprivileged operating-system user or container. 9. Restrict outbound networking to the exact APIs required for market data and transaction submission. 10. Mount configuration read-only where possible and separate heartbeat output from security policy files. 11. Use a delegated signer with protocol-level restrictions instead of exposing a broadly capable funder key to the dependency. ]]>
