fix(exec): resolve PATH key case-insensitively for Windows pathPrepend (#25399) (#31879)

Co-authored-by: Glucksberg <markuscontasul@gmail.com>
This commit is contained in:
Tak Hoffman
2026-03-02 10:14:38 -06:00
committed by GitHub
parent 1ea42ebe98
commit 21708f58ce
3 changed files with 84 additions and 7 deletions

View File

@@ -4,12 +4,12 @@ import { Type } from "@sinclair/typebox";
import type { ExecAsk, ExecHost, ExecSecurity } from "../infra/exec-approvals.js";
import { requestHeartbeatNow } from "../infra/heartbeat-wake.js";
import { isDangerousHostEnvVarName } from "../infra/host-env-security.js";
import { mergePathPrepend } from "../infra/path-prepend.js";
import { findPathKey, mergePathPrepend } from "../infra/path-prepend.js";
import { enqueueSystemEvent } from "../infra/system-events.js";
import type { ProcessSession } from "./bash-process-registry.js";
import type { ExecToolDetails } from "./bash-tools.exec-types.js";
import type { BashSandboxConfig } from "./bash-tools.shared.js";
export { applyPathPrepend, normalizePathPrepend } from "../infra/path-prepend.js";
export { applyPathPrepend, findPathKey, normalizePathPrepend } from "../infra/path-prepend.js";
import { logWarn } from "../logger.js";
import type { ManagedRun } from "../process/supervisor/index.js";
import { getProcessSupervisor } from "../process/supervisor/index.js";
@@ -210,9 +210,10 @@ export function applyShellPath(env: Record<string, string>, shellPath?: string |
if (entries.length === 0) {
return;
}
const merged = mergePathPrepend(env.PATH, entries);
const pathKey = findPathKey(env);
const merged = mergePathPrepend(env[pathKey], entries);
if (merged) {
env.PATH = merged;
env[pathKey] = merged;
}
}