T08 · Insecure Dependencies
Warning
- Location
- scripts/common.js:24
- Finding
- Runtime Installation of Mutable Dependencies in a Wallet-Signing Process## Vulnerability Details **File Location**: `scripts/common.js`, lines 24–36 **Vulnerability Type**: Unsafe runtime dependency installation and supply-chain exposure **Risk Level**: Medium **Complete Code Snippet**: ```js // Ensure dependencies 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()`. When any required module is missing, the function invokes npm at runtime to retrieve and install executable third-party code. Most direct dependencies are not pinned to exact versions, while `@solana/web3.js@1` allows updates throughout the major version. The project also does not provide a reviewed lockfile or fixed integrity metadata in the audited artifact. This means the effective code executed by the Skill can change after the Skill itself has been reviewed. npm may also execute package lifecycle scripts unless they are explicitly disabled. The exposure is especially significant because the resulting modules run in the same Node.js process and under the same operating-system account as code that reads the API credential and the Solana secret key from `~/.config/clawland`. The shell command is static and does not interpolate user-controlled input, so no direct command-injection issue was identified. The vulnerability is the mutable, runtime-resolved dependency trust boundary. ### ...[truncated 1576 chars]
- Remediation
- ## Remediation Suggestions 1. Remove automatic dependency installation from runtime paths, particularly from processes that load or use wallet secrets. 2. Add a reviewed `package.json` and lockfile, and pin every direct dependency to an exact version. 3. Install dependencies as a separate, explicit deployment step using `npm ci` rather than `npm install`. 4. Use lockfile integrity hashes and periodically verify them in CI. 5. Disable lifecycle scripts with `npm ci --ignore-scripts` where package compatibility permits; explicitly review any dependency that requires lifecycle execution. 6. Run dependency installation in a restricted build environment without wallet files, API credentials, or other user secrets. 7. Package or vendor reviewed dependencies when reproducible offline installation is practical. 8. Add automated dependency scanning, provenance verification, and controlled update review. 9. Run transaction-signing scripts under a constrained operating-system account with access only to the minimum required wallet and configuration files.
