Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(security): drop shell from git calls in statusline (audit_1776853149979)

Reuven5073f567393a
diff --git a/v3/@claude-flow/cli/.claude/helpers/statusline.cjs b/v3/@claude-flow/cli/.claude/helpers/statusline.cjs
index 49a9df8bad..85f0eb870c 100644
--- a/v3/@claude-flow/cli/.claude/helpers/statusline.cjs
+++ b/v3/@claude-flow/cli/.claude/helpers/statusline.cjs
@@ -25,7 +25,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require('fs');
const path = require('path');
-const { execSync } = require('child_process');
+const { execSync, execFileSync } = require('child_process');
// Configuration
const CONFIG = {
@@ -70,19 +70,17 @@ function getUserInfo() {
let gitBranch = '';
let modelName = 'Unknown';
+ // audit_1776853149979: previously used execSync with a shell string. Switched
+ // to execFileSync('git', argv) on both platforms so there is no shell
+ // interpretation. Cross-platform behavior is preserved by relying on git's
+ // own exit code instead of `|| echo` fallbacks: missing repo / no user.name
+ // throws, caught below, defaults retained.
try {
- const gitUserCmd = isWindows
- ? 'git config user.name 2>NUL || echo user'
- : 'git config user.name 2>/dev/null || echo "user"';
- const gitBranchCmd = isWindows
- ? 'git branch --show-current 2>NUL || echo.'
- : 'git branch --show-current 2>/dev/null || echo ""';
- name = execSync(gitUserCmd, { encoding: 'utf-8' }).trim();
- gitBranch = execSync(gitBranchCmd, { encoding: 'utf-8' }).trim();
- if (gitBranch === '.') gitBranch = ''; // Windows echo. outputs a dot
- } catch (e) {
- // Ignore errors
- }
+ name = execFileSync('git', ['config', 'user.name'], { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || 'user';
+ } catch { /* keep default */ }
+ try {
+ gitBranch = execFileSync('git', ['branch', '--show-current'], { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
+ } catch { /* keep empty */ }
// Auto-detect model from Claude Code's config
try {
diff --git a/v3/@claude-flow/cli/.claude/helpers/statusline.js b/v3/@claude-flow/cli/.claude/helpers/statusline.js
index 68c6877cac..8d462f6224 100644
--- a/v3/@claude-flow/cli/.claude/helpers/statusline.js
+++ b/v3/@claude-flow/cli/.claude/helpers/statusline.js
@@ -8,7 +8,7 @@
const fs = require('fs');
const path = require('path');
-const { execSync } = require('child_process');
+const { execSync, execFileSync } = require('child_process');
// Configuration
const CONFIG = {
@@ -49,12 +49,17 @@ function getUserInfo() {
let gitBranch = '';
let modelName = 'Opus 4.6 (1M context)';
+ // audit_1776853149979: previously used execSync with a shell string for git
+ // commands. Switched to execFileSync('git', argv) so there is no shell
+ // interpretation — eliminates the *class* of injection regardless of whether
+ // user input ever reaches these args (defense in depth). Errors are caught
+ // and the defaults above remain.
try {
- name = execSync('git config user.name 2>/dev/null || echo "user"', { encoding: 'utf-8' }).trim();
- gitBranch = execSync('git branch --show-current 2>/dev/null || echo ""', { encoding: 'utf-8' }).trim();
- } catch (e) {
- // Ignore errors
- }
+ name = execFileSync('git', ['config', 'user.name'], { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || 'user';
+ } catch { /* not in a repo / no name set — keep default */ }
+ try {
+ gitBranch = execFileSync('git', ['branch', '--show-current'], { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
+ } catch { /* not in a repo — keep empty */ }
return { name, gitBranch, modelName };
}