🌊 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
checkpoint: File edit:
rUvf0a3a19322ba
diff --git a/.claude/settings.json b/.claude/settings.jsonindex 930ae732fe..2bac6d0456 100644--- a/.claude/settings.json+++ b/.claude/settings.json@@ -110,7 +110,7 @@{"type": "command","timeout": 5000,- "command": ".claude/helpers/guidance-hooks.sh post-edit \"$TOOL_INPUT_file_path\""+ "command": ".claude/helpers/guidance-hooks.sh post-edit \"$TOOL_INPUT_file_path\" 2>/dev/null || true"},{"type": "command",diff --git a/v3/@claude-flow/deployment/src/publisher.ts b/v3/@claude-flow/deployment/src/publisher.tsindex f8f61eb1db..2fe5d9e691 100644--- a/v3/@claude-flow/deployment/src/publisher.ts+++ b/v3/@claude-flow/deployment/src/publisher.ts@@ -58,8 +58,8 @@ export class Publisher {this.execCommand(buildCommand);}- // Construct npm publish command- const publishArgs: string[] = ['npm', 'publish'];+ // Construct npm publish command arguments (without 'npm' prefix for execNpmCommand)+ const publishArgs: string[] = ['publish'];if (tag) {publishArgs.push('--tag', tag);@@ -86,10 +86,10 @@ export class Publisher {if (dryRun) {console.log('Dry run mode - no actual publish');- console.log('Command:', publishArgs.join(' '));+ console.log('Command: npm', publishArgs.join(' '));}- const output = this.execCommand(publishArgs.join(' '), true);+ const output = this.execNpmCommand(publishArgs, true);// Parse output for tarball URLconst tarballMatch = output.match(/https:\/\/[^\s]+\.tgz/);@@ -176,11 +176,12 @@ export class Publisher {*/async pack(outputDir?: string): Promise<string> {try {- const cmd = outputDir- ? `npm pack --pack-destination ${outputDir}`- : 'npm pack';+ const packArgs = ['pack'];+ if (outputDir) {+ packArgs.push('--pack-destination', outputDir);+ }- const output = this.execCommand(cmd, true);+ const output = this.execNpmCommand(packArgs, true);const tarballName = output.trim().split('\n').pop() || '';return outputDir ? join(outputDir, tarballName) : tarballName;diff --git a/v3/mcp/tools/config-tools.ts b/v3/mcp/tools/config-tools.tsindex b6b70337d1..5ba995fd38 100644--- a/v3/mcp/tools/config-tools.ts+++ b/v3/mcp/tools/config-tools.ts@@ -11,6 +11,40 @@import { z } from 'zod';import { MCPTool, ToolContext } from '../types.js';+import { resolve, normalize } from 'path';++/**+ * Validate and sanitize config file path to prevent path traversal+ */+function validateConfigPath(inputPath: string, cwd: string = process.cwd()): string {+ // Normalize the path to resolve .. and .+ const normalizedPath = normalize(inputPath);++ // Block absolute paths and paths with traversal+ if (normalizedPath.startsWith('/') || normalizedPath.startsWith('\\')) {+ throw new Error('Absolute paths are not allowed for config files');+ }+ if (normalizedPath.includes('..')) {+ throw new Error('Path traversal (..) is not allowed');+ }++ // Only allow .json and .config.* files+ const allowedExtensions = ['.json', '.config.json', '.config.js', '.config.ts'];+ const hasAllowedExt = allowedExtensions.some(ext => normalizedPath.endsWith(ext));+ if (!hasAllowedExt) {+ throw new Error('Only .json and .config.* file extensions are allowed');+ }++ // Resolve to absolute path within cwd+ const resolvedPath = resolve(cwd, normalizedPath);++ // Ensure the resolved path is within cwd+ if (!resolvedPath.startsWith(cwd)) {+ throw new Error('Config path must be within current working directory');+ }++ return resolvedPath;+}// ============================================================================// Input Schemas@@ -210,7 +244,9 @@ async function handleLoadConfig(input: z.infer<typeof loadConfigSchema>,context?: ToolContext): Promise<LoadConfigResult> {- const path = input.path || './claude-flow.config.json';+ const inputPath = input.path || './claude-flow.config.json';+ // Validate path to prevent traversal attacks+ const safePath = validateConfigPath(inputPath);const loadedAt = new Date().toISOString();let config: Configuration = { ...DEFAULT_CONFIG };@@ -218,7 +254,7 @@ async function handleLoadConfig(// Try to load from filesystemtry {const fs = await import('fs/promises');- const fileContent = await fs.readFile(path, 'utf-8');+ const fileContent = await fs.readFile(safePath, 'utf-8');const loadedConfig = JSON.parse(fileContent) as Configuration;if (input.merge) {@@ -256,7 +292,9 @@ async function handleSaveConfig(input: z.infer<typeof saveConfigSchema>,context?: ToolContext): Promise<SaveConfigResult> {- const path = input.path || './claude-flow.config.json';+ const inputPath = input.path || './claude-flow.config.json';+ // Validate path to prevent traversal attacks+ const safePath = validateConfigPath(inputPath);const savedAt = new Date().toISOString();let backupPath: string | undefined;@@ -266,8 +304,8 @@ async function handleSaveConfig(// Create backup if requestedif (input.createBackup) {try {- const existingContent = await fs.readFile(path, 'utf-8');- backupPath = `${path}.backup.${Date.now()}`;+ const existingContent = await fs.readFile(safePath, 'utf-8');+ backupPath = `${safePath}.backup.${Date.now()}`;await fs.writeFile(backupPath, existingContent, 'utf-8');} catch (error: any) {// Ignore if file doesn't exist@@ -281,7 +319,7 @@ async function handleSaveConfig(let configToSave = input.config;if (input.merge) {try {- const existingContent = await fs.readFile(path, 'utf-8');+ const existingContent = await fs.readFile(safePath, 'utf-8');const existingConfig = JSON.parse(existingContent);configToSave = { ...existingConfig, ...input.config };} catch (error: any) {@@ -293,11 +331,11 @@ async function handleSaveConfig(}// Save the configuration- await fs.writeFile(path, JSON.stringify(configToSave, null, 2), 'utf-8');+ await fs.writeFile(safePath, JSON.stringify(configToSave, null, 2), 'utf-8');return {saved: true,- path,+ path: safePath,scope: input.scope,savedAt,backupPath,