T08 · Insecure Dependencies
Warning
- Location
- scripts/common.js:24
- Finding
- Runtime Installation of Mutable npm Dependencies<![CDATA[ ## Vulnerability Details **File Location**: `scripts/common.js:24-36` **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium ```js function ensureDeps() { const deps = ['@solana/web3.js', 'tweetnacl', 'bs58', '@solana/spl-token']; const missing = deps.some(d => { try { require.resolve(d, { paths: [__dirname] }); return false; } catch { return true; } }); if (missing) { console.log('📦 Installing Solana dependencies (first run, ~15s)...'); const { execSync } = require('child_process'); execSync('npm init -y 2>/dev/null && npm install --silent @solana/web3.js@1 @coral-xyz/anchor @solana/spl-token bs58 tweetnacl', { cwd: __dirname, stdio: ['pipe', 'pipe', 'inherit'], }); console.log('✅ Dependencies installed.\n'); } } ``` ### Technical Analysis Every script calls `ensureDeps()`. If any required module is unavailable, the function invokes npm and installs packages during normal Skill execution. Only `@solana/web3.js` has a major-version constraint; the other direct dependencies and all transitive dependencies are resolved dynamically. The project contains no reviewed lockfile or integrity constraints. npm package installation may also execute package lifecycle scripts unless explicitly disabled. Consequently, the code executed by the Skill can differ from the code reviewed in this package. Registry compromise, dependency compromise, malicious transitive updates, or dependency-resolution manipulation could introduce arbitrary code when any Skill script is launched. The documentation also recommends an external AgentWallet Skill from a mutable third-party URL. Although no remote AgentWallet payload is directly executed by the audited scripts, that recommendation unnecessarily expands the trust boundary for an operation that can be completed through other devnet funding methods. ### Attack Path 1. An attacker compromises a direct or transitive npm dependency, its publisher account, or the pa ...[truncated 1116 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Add a reviewed `package.json` and committed lockfile to the project. 2. Pin direct dependencies to exact versions rather than version ranges. 3. Install dependencies as an explicit setup step using `npm ci --ignore-scripts`. 4. Remove automatic `npm init` and `npm install` execution from `ensureDeps()`. 5. Verify package integrity and provenance before release, including transitive dependencies. 6. Audit whether any required package genuinely depends on installation lifecycle scripts before permitting them. 7. Fail safely with a clear setup message when dependencies are unavailable rather than modifying the runtime environment. 8. Document external wallet-funding integrations as optional and identify their separate credential and trust boundaries. ]]>
