Validate submodule names before filesystem operations - #2202
Draft
Byron wants to merge 1 commit into
Draft
Conversation
Submodule names read from .gitmodules can influence the separate Git directory path. Reject empty names, absolute or drive-qualified names, and parent components with either path separator. Validate before constructing module paths and before opening or mutating existing checkouts, so a repository initialized by an older vulnerable version cannot bypass the guard. Validate programmatic add and rename inputs before making changes as well. Add local-repository regression coverage for both new initialization and an existing separate Git directory outside the clone. This follows Git commit 0383bbb901 (submodule-config: verify submodule names as paths) while also accounting for os.path.join absolute-path semantics. Advisory: GHSA-hmq2-w58f-27jc Validation: - pytest -q test/test_submodule.py on Python 3.14.6 (39 passed, 1 skipped, 1 xfailed) - ruff check and format --check on changed files - mypy git/objects/submodule/base.py
Byron
force-pushed
the
submodule-name-check
branch
from
August 1, 2026 03:10
e1d07cc to
b88d913
Compare
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 GPT-5.
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Advisory
https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-hmq2-w58f-27jc
Advisory summary
This change validates submodule names before filesystem operations. Details are intentionally concise while the advisory remains a draft.
Changes
Git baseline
Matches the name-validation behavior introduced by Git commit
0383bbb901(submodule-config: verify submodule names as paths), with additional handling for Python path-join semantics.Validation
pytest -q test/test_submodule.pyon Python 3.14.6: 39 passed, 1 skipped, 1 xfailedgit/objects/submodule/base.py: passedNo Docker reproduction was used.