Title: fix(submodule): validate destinations before mutation by Byron · Pull Request #2264 · gitpython-developers/GitPython · GitHub
Open Graph Title: fix(submodule): validate destinations before mutation by Byron · Pull Request #2264 · gitpython-developers/GitPython
X Title: fix(submodule): validate destinations before mutation by Byron · Pull Request #2264 · gitpython-developers/GitPython
Description: Tasks This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here. refackiew Everything below this line was generated by Codex. Created by Codex on behalf of Byron. Byron will review before this is ready to merge. Submodule destinations could fail index validation after cloning had already changed the filesystem. Validate checkout paths before mutation across creation, initialization, direct cloning, and moves, and validate metadata destinations before creation, reuse, and renaming. Reuse the existing portable path validator for .git aliases, including NTFS alternate streams and short names, HFS ignored characters, invalid components, and NULs. Apply Git for Windows' filename restrictions before path normalization or directory creation, preserving evidence that Windows would otherwise strip. Compare checkout components with the parent's Git and common directories by filesystem identity, protecting separately named metadata directories and their filesystem aliases. Reject metadata nested inside another submodule's Git directory. Repeat the check after cloning and disable a clone that became nested, following Git's behavior. Preserve supported metadata symlinks and safe relocation of a submodule's own metadata. Advisory summary GHSA-83vg-56qc-22m7: high severity; pip package Gitpython; affected range <= 3.2.0. No patched version or CVE is currently assigned. The advisory is a draft; this description omits its exploit details. Git reference Inspected Git at d38352cd43ab9745686d697872408bc3249a153f, including read-cache.c::verify_path_internal, NTFS/HFS path recognition, compat/mingw.c::is_valid_win32_path, and submodule.c::validate_submodule_git_dir. Git's t7450-bad-git-dotfiles.sh covers nested metadata; t7406-submodule-update.sh covers checkout symlinks. Regression tests also compare metadata aliases with native Git index validation using both filesystem protections. Validation Regression tests first reproduced writes before rejection and acceptance of nested metadata. Coverage includes all 16 HFS ignored characters, NTFS aliases, Windows reserved names and invalid characters, separate Git directories, relative and absolute destinations, reuse after deinitialization, moves and renames, and metadata nesting introduced during cloning. The fixtures use harmless file content. Final CI on 69d4702d: 50/50 checks passed across Linux, macOS, Windows (including free-threaded Python builds), Alpine, Cygwin, dependencies, and lint. Initial fix, pytest test/test_submodule.py test/test_submodule_no_fetch.py: 445 passed, 3 skipped, 1 expected failure on macOS/Python 3.14, with a temporary Git configuration using the suite's expected master default branch. The Windows CI follow-up adds two regressions that simulate native path normalization on every platform; both failed before the fix. Focused Windows destination, relative-path, and move tests then passed: 24 passed, 2 skipped. Windows-platform Mypy, Ruff lint and formatting, and whitespace checks also passed. Repository-wide Ruff lint and formatting passed. Mypy passed for both the native and win32 platforms (46 source files); basedpyright passed without errors or warnings. The required Codex commit review was attempted once for faf32c2b, but the CLI rejected its configured gpt-6.1-sol model with this ChatGPT account before reviewing code. Automated commit review is therefore unavailable for this commit. The follow-up commit 69d4702d passed its single Codex review using the supported gpt-5.5 model, with no findings.
Open Graph Description: Tasks This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here. refackiew Everything below this line was generated by C...
X Description: Tasks This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here. refackiew Everything below this line was generated by C...
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/2264
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:d6e55dab-8508-a926-e7a6-e7410b63c4c3 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9C1A:33F146:2EB66E:3DD8BC:6B00C2E7 |
| html-safe-nonce | 24d925a33c645694a8db05820e4c703ec89a7c5db456b77788ec7164904ab55e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzFBOjMzRjE0NjoyRUI2NkU6M0REOEJDOjZCMDBDMkU3IiwidmlzaXRvcl9pZCI6IjgyNDM5NDIxNTE2NjczNjg2NzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 42e157a4790ce03fd7e7ba3877d7ff2ed13c642869e28cedf0851fadcafb17c6 |
| hovercard-subject-tag | pull_request:4707117362 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/2264/files |
| twitter:image | https://avatars.githubusercontent.com/u/63622?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/63622?s=400&v=4 |
| og:image:alt | Tasks This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here. refackiew Everything below this line was generated by C... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 93edd3bebc4afb7ce711ee74cb5d2a95927850b082a4d43e212222389cb1c415 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1fee81a280ea86312b69448e261b418189bfd5b5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width