T09 · Insecure Skill Coding Practices
- Location
cli-wrapper.js:60- Finding
Shell Command Injection Through Shell-Backed CLI Execution
- Content
View full analysis
{ const proc = spawn(this.codebuddyPath, ['--version'], { shell: true, stdio: 'pipe' }); ``` ```javascript async execute(task, options = {}) { const startTime = Date.now(); // Build command arguments const args = [ '-p', task.prompt || task.task || task, '--output-format', options.outputFormat || this.outputFormat, '--permission-mode', options.permissionMode || this.permissionMode ]; // CodeBuddy CLI does not support the --workspace argument. // The working directory is selected through the spawn cwd option. if (this.debug) { console.log('[CodeBuddy CLI] Executing:', this.codebuddyPath, args.join(' ')); console.log('[CodeBuddy CLI] Working Directory:', options.cwd || process.cwd()); } return new Promise((resolve, reject) => { const proc = spawn(this.codebuddyPath, args, { shell: true, cwd: options.cwd || process.cwd(), stdio: 'pipe' }); ``` ```javascript executeBackground(task, options = {}) { const args = [ '-p', task.prompt || task, '--output-format', options.outputFormat || this.outputFormat, '--permission-mode', options.permissionMode || this.permissionMode ]; if (this.debug) { console.log('[CodeBuddy CLI] Background task:', this.codebuddyPath, args.join(' ')); } const proc = spawn(this.codebuddyPath, args, { shell: true, cwd: options.cwd || process.cwd(), stdio: 'pipe', detached: true }); ``` ### Technical Analysis The wrapper invokes `spawn` with `shell: true` while placing values derived from caller-controlled input into the command arguments. Relevant inputs include: - `this.codebuddyP ...[truncated 2638 chars]- Remediation
View remediation
