Repository navigation
Conversation
The requested audit against Git's submodule path validation found that `Submodule.module()` checked the checkout path, then let `Repo` select a different working tree from `core.worktree`. A symlink in that configured path could redirect `update()` writes outside the checkout. Unforced `remove(configuration=False)` could delete the external working tree. Pass the checked checkout as `GIT_WORK_TREE` when opening the shared module handle. This keeps updates, removal and recursive traversal on the validated path without making repository queries rewrite configuration. Existing Git metadata symlinks remain supported. Git reference `6de20f6092dcf9bdb1c8efe03db4b70c82b423dd` validates checkout components in `submodule.c:validate_submodule_path()` and repairs configured worktrees before update in `builtin/submodule--helper.c:ensure_core_worktree()`. Git 2.54.0 preserves external targets in the new update/deinit comparisons. GitPython previously overwrote or deleted them. The regressions cover leaf and intermediate symlinks, and pass on both CLI and Gix backends after the fix. Record the independently observed GixPython 0.3.0 configured-worktree canonicalization difference under the still-open `GIX-14` ledger entry. The scoped submodule guard does not claim to fix native discovery upstream. Validation: eight focused regression cases per backend; full `mypy` and `basedpyright --warnings`; Ruff check/format; ShellCheck with sourced fixtures; `git diff --check`. Agent-Model: unknown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by Codex (exact runtime model unavailable).
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Submodule.module()validated the configured checkout path, then opened aRepowhosecore.worktreecould select a different directory through a symlink. Updating could overwrite files there; unforcedremove(configuration=False)could delete that directory. This bug was discovered during the requested audit of GitPython's submodule writes against Git's existing symlink protection.Bind the shared module handle to the validated checkout with
GIT_WORK_TREE. Updates, removal, recursive traversal, and callers ofmodule()then use that checked path. Opening the handle remains read-only. Git's own update repairs persistedcore.worktree; this fix confines the GitPython handle without rewriting configuration during a query.The audit traced add, clone, reconnect, update, move, remove, deinit, and root/recursive update paths. Their existing checkout checks or Git delegation remain in place. Git-supported metadata symlinks remain supported. A separate native configured-worktree canonicalization difference is recorded under the still-open GIX-14 ledger entry.
Validation
test/test_submodule.pyandtest/test_submodule_no_fetch.py: CLI had 484 passes, Gix had 485 passes, with their existing skips/xfail. Each initially had one failure because the sandbox could not access the user's GPG agent for an existing test's commit. That case passes on both backends withcommit.gpgSign=falseinjected only into the test process; no persistent signing configuration changed.mypy,basedpyright --warnings, Ruff check/format, ShellCheck with sourced fixtures, andgit diff --checkpass.codex review --commit 9d74656found no actionable regression.6de20f6092dcf9bdb1c8efe03db4b70c82b423ddsuppliessubmodule.c:validate_submodule_path()andbuiltin/submodule--helper.c:ensure_core_worktree().Path validation remains a point-in-time check, as in Git; this change does not provide atomic protection against concurrent filesystem replacement.
Reported issue (user-authored, verbatim)
Follow-up constraints (user-authored, verbatim)