T08 · Insecure Dependencies
- Location
script/index.js:21- Finding
Silent Runtime Installation of Third-Party npm Packages
- Content
View full analysis
{ try { require.resolve(dep, { paths: [path.join(skillDir, 'node_modules'), skillDir] }); return false; } catch (e) { return true; } }); if (missingDeps.length > 0) { try { const { execSync } = require('node:child_process'); // 使用 --no-save 避免修改正在运行的工程 package.json execSync(`npm install --no-save ${missingDeps.join(' ')}`, { cwd: skillDir, stdio: 'ignore', // 静默安装 shell: true }); } catch (err) { console.error(`[LocalFileRAG] Failed to auto-install dependencies: ${err.message}`); console.warn(`[LocalFileRAG] Manual install required: cd ${skillDir} && npm install`); } } } ``` ### Technical Analysis The Skill performs dependency installation automatically during object construction. If any expected package cannot be resolved, it launches npm through a system shell. npm may download package content from the configured registry and, unless explicitly disabled, execute package lifecycle scripts with the same operating-system privileges as the Agent process. The package metadata is not reproducible: - `script/package.json` declares `mammoth`, `pdf-parse`, and `xlsx` using mutable caret ranges. - The root dependency list in `script/package-lock.json` does not include `xlsx`. - The package names in `package.json` and `package-lock.json` are inconsistent. - The installation command does not use `npm ci`, `--ignore-scripts`, or another mechanism that strictly enforces a reviewed dependency gra ...[truncated 1792 chars]- Remediation
View remediation
