🌊 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
fix(guard): a quoted empty substitution leaves the word as bash does; # after it stays in the word (#3791)
Dragan Spiridonov5ae95050c757
diff --git a/.claude/helpers/hook-handler.cjs b/.claude/helpers/hook-handler.cjsindex 88dc1f1d7b..dc03f9693b 100755--- a/.claude/helpers/hook-handler.cjs+++ b/.claude/helpers/hook-handler.cjs@@ -543,6 +543,10 @@ const handlers = {else if (quote === '"' && char === '\x60' && command.indexOf('\x60', i + 1) > i) {const [end, denied] = substitution(i + 1, true)if (denied) return true+ // The substitution is gone from the word, as bash's empty output is (a quoted empty substitution glued to -rf leaves -rf).+ // A # right after it is still inside the word: a placeholder keeps a rescan (sh -c "...")+ // from reading it as the start of a comment.+ if (command[end + 1] === '#') word += '\u0001'i = end}else if (quote === '"' && char === '\\' && i + 1 < command.length &&diff --git a/plugins/ruflo-mods/hooks/guard/dangerous-command.ts b/plugins/ruflo-mods/hooks/guard/dangerous-command.tsindex 98976f8284..461c94afd7 100644--- a/plugins/ruflo-mods/hooks/guard/dangerous-command.ts+++ b/plugins/ruflo-mods/hooks/guard/dangerous-command.ts@@ -68,6 +68,10 @@ function hasRootDelete(command: string, depth = 0): boolean {else if (quote === '"' && char === '\x60' && command.indexOf('\x60', i + 1) > i) {const [end, denied] = substitution(i + 1, true)if (denied) return true+ // The substitution is gone from the word, as bash's empty output is (a quoted empty substitution glued to -rf leaves -rf).+ // A # right after it is still inside the word: a placeholder keeps a rescan (sh -c "...")+ // from reading it as the start of a comment.+ if (command[end + 1] === '#') word += '\u0001'i = end}else if (quote === '"' && char === '\\' && i + 1 < command.length &&diff --git a/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs b/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjsindex 88dc1f1d7b..dc03f9693b 100755--- a/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs+++ b/v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs@@ -543,6 +543,10 @@ const handlers = {else if (quote === '"' && char === '\x60' && command.indexOf('\x60', i + 1) > i) {const [end, denied] = substitution(i + 1, true)if (denied) return true+ // The substitution is gone from the word, as bash's empty output is (a quoted empty substitution glued to -rf leaves -rf).+ // A # right after it is still inside the word: a placeholder keeps a rescan (sh -c "...")+ // from reading it as the start of a comment.+ if (command[end + 1] === '#') word += '\u0001'i = end}else if (quote === '"' && char === '\\' && i + 1 < command.length &&diff --git a/v3/@claude-flow/cli/__tests__/mods/mods-guard.test.ts b/v3/@claude-flow/cli/__tests__/mods/mods-guard.test.tsindex 631d341d1f..f9e410283c 100644--- a/v3/@claude-flow/cli/__tests__/mods/mods-guard.test.ts+++ b/v3/@claude-flow/cli/__tests__/mods/mods-guard.test.ts@@ -327,6 +327,10 @@ describe('#3698 root deletion guard parity', () => {['echo it` costs; rm -rf /', true],['echo "a ` b"; rm -rf /', true],['echo "a ` b"; ls /', false],+ // A quoted empty substitution glued to a flag leaves the flag; a # after one inside sh -c stays in the word.+ ['\\rm "`true`"--recursive --force /', true],+ ['rm "`true`"-rf /*', true],+ ['bash -c "`true`#x; rm -rf /"', true],['echo `ls` /tmp', false],['format c: /q /y', true],['del /s /q c:\\', true],diff --git a/v3/@claude-flow/cli/src/init/helpers-generator.ts b/v3/@claude-flow/cli/src/init/helpers-generator.tsindex 912ed43b8b..1595a0beaf 100644--- a/v3/@claude-flow/cli/src/init/helpers-generator.ts+++ b/v3/@claude-flow/cli/src/init/helpers-generator.ts@@ -501,6 +501,10 @@ const ROOT_DELETE_CHECK_SOURCE = String.raw`function hasRootDelete(command, deptelse if (quote === '"' && char === '\x60' && command.indexOf('\x60', i + 1) > i) {const [end, denied] = substitution(i + 1, true)if (denied) return true+ // The substitution is gone from the word, as bash's empty output is (a quoted empty substitution glued to -rf leaves -rf).+ // A # right after it is still inside the word: a placeholder keeps a rescan (sh -c "...")+ // from reading it as the start of a comment.+ if (command[end + 1] === '#') word += '\u0001'i = end}else if (quote === '"' && char === '\\' && i + 1 < command.length &&