mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
fix(git): keep the agent-terminal credential guard scalar-only so env scrubs can't break git (#38716)
* fix(git): keep the agent-terminal credential guard scalar-only so env scrubs can't break git Agents that scrub env names matching KEY/TOKEN/... (DeepSeek Harness) dropped GIT_CONFIG_KEY_n but kept GIT_CONFIG_COUNT, so every git command in those terminals failed with "missing config key GIT_CONFIG_KEY_0". GCM_INTERACTIVE already carries credential.interactive and suppresses GCM's GUI, so the guard now emits only scalar variables. Tracked in #26594. Co-authored-by: yu.xia <yuxianice@163.com> * chore(git): drop stale indexed-config comments and a dead WSL forward branch --------- Co-authored-by: yu.xia <yuxianice@163.com>
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { recognizeAgentLaunchCommand } from '../../agent-launch/startup/agent-command-line-intent'
|
||||
import { gitCredentialPromptGuardEnv } from '../../git/commands/git-credential-prompt-env'
|
||||
|
||||
const GIT_CONFIG_PROTOCOL_KEY_RE = /^GIT_CONFIG_(?:COUNT|KEY_\d+|VALUE_\d+)$/
|
||||
|
||||
export const TERMINAL_GIT_CREDENTIAL_GUARD_POLICY_ENV =
|
||||
'ORCA_INTERNAL_TERMINAL_GIT_CREDENTIAL_GUARD_POLICY'
|
||||
|
||||
@@ -13,7 +11,7 @@ export function applyTerminalGitCredentialPromptGuard(
|
||||
launchCommand?: string | null
|
||||
isUnattended?: boolean
|
||||
platform?: NodeJS.Platform
|
||||
/** A detached host appends indexed config after its authoritative env merge. */
|
||||
/** A detached host reapplies the guard after its authoritative env merge. */
|
||||
deferGitConfigGuardToHost?: boolean
|
||||
}
|
||||
): boolean {
|
||||
@@ -37,10 +35,10 @@ export function applyTerminalGitCredentialPromptGuard(
|
||||
return true
|
||||
}
|
||||
|
||||
// The daemon must append indexed config after merging inherited env; send only the policy and scalar guards.
|
||||
// The daemon reapplies the guard after merging inherited env; send the policy and scalar guards.
|
||||
env[TERMINAL_GIT_CREDENTIAL_GUARD_POLICY_ENV] = 'guard'
|
||||
for (const [key, value] of Object.entries(guarded)) {
|
||||
if (typeof value !== 'string' || GIT_CONFIG_PROTOCOL_KEY_RE.test(key)) {
|
||||
if (typeof value !== 'string') {
|
||||
continue
|
||||
}
|
||||
if (key === 'WSLENV') {
|
||||
|
||||
Reference in New Issue
Block a user