T08 · Insecure Dependencies
- Location
index.js:10- Finding
Automatic Installation of Unpinned Dependencies During Module Import
- Content
View full analysis
{ try { require.resolve(dep); return false; } catch { return true; } }); if (missing.length > 0) { const pkgJsonPath = path.join(__dirname, 'package.json'); try { require.resolve(pkgJsonPath); } catch { execSync(`npm init -y --prefix "${__dirname}" && node -e "const fs=require('fs');const p=JSON.parse(fs.readFileSync('${pkgJsonPath}','utf8'));p.type='module';fs.writeFileSync('${pkgJsonPath}',JSON.stringify(p,null,2))"`, { stdio: 'pipe' }); } execSync(`npm install --prefix "${__dirname}" ${missing.join(' ')}`, { stdio: 'pipe' }); } } ensureDependencies(); ``` ### Technical Analysis Importing `index.js` immediately invokes `ensureDependencies()`. If `axios` or `form-data` cannot be resolved, the Skill runs `npm install` using package names without pinned versions or lockfile verification. This introduces a supply-chain trust boundary at runtime. The effective package content depends on the npm registry and configuration present when the Skill is imported, rather than on artifacts reviewed with the Skill. npm package installation may also execute package lifecycle scripts with the privileges of the current process. Automatic package installation and creation or modification of `package.json` are import-time side effects. They exceed the minimum privileges necessary for loading an API client module because dependency provisioning can be performed explicitly before execution. ### Attack Path 1. The Skill is imported in an environment where one or both dependencies are absent. 2. `ensureDependencies()` executes automatically. 3. The process resolves the unversioned package names through the config ...[truncated 835 chars]- Remediation
View remediation
