Skip to content

fix: avoid invoking git before project trust is established#13804

Merged
viyatb-oai merged 1 commit intomainfrom
codex/viyatb/no-git-before-trust
Mar 7, 2026
Merged

fix: avoid invoking git before project trust is established#13804
viyatb-oai merged 1 commit intomainfrom
codex/viyatb/no-git-before-trust

Conversation

@viyatb-oai
Copy link
Collaborator

Summary

  • resolve trust roots by inspecting .git entries on disk instead of spawning git rev-parse --git-common-dir
  • keep regular repo and linked-worktree trust inheritance behavior intact
  • add a synthetic regression test that proves worktree trust resolution works without a real git command

Testing

  • just fmt
  • cargo test -p codex-core resolve_root_git_project_for_trust
  • cargo clippy -p codex-core --all-targets -- -D warnings
  • cargo test -p codex-core (fails in this environment on unrelated managed-config DangerFullAccess tests in codex::tests, tools::js_repl::tests, and unified_exec::tests)

@viyatb-oai viyatb-oai merged commit 5deaf94 into main Mar 7, 2026
31 checks passed
@viyatb-oai viyatb-oai deleted the codex/viyatb/no-git-before-trust branch March 7, 2026 01:46
@github-actions github-actions bot locked and limited conversation to collaborators Mar 7, 2026
@bolinfest
Copy link
Collaborator

This looks good, though my one post-commit piece of feedback is that the docstring (or some comment in the code) should explain that we are deliberately avoiding running git for security purposes, just so someone doesn't come along later and replace this implementation with git rev-parse --git-common-dir.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants