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

Checkpoint: File edits

rUv9cff98d4afa9
diff --git a/v3/@claude-flow/deployment/src/validator.ts b/v3/@claude-flow/deployment/src/validator.ts
index 4e3d66fa8c..1493f0f801 100644
--- a/v3/@claude-flow/deployment/src/validator.ts
+++ b/v3/@claude-flow/deployment/src/validator.ts
@@ -257,14 +257,39 @@ export class Validator {
}
/**
- * Execute command
+ * Allowed commands for security validation
+ */
+ private static readonly ALLOWED_COMMAND_PREFIXES = [
+ 'npm run ',
+ 'npm ',
+ 'npx ',
+ 'git ',
+ ];
+
+ /**
+ * Execute command safely with validation
*/
private execCommand(cmd: string, returnOutput = false): string {
+ // Validate: check for shell metacharacters
+ if (/[;&|`$()<>]/.test(cmd)) {
+ throw new Error(`Invalid command: contains shell metacharacters`);
+ }
+
+ // Validate: must start with allowed prefix
+ const isAllowed = Validator.ALLOWED_COMMAND_PREFIXES.some(
+ prefix => cmd.startsWith(prefix)
+ );
+ if (!isAllowed) {
+ throw new Error(`Command not allowed: ${cmd.split(' ')[0]}`);
+ }
+
try {
const output = execSync(cmd, {
cwd: this.cwd,
encoding: 'utf-8',
- stdio: returnOutput ? 'pipe' : 'inherit'
+ stdio: returnOutput ? 'pipe' : 'inherit',
+ timeout: 60000, // 60 second timeout for builds
+ maxBuffer: 50 * 1024 * 1024, // 50MB buffer for build output
});
return returnOutput ? output : '';
} catch (error) {