T09 · Insecure Skill Coding Practices
- Location
src/core/heartflow.js:6112- Finding
Latent Shell Command Injection and Unattended Repository Mutation in Automatic Evolution Workflow
- Content
View full analysis
0) { try { this.absorbSignal(input, { skipStore: false }); this._signalCount = (this._signalCount || 0) + 1; // Automatically trigger evolution after reaching the threshold if (this._signalCount >= 8) { this._signalCount = 0; try { await this._autoEvolveIfImproved(); } catch (e) {} } } catch (e) {} } ``` ```js async _autoEvolveIfImproved() { if (!this.evolution) return; const run = await this.evolution._executeEvolve({ trigger: 'signal_auto', auto: true }); const improved = (run && ((run.improvements && run.improvements.length > 0) || (typeof run.improvement === 'number' && run.improvement > 0))); if (!improved) return; try { const { execSync } = require('child_process'); const fs = require('fs'); const root = this.projectRoot || process.cwd(); const msg = 'self-evolution(auto): 信号驱动进化 ' + (run.learning && run.learning.summary ? run.learning.summary.slice(0, 80) : ''); const files = ['src/', 'test/', 'VERSION', 'package.json', 'package-lock.json']; execSync('git reset -q && git add ' + files.join(' ') + ' && git commit -q -m ' + JSON.stringify(msg), { cwd: root, encoding: 'utf8', timeout: 30000 }); const { SmartUpgradeEngine } = require('./../cortex/smart-upgrade-engine.js'); const s = new SmartUpgradeEngine(root); s.recordSelfUpgrade({ version: (() => { try { return fs.readFileSync(root + '/VERSION', 'utf8').trim(); } catch(e){ return 'unknown'; } })(), description: '信号驱动自动进化(有真改进)', impact: 4, type: 'self-heal' }); console.error('[AUTO-EVOLVE] 真改进已本地 commit,待你 push:' + msg.slice(0, 60)); } catch (e) { /* commit failure does not interrupt execution */ } } ``` ### Technical Analysis Eve ...[truncated 3875 chars]- Remediation
View remediation
