🌊 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
sec: cap MCP stdin buffer at 10MB to prevent DoS via un-newlined input
Reuven0535c382392f
diff --git a/v3/@claude-flow/cli/bin/cli.js b/v3/@claude-flow/cli/bin/cli.jsindex 2e4c4a79a0..a479a8ed1c 100755--- a/v3/@claude-flow/cli/bin/cli.js+++ b/v3/@claude-flow/cli/bin/cli.js@@ -54,10 +54,31 @@ if (isMCPMode) {`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${sessionId}) Starting in stdio mode`);+ // Audit-flagged DoS protection (audit_1776483149979): cap the+ // newline-buffered stdin parser so a malicious client cannot pipe+ // gigabytes of un-newlined data and exhaust memory before+ // JSON.parse runs. 10MB is far above any legitimate MCP message+ // (the protocol's largest realistic payloads — tool descriptions,+ // batch search results — top out at ~1MB).+ const MCP_MAX_BUFFER_BYTES = 10 * 1024 * 1024;let buffer = '';process.stdin.setEncoding('utf8');process.stdin.on('data', async (chunk) => {buffer += chunk;+ if (buffer.length > MCP_MAX_BUFFER_BYTES) {+ // Drop the buffer + emit a protocol-level error so the client+ // sees the rejection rather than a silent OOM.+ console.log(JSON.stringify({+ jsonrpc: '2.0',+ id: null,+ error: {+ code: -32700,+ message: `Buffered stdin exceeds ${MCP_MAX_BUFFER_BYTES} bytes without newline; resetting`,+ },+ }));+ buffer = '';+ return;+ }let lines = buffer.split('\n');buffer = lines.pop() || '';diff --git a/v3/@claude-flow/cli/bin/mcp-server.js b/v3/@claude-flow/cli/bin/mcp-server.jsindex 3715be2d30..60801cf240 100755--- a/v3/@claude-flow/cli/bin/mcp-server.js+++ b/v3/@claude-flow/cli/bin/mcp-server.js@@ -48,12 +48,28 @@ console.error(JSON.stringify({}));// Handle stdin messages+// Audit-flagged DoS protection (audit_1776483149979): cap stdin buffer+// to 10MB. See bin/cli.js for the same protection on the auto-detect path.+const MCP_MAX_BUFFER_BYTES = 10 * 1024 * 1024;let buffer = '';process.stdin.setEncoding('utf8');process.stdin.on('data', async (chunk) => {buffer += chunk;+ if (buffer.length > MCP_MAX_BUFFER_BYTES) {+ console.log(JSON.stringify({+ jsonrpc: '2.0',+ id: null,+ error: {+ code: -32700,+ message: `Buffered stdin exceeds ${MCP_MAX_BUFFER_BYTES} bytes without newline; resetting`,+ },+ }));+ buffer = '';+ return;+ }+// Process complete JSON messages (newline-delimited)let lines = buffer.split('\n');buffer = lines.pop() || ''; // Keep incomplete line in buffer