fix(spawn): sanitize claudecode in shared claude env builders

- strip CLAUDECODE from cliproxy-built Claude environments

- enforce sanitization in ClaudeAdapter buildEnv

- apply same env hardening in shared spawnClaude helper

Refs #588
This commit is contained in:
Tam Nhu Tran committed 2026-02-20 23:00:47 +07:00
1 parent 50412dc679
commit d25eda8435
3 files changed
+11 -5

No files matched your search

+3 -2
View File
@@ -6,7 +6,7 @@
*/
import { spawn, ChildProcess, SpawnOptions } from 'child_process';
import { escapeShellArg } from './shell-executor';
import { escapeShellArg, stripClaudeCodeEnv } from './shell-executor';
import { getClaudeCliInfo } from './claude-detector';
import { ErrorManager } from './error-manager';
@@ -46,7 +46,8 @@ export function spawnClaude(options: SpawnClaudeOptions = {}): SpawnClaudeResult
const { args = [], env, cwd, stdio = 'inherit' } = options;
// Merge environment
const mergedEnv = env ? { ...process.env, ...env } : process.env;
const mergedEnvBase = env ? { ...process.env, ...env } : process.env;
const mergedEnv = stripClaudeCodeEnv(mergedEnvBase);
let child: ChildProcess;
if (needsShell) {