Skip to content

fix(o79): harden mutating git against repo filters and merge drivers - #79

Merged
QiaolongLi1201 merged 3 commits into
mainfrom
fix/o79-worktree-git-exec
Oct 11, 2026
Merged

QiaolongLi1201 merged 3 commits into
mainfrom
fix/o79-worktree-git-exec

Conversation

@QiaolongLi1201

Copy link
Copy Markdown
Collaborator

Summary

O79 — runGit only applied executableConfigOverrides when readOnly was true. All readOnly: false call sites live in worktree-isolation.ts (worktree add, add -A -N, apply --3way, prune, …), so creating a subagent worktree (and related mutating git) still ran untrusted repo .git/config filter.*.smudge / filter.*.clean / merge.*.driver.

Fix

  • Always discover and inject executableConfigOverrides in runGit (not only for read-only).
  • Keep existing read-only-only behavior for GIT_PAGER=cat, READONLY_CONFIG, and withoutExternalDiff.
  • Extend executable-config detection to blank local/worktree merge.*.driver so git apply --3way fails closed instead of running the repo driver.
  • Did not touch src/utils/git-config-env.ts (O76 already merged; O80 rewrites that file later).
  • Did not change worktree-isolation.ts — the hardening is entirely in git-spawn.ts.

Files

  • src/utils/git-spawn.ts
  • test/git-spawn.spec.mjs (merge.driver in override unit test)
  • test/worktree-isolation-o79.spec.mjs (new)

Acceptance

Test plan

npm ci   # Node >= 22.16
npm run test:filter -- --filter worktree-isolation-o79 --filter git-spawn.spec
npm run test:filter -- --filter worktree-isolation.spec
# after build, from a dir whose ../dist is this tree's dist:
node qa-repro-o79-worktree-filter.spec.mjs

runGit only injected executableConfigOverrides when readOnly was true, so
worktree-isolation's mutating calls (worktree add, add -A -N, apply --3way)
still ran untrusted filter.*.smudge/clean and merge.*.driver from .git/config.

Always discover and inject those overrides for every runGit child. Keep
GIT_PAGER, READONLY_CONFIG, and withoutExternalDiff read-only-only. Also
blank local/worktree merge.*.driver keys so apply --3way fails closed.

Regression: createWorktree smudge, mutating add clean, apply --3way merge
driver. Did not touch git-config-env.ts (O76 already merged; O80 later).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@QiaolongLi1201
QiaolongLi1201 merged commit e9e8355 into main Oct 11, 2026
9 of 12 checks passed
@QiaolongLi1201
QiaolongLi1201 deleted the fix/o79-worktree-git-exec branch October 12, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant