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

dream(security): #4229 DENYLISTED_ENV_NAMES gaps β€” git/perl/ruby/java hijack family (evaluated, ACCEPT) (#4230)

rUv6cdad1ae0e41
diff --git a/docs/dream-cycle/LEDGER.md b/docs/dream-cycle/LEDGER.md
index 472c683cea..0904957cd8 100644
--- a/docs/dream-cycle/LEDGER.md
+++ b/docs/dream-cycle/LEDGER.md
@@ -233,3 +233,5 @@ as a first-class, high-priority candidate, not a background note.
| 2026-10-11 | security | settings.json risk scanner (#3043) never ran on the one path that fires automatically on every real session boot β€” `hook-handler.cjs`'s `session-restore` command (Claude Code's own `SessionStart` hook) β€” a gap #3835 (10-06) itself disclosed as a future-night item; ported the TS scanner's logic (no build step for `.cjs`) into `scanSessionStartSettingsForRisk()`, validated against a real 2026 npm-worm campaign ("Mini Shai-Hulud") and CVE-2026-25725, both of which use this exact persistence mechanism | #4052 | #4053 | yes | ACCEPT-scoped (post-critique) | 12 new discriminating tests, stash-isolated 10/12 fail baseline β†’ 12/12 pass candidate; adversarial critic found and this session fixed a non-SyntaxError `JSON.parse` failure that would have aborted session-restore itself (narrowed catch copied from the opt-in #3835 MCP path onto an unconditional-boot path); related suites 72/72 pass; full `@claude-flow/cli` suite 207 pre-existing environmental failures unchanged (unbuilt sibling packages), zero touching this change | 016fe07f... | 10-01 #3599 MERGED; 10-02/10-03/10-06/10-07/10-08 open/draft, none stale; 10-04 no-run gap; 10-05 #3754 closed as duplicate; 10-09 #3929, 10-10 #3977 open/draft, not stale. Prior gist (10-10, performance) scored 10/10 (2+2+2+2+1(1489 words)+1) |
**Note (2026-10-15):** verified via `git ls-remote --heads origin "dream/*"` + GitHub MCP tools (not inferred) that 2026-10-12 (intelligence, #4080/#4081), 2026-10-13 (memory, #4137/#4138), and 2026-10-14 (swarm, #4173/#4174) all ran with real branches/issues/draft PRs β€” same "ledger rows only reach `main` via PR merge" structural gap noted since 2026-08-19; not transcribed as their own rows here. Trailing-7-night fates before tonight (GitHub-verified via `pull_request_read`): 10-08 #3909 open/draft; 10-09 #3929 **MERGED** 2026-10-09; 10-10 #3977 **MERGED** 2026-10-10; 10-11 #4053 **MERGED** 2026-10-11; 10-12 #4081 open/draft; 10-13 #4138 open/draft; 10-14 #4174 open/draft β€” none stale (<14d). 10-05 #3754 remains closed-not-merged (duplicate, already recorded). Prior gist (10-14, swarm) scored 10/10 (2+2+2+2+1(1372 words)+1).
| 2026-10-15 | performance | `RaftConsensus.awaitConsensus()` (Ruflo's default hive-mind consensus, reachable via `UnifiedSwarmCoordinator.proposeConsensus()`) busy-polled `this.proposals` via `setInterval(...,10)` even though `checkConsensus()` already emits `'consensus.achieved'` on every accept/reject transition β€” third instance of a busy-poll bug class already fixed twice (UnifiedSwarmCoordinator #3378, MessageBus #3563); also resolved a 3-night research thread (10-09/10-10/10-14) by confirming `ruvector`'s real `minCut`/`louvainCommunities` exports are plain JS, not native-accelerated, so wiring them into `graph-analyzer.ts` would not be a performance win (REJECT, with evidence, not fixed) | #4214 | #4215 | yes | ACCEPT | 4 new discriminating tests, baseline-fails-3-of-4/candidate-passes-4-of-4 via stash isolation (1 correct non-discriminating control); full `@claude-flow/swarm` suite 281/281 (277+4 new), 0 regressions, `tsc --noEmit` clean both ways; standalone wall-clock probe 3.639ms/30 poll-timers β†’ 0.058ms/0 timers (N=30, ~63x mean-latency reduction); independent adversarial critique CONFIRMED, no blocking issues (verified concurrency via 200 simultaneous proposals + same-tick timeout/vote race) | 2ca9c495... | 10-09/10-10/10-11 MERGED; 10-12/10-13/10-14 open/draft, none stale; 10-05 closed-not-merged (duplicate) |
+**Note (2026-10-16):** #4053 (10-11, security) and #3977 (10-10, performance) confirmed **MERGED** via GitHub MCP tools (`gh` CLI's `GH_TOKEN` is invalid this session, but MCP tools work fine β€” not FALLBACK). Confirmed real `dream/*` branches for every night 10-12 (intelligence, #4081), 10-13 (memory, #4138), 10-14 (swarm, #4174), 10-15 (performance, #4215) via `git ls-remote` β€” no run gap, all currently open/draft, none stale. **Correction**: 10-11's own PR (#4053) cited "CVE-2026-25725" as a future-candidate CVE β€” direct NVD/MITRE lookup this session found **this ID does not resolve to any real record**, likely garbled; flagging so it isn't re-cited without a fresh, verified ID.
+| 2026-10-16 | security | `DENYLISTED_ENV_NAMES` (`validateEnv()`, gates `terminal_create`'s caller-supplied env before a persistent merge into every later `execSync`'d command) missed credential/arbitrary-command vars in the same git family as the already-denylisted GIT_SSH_COMMAND (GIT_ASKPASS, GIT_PROXY_COMMAND), interpreter-flag-injection vars for Perl/Ruby/Java (PERL5OPT/RUBYOPT/JAVA_TOOL_OPTIONS/_JAVA_OPTIONS/JDK_JAVA_OPTIONS), two more search-path vars (PYTHONHOME, CLASSPATH), and git's numbered GIT_CONFIG_KEY_n/VALUE_n/COUNT runtime-config-injection family (added via regex, not a fixed name); PYTHONEXECUTABLE and PSModulePath researched and explicitly rejected on evidence grounds (Grade C / cosmetic) | #4229 | #4230 | yes | ACCEPT-scoped (post-critique) | 19 new tests (18 discriminating + 1 negative control), stash-isolated 18/19 fail baseline β†’ 51/51 pass candidate; full `@claude-flow/cli` suite byte-identical 60-failure set baseline vs candidate; `tsc --noEmit` 0 errors both ways; independent adversarial critique CONFIRMED-WITH-CAVEATS β†’ both caveats (an evaluation-writeup arithmetic error, two undocumented-rationale comments) fixed forward same session | fd98a162... | 10-01 #3599 MERGED; 10-10 #3977 MERGED; 10-11 #4053 MERGED; 10-12..10-15 (#4081/#4138/#4174/#4215) all open/draft, none stale; 10-04 no-run gap. Prior gist (10-15, performance) scored 10/10 (2+2+2+2+1(1031 words)+1) |
diff --git a/docs/dream-cycle/dream-gist-2026-10-16.md b/docs/dream-cycle/dream-gist-2026-10-16.md
new file mode 100644
index 0000000000..0292cd8927
--- /dev/null
+++ b/docs/dream-cycle/dream-gist-2026-10-16.md
@@ -0,0 +1,64 @@
+# Security SOTA Report β€” 2026-10-16
+
+TL;DR: `DENYLISTED_ENV_NAMES` (the loader/runtime-hijack env-var denylist `validateEnv()` enforces before `terminal_create`'s caller-supplied env is merged into every later `execSync`'d command in a terminal session) still had gaps after 2026-09-21's CWE-427 fix β€” missing credential/arbitrary-command vars in the same git family (GIT_ASKPASS, GIT_PROXY_COMMAND), interpreter-flag-injection vars for Perl/Ruby/Java (PERL5OPT/RUBYOPT/JAVA_TOOL_OPTIONS/_JAVA_OPTIONS/JDK_JAVA_OPTIONS), two more search-path vars (PYTHONHOME, CLASSPATH), and git's numbered `GIT_CONFIG_KEY_<n>`/`VALUE_<n>`/`COUNT` runtime-config-injection family (needs a pattern match, not a fixed name). All additions are source-graded (A/B); two researched candidates (PYTHONEXECUTABLE, PSModulePath) were explicitly rejected on evidence grounds. 12 new entries/patterns, 18 new discriminating tests, zero regressions.
+
+## What's New in 2026
+
+| Finding | Source | Confidence |
+|---|---|---|
+| JAVA_TOOL_OPTIONS officially documented by Oracle as a `-javaagent`/`-agentlib` injection point, "disabled in some cases for security reasons" | docs.oracle.com JDK troubleshooting guide | A |
+| GIT_ASKPASS invokes an arbitrary external program and reads its stdout as a credential, unconditionally (non-interactive included) | git-scm.com/docs/gitcredentials | A |
+| git's `GIT_CONFIG_COUNT`/`GIT_CONFIG_KEY_n`/`GIT_CONFIG_VALUE_n` let a caller inject *arbitrary* runtime git config (`core.sshCommand`, `core.hooksPath`, `http.*`, …) β€” strictly broader than any single fixed name | git-scm.com/docs/git-config Β§ENVIRONMENT | A |
+| CVE-2026-25725, cited by 2026-10-11's own dream-cycle PR as a "future candidate" for this surface, does **not resolve** in NVD/MITRE/any vendor database β€” likely a garbled/incorrect ID; should not be re-cited without a fresh, verified CVE number | this session, direct NVD/MITRE lookup | A (negative finding) |
+| TeamPCP campaign (Feb–Mar 2026, CVE-2026-33634, CISA KEV) used a malicious `.pth` file for arbitrary code at every Python interpreter startup β€” same attacker goal as PYTHONSTARTUP, different (non-env-var) primitive; no 2026 campaign found that specifically weaponized RUBYOPT/JAVA_TOOL_OPTIONS/GIT_ASKPASS/PSModulePath as the entry vector | this session, direct search | B |
+| OpenAI Agents SDK's April 2026 sandbox update, LangChain's Nov 2025 Sandboxes announcement, and CrewAI/AutoGen's container-first code-exec docs all delegate isolation to disposable per-run sandboxes/containers rather than env-name filtering | vendor docs (see Competitor Comparison) | B |
+
+## Ruflo Current Capability
+
+`validateEnv()` (`v3/@claude-flow/cli-core/src/mcp-tools/validate-input.ts`) is the single authoritative source for this check β€” `v3/@claude-flow/cli/src/mcp-tools/validate-input.ts` is a re-export shim over it (confirmed, not a stale duplicate). Its sole real call site is `terminal_create` in `terminal-tools.ts`, whose `{ ...process.env, ...session.env }` merge (in `terminal_execute`) carries any accepted name into every subsequent command for the life of the session β€” a persistent merge, not a one-shot sandboxed exec. The 2026-08-xx/2026-09-21 denylist covered loader-hijack (`LD_PRELOAD`, `DYLD_*`, `NODE_OPTIONS`) and the first wave of search-path vars (`PATH`, `PYTHONPATH`, `PERL5LIB`, `RUBYLIB`, `GIT_EXTERNAL_DIFF`, `GIT_SSH_COMMAND`, `BASH_ENV`, `IFS`) but missed the names above. A separate repo-wide check (this session) found other `{...process.env, ...X}` merge sites (`daemon.ts`, `fable-harness.ts`, `rvfa-runner.ts`, etc.) β€” all either merge only hardcoded/internal values or, in `rvfa-runner.ts`'s case, accept an `env` option that no current caller actually wires to untrusted input (the one CLI caller, `appliance.ts`'s `run` command, never passes `env` into the constructor). `terminal-tools.ts` remains the only live path accepting arbitrary caller-supplied env-var names.
+
+## Competitor Comparison
+
+| System | Env-name filtering before subprocess spawn? | Security framing | Source |
+|---|---|---|---|
+| LangChain `LocalShellBackend` | No β€” raw `env`/`inheritEnv` pass-through | Docs explicitly warn against untrusted/production use of this mode | LangChain DeepAgents reference |
+| AutoGen / AG2 `CodeExecutorAgent` | No | Fresh Docker container per run is the stated boundary | AG2 docs; cf. CVE-2026-39420 (unrelated project, LD_PRELOAD sandbox bypassed via `env -i`) |
+| CrewAI | No | Deprecated its own Docker tool; delegates to external sandboxes (E2B/Modal) | CrewAI tool docs |
+| OpenAI Agents SDK / `openai/swarm` | No | Pluggable disposable sandbox providers (E2B, Modal, Daytona, …), per-op scoping | OpenAI Agents SDK, Apr 2026 update |
+
+**Why "None," honestly assessed:** not an unpatched industry gap β€” a framework-shape difference. All four assume a disposable, isolated exec per call (capping blast radius structurally) or explicitly disclaim their local-shell mode as unsafe. None document Ruflo's exact primitive: a persistent terminal session with a one-time env merge that then applies to every later command. That persistence is what makes a name-based denylist necessary here specifically.
+
+## Hypothesis
+
+> Given a caller-supplied environment-variable name in `terminal_create`'s `env` input matching one of 11 newly-added fixed names (GIT_ASKPASS, GIT_PROXY_COMMAND, GIT_CONFIG_NOSYSTEM, PERL5OPT, RUBYOPT, JAVA_TOOL_OPTIONS, _JAVA_OPTIONS, JDK_JAVA_OPTIONS, PYTHONHOME, CLASSPATH, PYTHONSTARTUP) or the new `GIT_CONFIG_(COUNT|KEY_\d+|VALUE_\d+)` pattern, when `validateEnv()` runs, then it should reject that name (`valid:false`, `sanitized:{}`, error contains "denylisted") exactly as it already does for the pre-existing 17 names, subject to: zero change to validation of any name outside this extended set; case-insensitive matching preserved (Windows semantics, per 2026-09-21's own fix); all 33 pre-existing tests in the file stay green; deterministic, $0, zero-LLM evaluation.
+
+## Benchmarks
+
+No `.harness/bench.json` corpus exists for this surface (confirmed, same as every recent security night β€” this is a unit-level correctness fix, not a benchmarked metric). Real evaluator: Vitest 4.1.8 against a freshly `pnpm install`-ed `v3/` workspace (was never installed in this checkout; installed this session) + `@claude-flow/cli-core` built via `tsc`.
+
+## Evaluation
+
+**evaluated: accepted.** Stash-isolated baseline (`git stash` on just the two changed files): of 19 new test cases, **18 discriminate and fail** exactly as predicted (`expected true to be false` on every new denylisted name/pattern); the 19th is a non-discriminating negative control (`GIT_CONFIGURATION_PROFILE` must NOT be rejected) that correctly passes on both baseline and candidate. The 32 pre-existing cases in the same file pass unchanged on baseline. Candidate: **51/51 pass** (32 + 19). An independent adversarial-critic subagent re-ran this exact stash/pop cycle itself and caught an arithmetic error in the first pass of this count (originally miscounted as "33 pre-existing / 18 new") β€” corrected here. Full `@claude-flow/cli` vitest suite: baseline 1650 suites/5210 tests, candidate 1651 suites/5229 tests (the +1 suite / +19 tests is the new test file itself); **failed-suite lists are byte-identical between baseline and candidate** (60 pre-existing failures both ways, diffed directly) β€” zero regressions. `npx tsc --noEmit` in `cli-core`: 0 errors, confirmed independently by the critic.
+
+**Independent adversarial critique: CONFIRMED-WITH-CAVEATS** (no blocking issues). The critic additionally: verified the `GIT_CONFIG_ENV_RE` regex against real git source (`config.c`) and found it a safe superset with no realistic false negatives; found and the candidate fixed forward two documentation gaps — `GIT_CONFIG_NOSYSTEM`'s denylist rationale was undocumented despite this repo's own `guidance/mod-sources.ts` setting that same var defensively elsewhere (now explained in-source); and `PYTHONSTARTUP`'s comment overclaimed that execSync's non-interactive child "cannot enter" Python's interactive mode — empirically, a caller-supplied `python3 -i` command can still trigger it even off non-tty stdin (now corrected in-source, with the net conclusion — no new capability gained, since that caller already has unrestricted command execution — unchanged). Checked for a second caller-controlled env→child-process path (none found; the only other env-merging exec call, `guidance/mod-sources.ts`'s git() helper, builds a fully internal/hardcoded env and never takes caller-supplied names) and confirmed no stale third copy of `validate-input.ts` exists in the repo.
+
+## Darwin Results
+
+Skipped β€” binary detection-wiring fix (extend a denylist Set + one regex check), no continuous/categorical parameter for Darwin's real interface (`npx ruvector harness darwin <config> --execute`, confirmed available) to search over. Same skip class as nearly every accepted security-night fix since 2026-08-18.
+
+## SOTA Proof & Witness
+
+```
+Session commit: 1882006a02487590c8c66a7eec8d7504f6af33c3
+Candidate commit: (this branch's head β€” see PR for exact SHA)
+Gist SHA-256 (pre-witness, this block stripped back to PENDING): 6fdcc3866bc6b3a66c61871a94c2cb7639e44a2847aecf5ab236231c672f77c3
+Witness stamp: fd98a162d7f7ea730b2c18712ef071444162dc33cbf8ce25e1a910e621df49e4
+```
+Verifier: fetch `docs/dream-cycle/dream-gist-2026-10-16.md` from this branch, strip this witness block's filled-in values back to `PENDING`, SHA-256 the file, concatenate with the session commit above, SHA-256 again β€” must equal the witness stamp.
+
+## Recommended Next Steps
+
+1. **Rejected on evidence, don't re-propose without new grading**: PYTHONEXECUTABLE (confirmed macOS-only, cosmetic `sys.argv[0]` override, not a search-path vector) and PSModulePath (single third-party source, no primary Microsoft confirmation found β€” Grade C, insufficient per this routine's own evidence rule).
+2. **Needs independent verification before shipping**: GEM_PATH/GEM_HOME (plausible RubyGems `require`-resolution hijack, not independently source-verified this session).
+3. **intelligence scan**: `agentdb-retrieval-guard.ts` (ADR-377 Phase 1, citing arXiv:2606.12703's 93–100% undefended retrieval-poisoning attack success) ships **off by default** (`CLAUDE_FLOW_RETRIEVAL_GUARD`) and only flags rather than drops unsafe content unless a second env var (`_STRICT`) is also set β€” a real dormant-defense gap, candidate for a future `intelligence` night.
+4. **swarm scan**: `RaftConsensus.startElection()` requests votes from peers **sequentially** (`for...await`), unlike the same file's `replicateToFollowers()`, which correctly fans out via `Promise.allSettled` β€” election latency scales linearly with peer count instead of being bounded by one round-trip. Candidate for a future `swarm`/`performance` night.
diff --git a/package-lock.json b/package-lock.json
index 4cfa174788..cef60d07e6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21,7 +21,7 @@
"v3/@claude-flow/security"
],
"dependencies": {
- "@claude-flow/cli-core": "3.7.3",
+ "@claude-flow/cli-core": "3.7.4",
"@claude-flow/codex": "3.0.5",
"@claude-flow/mcp": "3.1.1",
"@claude-flow/neural": "3.0.0",
@@ -147,9 +147,9 @@
}
},
"node_modules/@claude-flow/cli-core": {
- "version": "3.7.3",
- "resolved": "https://registry.npmjs.org/@claude-flow/cli-core/-/cli-core-3.7.3.tgz",
- "integrity": "sha512-2rBTFde47ydpQQ9o84QrHnMUcJ8oCqi9XX8N8/VdUe1TFCSH3aYhGnYqREY32r47rNiH1XPqtaN4WwfQ390WeQ==",
+ "version": "3.7.4",
+ "resolved": "https://registry.npmjs.org/@claude-flow/cli-core/-/cli-core-3.7.4.tgz",
+ "integrity": "sha512-PfidXzMFkxLgbRqWfuC1ncqnxVp5DcWE1V+bjjf08v4iXOT70MEiYLcMWn7/OjnaZcYoY1K+KTsyn3c1MiUYjw==",
"license": "MIT",
"bin": {
"claude-flow-core": "dist/src/index.js"
diff --git a/package.json b/package.json
index 72eb51b7f8..99abc40a6a 100644
--- a/package.json
+++ b/package.json
@@ -68,7 +68,7 @@
"v3:security": "npm run security:audit && npm run security:test"
},
"dependencies": {
- "@claude-flow/cli-core": "3.7.3",
+ "@claude-flow/cli-core": "3.7.4",
"@claude-flow/codex": "3.0.5",
"@claude-flow/mcp": "3.1.1",
"@claude-flow/neural": "3.0.0",
diff --git a/v3/@claude-flow/cli-core/package.json b/v3/@claude-flow/cli-core/package.json
index 5ffdb524da..183ccd7c92 100644
--- a/v3/@claude-flow/cli-core/package.json
+++ b/v3/@claude-flow/cli-core/package.json
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/cli-core",
- "version": "3.7.3",
+ "version": "3.7.4",
"description": "Lightweight core CLI surface for Claude Flow β€” memory + hooks commands only. Designed to load fast on cold npx cache (<5s) so plugin skills don't race the 30s MCP-startup timeout. The full @claude-flow/cli metapackage lazy-loads everything else on top of this core.",
"type": "module",
"main": "dist/src/index.js",
diff --git a/v3/@claude-flow/cli-core/src/mcp-tools/validate-input.ts b/v3/@claude-flow/cli-core/src/mcp-tools/validate-input.ts
index fba5e8e9ac..2b0dbf265e 100644
--- a/v3/@claude-flow/cli-core/src/mcp-tools/validate-input.ts
+++ b/v3/@claude-flow/cli-core/src/mcp-tools/validate-input.ts
@@ -146,6 +146,40 @@ export function validateText(value: unknown, label: string, maxLen = 10_000): Va
* real process's own PATH etc. still flows through untouched for callers
* who don't set them (see terminal-tools.ts's `{ ...process.env,
* ...session.env }` merge order).
+ *
+ * dream-cycle 2026-10-16: 2026-09-21 covered Python/Perl/Ruby/git/shell
+ * search-path vars but missed credential/arbitrary-command vars in the
+ * same git family (GIT_ASKPASS, GIT_PROXY_COMMAND), interpreter-flag
+ * injection vars for Perl/Ruby/Java (PERL5OPT/RUBYOPT/JAVA_TOOL_OPTIONS/
+ * _JAVA_OPTIONS/JDK_JAVA_OPTIONS β€” official-docs-confirmed flag-prepend
+ * mechanisms, same shape as the already-listed *LIB search-path vars),
+ * two more search-path vars (PYTHONHOME, CLASSPATH), and git's numbered
+ * GIT_CONFIG_KEY_n/VALUE_n/COUNT family (arbitrary runtime git config
+ * injection β€” strictly broader than any single fixed name, needs a
+ * pattern check below, not a fixed Set entry). Also GIT_CONFIG_NOSYSTEM:
+ * lets a caller suppress system-level git config entirely, which can
+ * bypass an admin-set git security policy (e.g. protocol/safe.directory
+ * restrictions) β€” note this repo's OWN `guidance/mod-sources.ts` git()
+ * helper sets this same var to '1' for a benign, defensive purpose (to
+ * sandbox ITS OWN git calls against ambient system config), so the risk
+ * here is specifically a *caller of terminal_create* setting it to widen
+ * trust, not the variable being inherently dangerous β€” same category
+ * judgment call as the other search-path vars below, not a pure RCE
+ * primitive like GIT_ASKPASS/GIT_PROXY_COMMAND. PYTHONSTARTUP is included
+ * for defense-in-depth despite weaker fit here: official docs confirm
+ * arbitrary code execution, but only in Python's *interactive* REPL mode.
+ * `terminal_execute` doesn't request that mode itself, but a caller-
+ * supplied command string COULD pass `python3 -i` (confirmed empirically:
+ * `-i` triggers PYTHONSTARTUP even off a non-tty stdin) β€” that caller
+ * already has unrestricted arbitrary-command execution via `command`
+ * under the same trust boundary that controls `env`, so this adds no new
+ * capability; it's kept denylisted as defense-in-depth for a future
+ * caller shape, not because it's exploitable today through this path.
+ * NOT added (researched, rejected): PYTHONEXECUTABLE (macOS-only,
+ * cosmetic sys.argv[0] override, no search-path effect); PSModulePath
+ * (single third-party source, no primary vendor confirmation β€” Grade C,
+ * insufficient per this routine's evidence-grading rule); GEM_PATH/
+ * GEM_HOME (plausible but not independently verified this session).
*/
const DENYLISTED_ENV_NAMES = new Set([
'LD_PRELOAD',
@@ -165,7 +199,25 @@ const DENYLISTED_ENV_NAMES = new Set([
'GIT_SSH_COMMAND',
'BASH_ENV',
'IFS',
+ // dream-cycle 2026-10-16 additions (see note above):
+ 'GIT_ASKPASS',
+ 'GIT_PROXY_COMMAND',
+ 'GIT_CONFIG_NOSYSTEM',
+ 'PERL5OPT',
+ 'RUBYOPT',
+ 'JAVA_TOOL_OPTIONS',
+ '_JAVA_OPTIONS',
+ 'JDK_JAVA_OPTIONS',
+ 'PYTHONHOME',
+ 'CLASSPATH',
+ 'PYTHONSTARTUP',
]);
+// git's numbered runtime-config-injection family (GIT_CONFIG_COUNT plus
+// GIT_CONFIG_KEY_<n>/GIT_CONFIG_VALUE_<n> for n=0..COUNT-1): lets a caller
+// set *arbitrary* git config at runtime (core.sshCommand, core.hooksPath,
+// http.*, …), strictly broader than any single fixed name above, so it
+// needs a pattern match rather than a Set entry (dream-cycle 2026-10-16).
+const GIT_CONFIG_ENV_RE = /^GIT_CONFIG_(COUNT|KEY_\d+|VALUE_\d+)$/;
const ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
export interface EnvValidationResult {
@@ -201,6 +253,9 @@ export function validateEnv(value: unknown, label = 'env'): EnvValidationResult
if (DENYLISTED_ENV_NAMES.has(name.toUpperCase())) {
return { valid: false, sanitized: {}, error: `${label} key "${name}" is denylisted (loader/runtime hijack)` };
}
+ if (GIT_CONFIG_ENV_RE.test(name.toUpperCase())) {
+ return { valid: false, sanitized: {}, error: `${label} key "${name}" is denylisted (arbitrary git config injection)` };
+ }
if (typeof rawVal !== 'string') {
return { valid: false, sanitized: {}, error: `${label}["${name}"] must be a string` };
}
diff --git a/v3/@claude-flow/cli/__tests__/validate-input-env.test.ts b/v3/@claude-flow/cli/__tests__/validate-input-env.test.ts
index d2e2c71e28..ad39d206ac 100644
--- a/v3/@claude-flow/cli/__tests__/validate-input-env.test.ts
+++ b/v3/@claude-flow/cli/__tests__/validate-input-env.test.ts
@@ -53,6 +53,22 @@ describe('validateEnv (audit_1776853149979)', () => {
'GIT_SSH_COMMAND',
'BASH_ENV',
'IFS',
+ // dream-cycle 2026-10-16: 2026-09-21 covered Python/Perl/Ruby/git/shell
+ // search-path vars but missed credential vars in the same git family,
+ // interpreter-flag-injection vars for Perl/Ruby/Java, and two more
+ // search-path vars. See validate-input.ts's denylist comment for the
+ // source grading behind each of these.
+ 'GIT_ASKPASS',
+ 'GIT_PROXY_COMMAND',
+ 'GIT_CONFIG_NOSYSTEM',
+ 'PERL5OPT',
+ 'RUBYOPT',
+ 'JAVA_TOOL_OPTIONS',
+ '_JAVA_OPTIONS',
+ 'JDK_JAVA_OPTIONS',
+ 'PYTHONHOME',
+ 'CLASSPATH',
+ 'PYTHONSTARTUP',
];
for (const name of denylisted) {
@@ -69,7 +85,7 @@ describe('validateEnv (audit_1776853149979)', () => {
// are case-insensitive, so `path`/`Path` must be denylisted the same as
// `PATH` even though they're distinct object keys here.
describe('case-insensitive denylist match', () => {
- const caseVariants = ['path', 'Path', 'PaTh', 'node_options', 'Node_Options'];
+ const caseVariants = ['path', 'Path', 'PaTh', 'node_options', 'Node_Options', 'git_askpass', 'Java_Tool_Options'];
for (const name of caseVariants) {
it(`rejects ${name}`, () => {
@@ -80,6 +96,29 @@ describe('validateEnv (audit_1776853149979)', () => {
});
}
});
+
+ // dream-cycle 2026-10-16: git's numbered runtime-config-injection family
+ // (GIT_CONFIG_COUNT / GIT_CONFIG_KEY_<n> / GIT_CONFIG_VALUE_<n>) lets a
+ // caller set arbitrary git config (core.sshCommand, core.hooksPath,
+ // http.*, …) at runtime β€” strictly broader than any single fixed name,
+ // so it's matched by pattern rather than exact Set membership.
+ describe('GIT_CONFIG_* numbered family (pattern match)', () => {
+ const names = ['GIT_CONFIG_COUNT', 'GIT_CONFIG_KEY_0', 'GIT_CONFIG_VALUE_0', 'GIT_CONFIG_KEY_12', 'git_config_key_3'];
+
+ for (const name of names) {
+ it(`rejects ${name}`, () => {
+ const r = validateEnv({ [name]: 'x' });
+ expect(r.valid).toBe(false);
+ expect(r.error).toContain('denylisted');
+ expect(r.sanitized).toEqual({});
+ });
+ }
+
+ it('does not reject an unrelated GIT_CONFIG-prefixed name', () => {
+ const r = validateEnv({ GIT_CONFIGURATION_PROFILE: 'x' });
+ expect(r.valid).toBe(true);
+ });
+ });
});
describe('shape validation', () => {
diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.json
index 502a8c45da..a857019e9e 100644
--- a/v3/@claude-flow/cli/package.json
+++ b/v3/@claude-flow/cli/package.json
@@ -98,7 +98,7 @@
"vitest": "^4.1.0"
},
"dependencies": {
- "@claude-flow/cli-core": "3.7.3",
+ "@claude-flow/cli-core": "3.7.4",
"@claude-flow/codex": "3.0.5",
"@claude-flow/mcp": "3.1.1",
"@claude-flow/neural": "3.0.0",
diff --git a/v3/pnpm-lock.yaml b/v3/pnpm-lock.yaml
index ea6223ff0d..cce45d20ec 100644
--- a/v3/pnpm-lock.yaml
+++ b/v3/pnpm-lock.yaml
@@ -117,7 +117,7 @@ importers:
'@claude-flow/cli':
dependencies:
'@claude-flow/cli-core':
- specifier: 3.7.3
+ specifier: 3.7.4
version: link:../cli-core
'@claude-flow/codex':
specifier: 3.0.5