fix: validate checkout positional reference options by Byron · Pull Request #2233 · gitpython-developers/GitPython
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 GPT-6. Created by Codex on behalf of Byron. Byron will review before this is ready to merge. Head.checkout() now includes its positional reference in the existing unsafe-option validation. This keeps validation consistent for keyword arguments and reference names, including references obtained from a clone, while preserving explicit opt-in and normal branch switching. Advisory summary GHSA-23mf-xhv8-69c2: severity high; affected package PyPI GitPython, reported range <= 3.1.62. No patched version or CVE is assigned in the advisory. The advisory is unpublished; this description omits its reproduction details. Validation Both new regression paths failed before the fix. All 30 tests in test/test_refs.py pass (Python 3.12.14, Apple Git 2.50.1), including explicit opt-in, ordinary checkout, and detached HEAD behavior. git diff --check passes. Git behavior reference: local Git checkout 1630431f326e15fcde608827b5ff38422528eb59, builtin/checkout.c pathspec-file handling. A leading argument separator would change branch checkout into path checkout, so this change reuses the existing validation helper.
Skip to content