You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ee91408
Browse filesBrowse the repository at this point in the historyBrowse files
fix(repo): require opt-in for reference repositories when cloning
This change follows the clone safety issue recorded in
https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-j8pf-7m8v-xx38.
Passing unchecked clone keyword arguments can make Git read objects from a
caller-controlled local repository, which is surprising for callers that rely
on GitPython's default unsafe-option restrictions.
Add `--reference` and `--reference-if-able` to `Repo.unsafe_git_clone_options`,
requiring `allow_unsafe_options=True` for these options. The shared clone guard
also rejects abbreviated spellings and options supplied through `multi_options`.
Record the advisory in `doc/source/changes.rst`.
Copilot requested: "Please add regression cases for both `clone()` and
`clone_from()`, covering keyword arguments and `multi_options` (including
abbreviated spellings), and verify that `allow_unsafe_options=True` still permits
valid reference-based clones."
Extend the existing rejection cases and add local reference clones through both
APIs, using keyword arguments and joined or split `multi_options`. The opt-in
cases check the recorded alternate object store and read committed content,
including a reference path containing spaces. Initial repositories are generated
by the existing shell fixture rather than using the source checkout's history.
Validation: all 59 non-network tests in `test/test_clone.py` pass separately with
`GIT_PYTHON_BACKEND=cli` and `GIT_PYTHON_BACKEND=gix`. Both rejection tests fail
when the two added safeguards are removed in memory. Ruff lint and format checks,
ShellCheck, Bash syntax checking, and `git diff --check` pass.
Co-authored-by: Jeroen <jpab.eemsterboer@gmail.com>
Agent-Model: unknown
0 commit comments