🌊 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(ruflo-console): close Windows autopilot guard gaps and binary-planting paths (#4491) (#4494)
daak264b346479f3
diff --git a/plugins/ruflo-console/.claude-plugin/plugin.json b/plugins/ruflo-console/.claude-plugin/plugin.jsonindex ca1dec8b96..0875d7d2b9 100644--- a/plugins/ruflo-console/.claude-plugin/plugin.json+++ b/plugins/ruflo-console/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "ruflo-console","description": "ruflo's cockpit inside Claude Code and the one /ruflo command for every ruflo mod (function hooks, early access). Views: overview with health alerts, swarm topology graph, claims flow with TTL rings, federation map, plugin health matrix, learning curve and pipeline, MetaHarness radar and audit trend, memory, cost gauge, agent timeline, approvals queue, event stream, a main menu, an x.ruv.io federation board, an AI terminal (codex, claude or both in remembered sessions, streamed), Skills (npx skills), a Hive-Mind view, a MetaHarness lab, agent drill-down; a command palette for confirm-gated actions through the ruflo CLI; a band above the prompt. Reads ruflo's files and the CLI's local JSON; anything not measured reads n/a. The one network call it makes by itself is a daily read of the published plugin.json at github.com/ruvnet/ruflo to offer an update (Settings \u2192 Updates: ask, auto, or off); it installs only through Claude Code's own claude plugin update, and never a new major version without asking.",- "version": "0.49.1",+ "version": "0.49.2","author": {"name": "ruvnet","url": "https://github.com/ruvnet"diff --git a/plugins/ruflo-console/CHANGELOG.md b/plugins/ruflo-console/CHANGELOG.mdindex 0264f13a58..70f004ddfe 100644--- a/plugins/ruflo-console/CHANGELOG.md+++ b/plugins/ruflo-console/CHANGELOG.md@@ -2,6 +2,9 @@Newest first. One `## <version> — <date>` heading per version, then `feat:`, `fix:`, `breaking:` and `chore:` bullets (ADR-478). Built from git history; older versions: `git log -- plugins/ruflo-console`.+## 0.49.2 — 2026-10-25+- fix: Windows autopilot path guards and binary-planting hardening (#4491). Matches extended namespaces (`\\?\`), device paths (`\\.\`), drive-relative paths (`C:foo`), and UNC forward-slash shares; denies envelope edits under backslashes; rejects root drive envelope paths and `.bat`/`.cmd` targets; hardens against NTFS alternate data streams and parent traversals; and resolves `powershell.exe` and `where.exe` explicitly from System32.+## 0.49.1 — 2026-10-25- fix: the Plugin Catalog reads the marketplace clone on Windows. The clone's location is a drive path (`C:\Users\…\marketplaces\ruflo`), and the catalog refused anything not starting with `/`, so it said "the clone's marketplace.json is not readable" while the file was there. The catalog, each plugin's folder, and the plugins view's freshness row now use the shared path helpers (`paths.ts`).- fix: **forget history** (Events) and **forget saved views** (Workflows) work on Windows. They ran `rm -f`, which Windows does not have; there the files are emptied through the host file API (saved views as a valid empty document) and the result is verified by what the file holds. Linux and macOS are unchanged.diff --git a/plugins/ruflo-console/hooks/data/ap-envelope.ts b/plugins/ruflo-console/hooks/data/ap-envelope.tsindex 2289ca7f7a..51583a9854 100644--- a/plugins/ruflo-console/hooks/data/ap-envelope.ts+++ b/plugins/ruflo-console/hooks/data/ap-envelope.ts@@ -4,7 +4,7 @@* hash does not match its body is treated as tampered and the loop refuses to run on it. Hard denies are not part of the envelope: they* are a constant of this file, and an envelope that names one as allowed is rejected, never trimmed.*/-import { below, hasParentSegment, isAbsolutePath, isWindowsPath, samePath, trimTrailing } from './paths'+import { below, hasParentSegment, isAbsolutePath, isWindowsPath, normalizePath, samePath, trimTrailing } from './paths'/** Classes of action an envelope can allow. Each task is classified (data/ap-guard.ts) into exactly one, or is parked. */export const TOOL_CLASSES = ['read', 'edit', 'test', 'git-local', 'git-branch', 'network', 'spawn', 'mcp'] as const@@ -23,7 +23,7 @@ export const DENY_PATTERNS: readonly [HardDeny, RegExp][] = [['secret-access', /\b(api[_ -]?key|secret|credential|password|private\s+key|\.env\b|gcloud\s+secrets|token)\b/i],// The second line is the Windows forms: cmd's `rmdir /s`, `del C:\`, `format C:`, PowerShell's `Remove-Item -Recurse`, and rm on a drive or a variable.['delete-outside-worktree', /\b(rm\s+-rf?\s+(\/|~|\$HOME)|delete\s+(the\s+)?(home|root|\/)|drop\s+database|mkfs|dd\s+of=\/dev|(rmdir|rd)\s+\/s\b|(del|erase)\s+(\/[a-z]+\s+)*[A-Za-z]:[\\/]|format\s+[A-Za-z]:|Remove-Item\b[^\n]{0,120}-Recurse|rm\s+-rf?\s+([A-Za-z]:|%|\$env:))/i],- ['envelope-edit', /\b(autopilot\s+(envelope|scope|settings)|widen\s+(the\s+)?(envelope|scope)|raise\s+(the\s+)?(spend|budget)\s+(cap|ceiling)|grant\s+(itself|autopilot))|\.claude-flow\/(console\/autopilot|protector-mod)|autopilot\/(envelope|journal|kill)|protector-mod|\b(clear|remove|delete|rm|unset|touch)\b[^\n]{0,40}\bkill\s*(flag|switch|file)\b/i],+ ['envelope-edit', /\b(autopilot\s+(envelope|scope|settings)|widen\s+(the\s+)?(envelope|scope)|raise\s+(the\s+)?(spend|budget)\s+(cap|ceiling)|grant\s+(itself|autopilot))|\.claude-flow[\\/](console[\\/]autopilot|protector-mod)|autopilot[\\/](envelope|journal|kill)|protector-mod|\b(clear|remove|delete|rm|unset|touch)\b[^\n]{0,40}\bkill\s*(flag|switch|file)\b/i],]/** Folders the autopilot's own steps may never be pointed at: its envelope, journal and kill flag, and Project Anatole's status. A task or envelope that names one is refused, not trimmed. */@@ -45,8 +45,18 @@ const hasCmdSubstitution = (part: string): boolean => /[`\n]|\$\(|;|&&|\|\||\|/./** Why a verify argv is refused, or null. The program is its basename; a shell metacharacter in any part, a banned program or a hard-deny word refuses it. */export function verifyProblem(argv: readonly string[]): string | null {- // The basename under either separator, without a Windows executable suffix: `C:\Windows\System32\cmd.exe` is `cmd`, `bash.exe` is `bash`.- const program = (argv[0] ?? '').split(/[\\/]/).at(-1)?.toLowerCase().replace(/\.(exe|com|cmd|bat|ps1)$/, '') ?? ''+ const rawTarget = (argv[0] ?? '').split(/[\\/]/).at(-1)?.toLowerCase() ?? ''++ // Refuse batch scripts directly: on Windows they invoke cmd.exe which executes shell metacharacters (&, %, ^, etc.)+ if (/\.(bat|cmd)$/i.test(rawTarget)) {+ return `"${rawTarget.slice(0, 20)}" is a batch script and runs through cmd; give a binary or executable program instead`+ }++ // Strip Windows executable suffixes repeatedly: cmd.exe.exe -> cmd.exe -> cmd+ let program = rawTarget+ while (/\.(exe|com|cmd|bat|ps1)$/i.test(program)) {+ program = program.replace(/\.(exe|com|cmd|bat|ps1)$/i, '')+ }if (VERIFY_BANNED.has(program) || WINDOWS_BANNED.has(program)) return `"${program.slice(0, 20)}" is a shell, a wrapper or a destructive or network tool and cannot be a verify command`if (argv.some(hasCmdSubstitution)) return 'a verify part holds a shell metacharacter (; | & ` $( newline): give a program and its arguments only'@@ -126,7 +136,10 @@ export function validateEnvelope(raw: unknown): Checked {if (paths === null || paths.length === 0) errors.push('paths: at least one absolute folder')for (const path of paths ?? []) {- if (!isAbsolutePath(path) || path === '/' || /^[A-Za-z]:[\\/]?$/.test(path) || path.length > 300 || BAD_CHARS.test(path) || hasParentSegment(path) || (path.includes('\\') && !isWindowsPath(path))) errors.push(`paths: "${path.slice(0, 40)}" is not an absolute folder below the root with no ..`)+ const norm = trimTrailing(normalizePath(path))+ const isDriveRoot = /^[A-Za-z]:[\\/]*$/.test(norm) || /^[A-Za-z]:$/.test(norm)+ const hasNamespace = path.startsWith('\\\\?\\') || path.startsWith('\\\\.\\') || path.startsWith('//?/') || path.startsWith('//./')+ if (!isAbsolutePath(path) || hasNamespace || norm === '/' || norm === '' || isDriveRoot || path.length > 300 || BAD_CHARS.test(path) || hasParentSegment(path) || (path.includes('\\') && !isWindowsPath(path))) errors.push(`paths: "${path.slice(0, 40)}" is not an absolute folder below the root with no ..`)else if (isProtectedPath(path)) errors.push(`paths: "${path.slice(0, 40)}" is the autopilot's or Project Anatole's own folder: steps are never pointed at it`)}@@ -342,7 +355,7 @@ export function narrowed(prev: Envelope, next: Envelope): string[] {}/** A path is inside the envelope when it is one of its folders or below one (compared at a folder boundary, so /a/bc is not inside /a/b). Windows paths compare ignoring case and separator style, so `C:\work\app\file.ts` is inside envelope path `C:\work\app`. */-export const pathAllowed = (envelope: Envelope, path: string): boolean => !hasParentSegment(path) && !isProtectedPath(path) && envelope.paths.some(root => samePath(root, path) || below(root, path) !== null)+export const pathAllowed = (envelope: Envelope, path: string): boolean => !hasParentSegment(path) && !isProtectedPath(path) && !path.startsWith('\\\\?\\') && !path.startsWith('\\\\.\\') && isAbsolutePath(path) && envelope.paths.some(root => samePath(root, path) || below(root, path) !== null)export const hostAllowed = (envelope: Envelope, host: string): boolean => envelope.network.includes(host.toLowerCase())diff --git a/plugins/ruflo-console/hooks/data/ap-guard.ts b/plugins/ruflo-console/hooks/data/ap-guard.tsindex 13e158c72c..36ae5c33b8 100644--- a/plugins/ruflo-console/hooks/data/ap-guard.ts+++ b/plugins/ruflo-console/hooks/data/ap-guard.ts@@ -28,13 +28,16 @@ const CLASS_WORDS: readonly [ToolClass, RegExp][] = []const PATH = /(?:^|[\s"'`(=:])(\/(?:[A-Za-z0-9._@-]+\/)*[A-Za-z0-9._@-]+)/g-/** An absolute Windows path: a drive (`C:\proj\x`, `C:/proj`, `C:\`) or a share (`\\srv\share\x`). It is checked against the envelope's folders like a POSIX one. */-const WINDOWS_PATH = /(?:^|[\s"'`(=])([A-Za-z]:[\\/](?:(?:[A-Za-z0-9._@-]+[\\/])*[A-Za-z0-9._@-]+)?|\\\\[A-Za-z0-9._-]+\\[A-Za-z0-9._$-]+(?:\\[A-Za-z0-9._@-]+)*)/g/**- * A path that is not absolute (home, a variable, a parent): it is never inside the envelope's folders, so a task naming one is parked.- * Either separator, and the Windows variables (`%USERPROFILE%\x`, `$env:USERPROFILE\x`) next to `~` and `$HOME`.+ * An absolute Windows path: a drive (`C:\proj\x`, `C:/proj`, `C:\`), spaces in folder names (`C:\Program Files\x`),+ * extended length (`\\?\C:\x`), or a share (`\\srv\share\x` or `//srv/share/x`). It is checked against the envelope's folders like a POSIX one.*/-const RELATIVE_PATH = /(?:^|[\s"'`(=:])(~[\\/]\S*|~(?=\s|$)|\$\{?HOME\}?(?:\/\S*)?|%[A-Za-z_]{1,24}%(?:[\\/]\S*)?|\$env:[A-Za-z_]{1,24}(?:[\\/]\S*)?|\.\.[\\/]\S*|\.\.(?=\s|$))/g+const WINDOWS_PATH = /(?:^|[\s"'`(=])((?:\\\\[?.]\\[A-Za-z]:[\\/]|[A-Za-z]:[\\/])(?:(?:[A-Za-z0-9._@ -]+[\\/])*[A-Za-z0-9._@-]+)?|(?:\\\\|\/\/)[A-Za-z0-9._-]+[\\/][A-Za-z0-9._$-]+(?:\\[A-Za-z0-9._@ -]+|\/[A-Za-z0-9._@ -]+)*)/g+/**+ * A path that is not absolute (home, a variable, a parent, drive-relative or raw device namespace): it is never inside the envelope's folders, so a task naming one is parked.+ * Either separator, Windows variables (`%USERPROFILE%\x`, `$env:USERPROFILE\x`), drive-relative (`C:foo`), device (`\\.\`), extended (`\\?\`), and `~` / `$HOME`.+ */+const RELATIVE_PATH = /(?:^|[\s"'`(=:])(~[\\/]\S*|~(?=\s|$)|\$\{?HOME\}?(?:\/\S*)?|%[A-Za-z_]{1,24}%(?:[\\/]\S*)?|\$env:[A-Za-z_]{1,24}(?:[\\/]\S*)?|\.\.[\\/]\S*|\.\.(?=\s|$)|[A-Za-z]:[^\\/\s"'`(=:][^\s"'`(=:]*|\\\\[?.]\\[^\s"'`(=:]*)/g/** Verbs whose effect the class words do not capture (they leave the machine, change the system or run arbitrary code): a task using one is parked instead of guessed. */const UNPLACED = /\b(push(es|ed|ing)?|install(s|ed|ing)?|uninstall|upload|send|post|e-?mail|ssh|scp|rsync|sudo|execute|exec|kill|chmod|chown|shred|wipe|systemctl|crontab)\b/i@@ -55,7 +58,7 @@ export function classifyTask(id: string, title: string, requirement = ''): TaskFconst hardDeny = DENIES.find(([, pattern]) => pattern.test(text))?.[0] ?? nullconst hits = CLASS_WORDS.filter(([, pattern]) => pattern.test(text)).map(([cls]) => cls)const cls = hits.length === 0 || UNPLACED.test(text) ? null : (hits.at(-1) as ToolClass)- const paths = [...new Set([...[...text.matchAll(PATH)], ...[...text.matchAll(WINDOWS_PATH)], ...[...text.matchAll(RELATIVE_PATH)]].map(m => m[1] as string))].slice(0, 12)+ const paths = [...new Set([...[...text.matchAll(PATH)], ...[...text.matchAll(WINDOWS_PATH)], ...[...text.matchAll(RELATIVE_PATH)]].map(m => (m[1] as string).trimEnd()))].slice(0, 12)const urls = [...text.matchAll(URLS)]const hosts = [...new Set(urls.map(match => (match[1] as string).toLowerCase()))].slice(0, 8)const repos = [...new Set(urls.flatMap(match => ((match[1] as string).toLowerCase() === 'github.com' ? [repoOf(match[2] as string)] : []).filter((name): name is string => name !== null)))].slice(0, 8)diff --git a/plugins/ruflo-console/hooks/data/paths.ts b/plugins/ruflo-console/hooks/data/paths.tsindex df1f2ee09c..38c026bb3f 100644--- a/plugins/ruflo-console/hooks/data/paths.ts+++ b/plugins/ruflo-console/hooks/data/paths.ts@@ -44,8 +44,24 @@ export function samePath(a: string, b: string): boolean {return a === b}-/** True when the path has a `..` segment (either separator for a Windows path). Callers refuse it themselves. */-export const hasParentSegment = (p: string): boolean => (isWindowsPath(p) ? p.split(/[\\/]/) : p.split('/')).includes('..')+/** True when the path has a `..` segment (either separator for a Windows path), an NTFS alternate data stream (`:`), or segments resolving to parent traversal. */+export function hasParentSegment(p: string): boolean {+ if (isWindowsPath(p)) {+ // Reject NTFS alternate data streams: colon after the drive prefix (e.g. C:\foo:stream:$DATA)+ const afterDrive = p.replace(/^[A-Za-z]:/, '')+ if (afterDrive.includes(':')) return true++ const segments = p.split(/[\\/]/)+ return segments.some(seg => {+ if (seg === '..') return true+ const trimmed = seg.replace(/[. ]+$/, '')+ return trimmed === '..' || /^\.{2,}[. ]*$/.test(seg)+ })+ }++ const segments = p.split('/')+ return segments.some(seg => seg === '..' || /^\.{2,}[. ]*$/.test(seg))+}/*** The path with empty and `.` segments and a trailing separator dropped. A POSIX path comes back as `/a/b`; a Windows path keeps thediff --git a/plugins/ruflo-console/hooks/data/wf-control.ts b/plugins/ruflo-console/hooks/data/wf-control.tsindex 7b91c2e103..e41d382266 100644--- a/plugins/ruflo-console/hooks/data/wf-control.ts+++ b/plugins/ruflo-console/hooks/data/wf-control.ts@@ -98,13 +98,14 @@ const utf8Base64 = (text: string): string => btoa(Array.from(new TextEncoder().e* parsed as PowerShell (a path with a space, a quote or a `$` is only data); the script itself has no double quote. Null for a run id that is* not one, a path with a NUL, or a host without TextEncoder/btoa.*/-export function windowsSearchArgv(path: string, runId: string): readonly string[] | null {+export function windowsSearchArgv(path: string, runId: string, systemRoot = (typeof process !== 'undefined' && process.env?.SystemRoot) || 'C:\\Windows'): readonly string[] | null {if (!RUN_ID.test(runId) || path === '' || path.includes('\0') || typeof TextEncoder !== 'function' || typeof btoa !== 'function') return nullconst text = (value: string): string => `[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('${utf8Base64(value)}'))`const script = `$p=${text(path)};$q=${text(taskPattern(runId))};Select-String -LiteralPath $p -Pattern $q -AllMatches | ForEach-Object { $_.Matches } | ForEach-Object { $_.Value }`+ const psPath = `${systemRoot.replace(/[\\/]+$/, '')}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`- return ['powershell', '-NoProfile', '-NonInteractive', '-Command', script]+ return [psPath, '-NoProfile', '-NonInteractive', '-Command', script]}/** The session transcript that launched a run: the run's directory (`<session>/subagents/workflows/<run>`) without its tail, plus `.jsonl`. Null when the path is not a run path. */diff --git a/plugins/ruflo-console/hooks/version.ts b/plugins/ruflo-console/hooks/version.tsindex fec277af46..8d3814115c 100644--- a/plugins/ruflo-console/hooks/version.ts+++ b/plugins/ruflo-console/hooks/version.ts@@ -2,4 +2,4 @@* The console's version, shown on the header so a person can tell which build is running. Kept equal to the plugin's manifest* (`.claude-plugin/plugin.json`); tests/version.spec.ts fails if the two drift.*/-export const CONSOLE_VERSION = '0.49.1'+export const CONSOLE_VERSION = '0.49.2'diff --git a/plugins/ruflo-console/hooks/wf-convo-live.ts b/plugins/ruflo-console/hooks/wf-convo-live.tsindex 2db76114ca..87ae66edfa 100644--- a/plugins/ruflo-console/hooks/wf-convo-live.ts+++ b/plugins/ruflo-console/hooks/wf-convo-live.ts@@ -81,8 +81,11 @@ export async function refreshFacts(state: State, nowMs: number): Promise<void> {if (live.home !== null) live.peers = peersOf(await host.fs.read(`${live.home}/.claude/federation/peers.json`).then(text => (text.length > 200_000 ? null : text), () => null))- // `where` is Windows' `which`; the home folder tells the two apart (a drive-lettered or share path is a Windows one).- const finder = live.home !== null && isWindowsPath(live.home) ? 'where' : 'which'+ // `where` is Windows' `which`; call System32\where.exe to prevent binary-planting from the current directory+ const systemRoot = (typeof process !== 'undefined' && process.env?.SystemRoot) || 'C:\\Windows'+ const finder = live.home !== null && isWindowsPath(live.home)+ ? `${systemRoot.replace(/[\\/]+$/, '')}\\System32\\where.exe`+ : 'which'const found = await host.run([finder, 'codex'], 3000).catch(() => undefined)live.hasCodex = found !== undefined && found.exitCode === 0diff --git a/plugins/ruflo-console/scripts/smoke.sh b/plugins/ruflo-console/scripts/smoke.shindex 7c8318f3bc..752b3c2b2b 100755--- a/plugins/ruflo-console/scripts/smoke.sh+++ b/plugins/ruflo-console/scripts/smoke.sh@@ -11,9 +11,9 @@ step() { printf "→ %s ... " "$1"; }ok() { printf "PASS\n"; PASS=$((PASS+1)); }bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }-step "1. plugin.json declares ruflo-console 0.49.1"+step "1. plugin.json declares ruflo-console 0.49.2"grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \- && grep -q '"version": "0.49.1"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"+ && grep -q '"version": "0.49.2"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"step "2. hooks.json names exactly one module and no classic hook commands"grep -q '"modules": \["./register.ts"\]' "$HOOKS/hooks.json" && ! grep -q '"command"' "$HOOKS/hooks.json" \diff --git a/plugins/ruflo-console/tests/ap-envelope-windows-paths.spec.ts b/plugins/ruflo-console/tests/ap-envelope-windows-paths.spec.tsindex 7ff8150648..1b59f3d967 100644--- a/plugins/ruflo-console/tests/ap-envelope-windows-paths.spec.ts+++ b/plugins/ruflo-console/tests/ap-envelope-windows-paths.spec.ts@@ -52,8 +52,8 @@ describe('validateEnvelope on Windows paths', () => {if (result.ok) expect(result.envelope.paths).toEqual(['\\\\server\\share\\app'])})- it('still refuses the bare drive root in either separator', () => {- for (const bad of ['C:', 'C:\\', 'C:/']) {+ it('still refuses the bare drive root in either separator and with trailing slash, dot or device prefix', () => {+ for (const bad of ['C:', 'C:\\', 'C:/', 'C:\\\\', 'C:\\.', '\\\\?\\C:\\', '\\\\.\\C:\\']) {const result = validateEnvelope(envWith([bad]))expect(result.ok).toBe(false)diff --git a/plugins/ruflo-console/tests/ap-windows-guard.spec.ts b/plugins/ruflo-console/tests/ap-windows-guard.spec.tsindex 16dbe2a622..d8ed67498c 100644--- a/plugins/ruflo-console/tests/ap-windows-guard.spec.ts+++ b/plugins/ruflo-console/tests/ap-windows-guard.spec.ts@@ -19,13 +19,17 @@ describe('a task that names a Windows path is checked against the envelope foldeexpect(pathsOf('review "D:\\data\\x.csv"')).toContain('D:\\data\\x.csv')expect(pathsOf('wipe C:\\')).toContain('C:\\')expect(pathsOf('copy to \\\\srv\\share\\out')).toContain('\\\\srv\\share\\out')+ expect(pathsOf('review //srv/share/out')).toContain('//srv/share/out')+ expect(pathsOf('edit C:\\Program Files\\app\\config.json')).toContain('C:\\Program Files\\app\\config.json')+ expect(pathsOf('review \\\\?\\C:\\Windows\\System32\\cmd.exe')).toContain('\\\\?\\C:\\Windows\\System32\\cmd.exe')})- it('finds a parent, home or variable path written the Windows way', () => {+ it('finds a parent, home, drive-relative or variable path written the Windows way', () => {expect(pathsOf('read ..\\..\\secrets.txt')).toContain('..\\..\\secrets.txt')expect(pathsOf('review ~\\notes.md')).toContain('~\\notes.md')expect(pathsOf('review %USERPROFILE%\\Documents\\x')).toContain('%USERPROFILE%\\Documents\\x')expect(pathsOf('review $env:USERPROFILE\\Documents')).toContain('$env:USERPROFILE\\Documents')+ expect(pathsOf('edit C:foo\\bar.txt')).toContain('C:foo\\bar.txt')})it('leaves the POSIX reading exactly as it was', () => {@@ -41,6 +45,10 @@ describe('a task that names a Windows path is checked against the envelope foldeexpect(pathAllowed(env, '..\\..\\secrets.txt')).toBe(false)expect(pathAllowed(env, '%USERPROFILE%\\Documents')).toBe(false)expect(pathAllowed(env, 'C:\\proj\\..\\Windows')).toBe(false)+ expect(pathAllowed(env, '\\\\?\\C:\\proj\\src\\a.ts')).toBe(false)+ expect(pathAllowed(env, 'C:foo\\bar.txt')).toBe(false)+ expect(pathAllowed(env, 'C:\\proj\\file.txt:stream:$DATA')).toBe(false)+ expect(pathAllowed(env, 'C:\\proj\\.. \\Windows')).toBe(false)})})@@ -59,14 +67,27 @@ describe('the destructive-command deny covers the Windows forms', () => {})describe('a verify command cannot be a Windows shell or a destructive Windows tool', () => {- it('refuses a program by its basename under either separator and without .exe', () => {- for (const argv of [['C:\\Windows\\System32\\cmd.exe', '/c', 'dir'], ['cmd', '/c', 'dir'], ['powershell', '-Command', 'x'], ['pwsh.exe', '-c', 'x'], ['bash.exe', '-c', 'x'], ['C:/Program Files/Git/bin/bash.exe', '-c', 'x'], ['taskkill', '/f', '/im', 'node.exe'], ['wsl', 'ls'], ['reg', 'delete', 'HKCU\\x']]) {- expect(verifyProblem(argv), argv.join(' ')).toMatch(/cannot be a verify command/)+ it('refuses a program by its basename under either separator, batch files and without .exe', () => {+ for (const argv of [+ ['C:\\Windows\\System32\\cmd.exe', '/c', 'dir'],+ ['cmd', '/c', 'dir'],+ ['cmd.exe.exe', '/c', 'dir'],+ ['powershell', '-Command', 'x'],+ ['pwsh.exe', '-c', 'x'],+ ['bash.exe', '-c', 'x'],+ ['C:/Program Files/Git/bin/bash.exe', '-c', 'x'],+ ['taskkill', '/f', '/im', 'node.exe'],+ ['wsl', 'ls'],+ ['reg', 'delete', 'HKCU\\x'],+ ['pnpm.cmd', 'test'],+ ['foo.bat', 'run'],+ ]) {+ expect(verifyProblem(argv), argv.join(' ')).toMatch(/cannot be a verify command|batch script/)}})it('still accepts the programs a verify command is for, on either platform', () => {- for (const argv of [['node', 'a.js'], ['C:\\Program Files\\nodejs\\node.exe', 'a.js'], ['pnpm.cmd', 'test'], ['npx', 'vitest', 'run'], ['/usr/bin/git', 'status']]) {+ for (const argv of [['node', 'a.js'], ['C:\\Program Files\\nodejs\\node.exe', 'a.js'], ['pnpm', 'test'], ['npx', 'vitest', 'run'], ['/usr/bin/git', 'status']]) {expect(verifyProblem(argv), argv.join(' ')).toBeNull()}})@@ -76,3 +97,17 @@ describe('a verify command cannot be a Windows shell or a destructive Windows toexpect(verifyProblem(['npm', 'test', ';', 'x'])).toMatch(/shell metacharacter/)})})++describe('the envelope-edit deny pattern covers Windows paths', () => {+ it('denies envelope and kill editing under both / and \\', () => {+ for (const task of [+ 'edit .claude-flow/console/autopilot/envelope.json',+ 'edit .claude-flow\\console\\autopilot\\envelope.json',+ 'touch autopilot/kill',+ 'touch autopilot\\kill',+ 'rm .claude-flow\\protector-mod',+ ]) {+ expect(denyOf(task), task).toBe('envelope-edit')+ }+ })+})diff --git a/plugins/ruflo-console/tests/wf-control-windows.spec.ts b/plugins/ruflo-console/tests/wf-control-windows.spec.tsindex f5a175f687..f0930c4b21 100644--- a/plugins/ruflo-console/tests/wf-control-windows.spec.ts+++ b/plugins/ruflo-console/tests/wf-control-windows.spec.ts@@ -14,7 +14,8 @@ describe('windowsSearchArgv', () => {it('is a PowerShell command whose script has no double quote, and carries the path and the pattern only as base64', () => {const argv = windowsSearchArgv('C:\\Users\\John Smith\\.claude\\projects\\a$b\'c;d&e\\s.jsonl', 'wf_abc12345') as readonly string[]- expect(argv.slice(0, 4)).toEqual(['powershell', '-NoProfile', '-NonInteractive', '-Command'])+ expect(argv[0]).toMatch(/System32\\WindowsPowerShell\\v1\.0\\powershell\.exe$/i)+ expect(argv.slice(1, 4)).toEqual(['-NoProfile', '-NonInteractive', '-Command'])expect(argv).toHaveLength(5)expect(argv[4]).not.toContain('"')expect(argv[4]).not.toContain('John Smith')diff --git a/plugins/ruflo-console/tests/wf-convo-finder.spec.ts b/plugins/ruflo-console/tests/wf-convo-finder.spec.tsindex aae9860024..9856bb6ab9 100644--- a/plugins/ruflo-console/tests/wf-convo-finder.spec.ts+++ b/plugins/ruflo-console/tests/wf-convo-finder.spec.ts@@ -18,7 +18,7 @@ async function factsFor(home: string, hasCodex: boolean): Promise<{ finders: strfinders.push(`${argv[0]} ${argv[1]}`)// Only the finder the platform has answers; the other "is not recognised".- const platformFinder = home.startsWith('/') ? 'which' : 'where'+ const platformFinder = home.startsWith('/') ? 'which' : 'C:\\Windows\\System32\\where.exe'return found(argv[0] === platformFinder && hasCodex ? 0 : 127)},@@ -35,11 +35,11 @@ async function factsFor(home: string, hasCodex: boolean): Promise<{ finders: strdescribe('finding codex for the Conversation board', () => {it('uses `where` on a Windows home (drive path) and finds codex', async () => {- expect(await factsFor('C:\\Users\\u', true)).toEqual({ finders: ['where codex'], hasCodex: true })+ expect(await factsFor('C:\\Users\\u', true)).toEqual({ finders: ['C:\\Windows\\System32\\where.exe codex'], hasCodex: true })})it('uses `where` on a share home too, and says no codex when it is not there', async () => {- expect(await factsFor('\\\\srv\\home\\u', false)).toEqual({ finders: ['where codex'], hasCodex: false })+ expect(await factsFor('\\\\srv\\home\\u', false)).toEqual({ finders: ['C:\\Windows\\System32\\where.exe codex'], hasCodex: false })})it('keeps `which` on a POSIX home', async () => {