GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Block separate git directories during clone by Byron · Pull Request #2210 · gitpython-developers/GitPython

Conversation

@Byron

@Byron Byron commented Aug 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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-5.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Advisory

GHSA-8mcc-hrx5-hvxc

GHSA-8mcc-hrx5-hvxc reports that clone operations do not classify --separate-git-dir as unsafe. This change adds it to the existing clone option denylist, matching the init guard and the documented allow_unsafe_options contract.

Advisory summary

  • Severity: High
  • Package: GitPython (pip)
  • Affected versions: <= 3.1.58
  • Patched version: not yet assigned
  • CVE: not yet assigned

Validation

  • test/test_clone.py: 21 passed, 1 skipped
  • Regression coverage includes both Repo.clone() and Repo.clone_from(), through keyword and multi-option inputs.
  • Git baseline: builtin/clone.c registers the option and t/t5601-clone.sh verifies redirected metadata behavior.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Byron
Byron force-pushed the fix-clone-unsafe-option branch 3 times, most recently from 79db2ac to 8c9edba Compare August 10, 2026 09:41
@Byron
Byron marked this pull request as ready for review August 10, 2026 09:42
Copilot AI lite review requested due to automatic review settings August 10, 2026 09:42
@Byron
Byron force-pushed the fix-clone-unsafe-option branch from 8c9edba to dd59d25 Compare August 10, 2026 09:43
Copilot started reviewing on behalf of Byron August 10, 2026 09:44
View session
Copilot AI reviewed Aug 10, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses GHSA-8mcc-hrx5-hvxc by treating git clone --separate-git-dir (and its kwarg form separate_git_dir) as an unsafe option unless allow_unsafe_options=True, aligning clone behavior with the existing init guard and the documented unsafe-options contract.

Changes:

  • Added --separate-git-dir to Repo.unsafe_git_clone_options so clone operations block separate git directories by default.
  • Updated submodule clone internals to continue using separate_git_dir safely when needed while still enforcing the unsafe-options denylist for caller-supplied options.
  • Expanded clone-related tests to cover the new unsafe option (multi-options and kwargs) and adjusted a submodule test to explicitly allow unsafe options when intentionally using separate_git_dir.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
git/repo/base.py Adds --separate-git-dir to the clone unsafe-option denylist.
git/objects/submodule/base.py Ensures submodule cloning can still use separate_git_dir internally while validating caller-provided options.
test/test_clone.py Adds regression cases asserting clone/clone_from reject --separate-git-dir and separate_git_dir by default.
test/test_submodule.py Updates a test to explicitly allow unsafe options when using separate_git_dir, keeping focus on submodule-name validation.
Suppressed comments (2)

test/test_clone.py:264

  • To ensure long-option abbreviations are also blocked for --separate-git-dir, add an abbreviated spelling to this unsafe multi_options list.
                "--config=protocol.ext.allow=always",
                "-c protocol.ext.allow=always",
                "-cprotocol.ext.allow=always",
                "-vcprotocol.ext.allow=always",
                f"--separate-git-dir={tmp_dir / 'git-dir'}",
            ]

test/test_clone.py:277

  • This kwargs-based unsafe-options test should also cover abbreviated keyword spellings for separate_git_dir (e.g., separate_git_di) so the clone_from path matches the clone path coverage.
                {"upload_pack": f"touch {tmp_file}"},
                {"u": f"touch {tmp_file}"},
                {"config": "protocol.ext.allow=always"},
                {"c": "protocol.ext.allow=always"},
                {"separate_git_dir": tmp_dir / "git-dir"},
            ]

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread test/test_clone.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread git/repo/base.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/test_clone.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Byron @codex
Block separate git directories during clone
b68afff
<!-- agent -->
Repo.clone() and Repo.clone_from() did not reject the clone option that
redirects repository metadata to a caller-controlled path (GHSA-8mcc-hrx5-hvxc).
Regression coverage exercises both keyword and multi-option input through both
public clone APIs.

Add the option to the existing clone denylist, matching Repo.init()
and the documented allow_unsafe_options contract. Git itself registers

The Python package and Alpine test workflows failed across the submodule suite
because GitPython internally supplies --separate-git-dir when creating modern
submodule layouts. The new public clone guard correctly rejected that option,
but could not distinguish the library-generated path from caller input.

Validate caller-provided keyword and multi-options before adding the
library-controlled metadata path, then explicitly allow the resulting trusted
clone invocation. This preserves rejection of unsafe clone_multi_options while
restoring normal submodule creation. Update the one test that intentionally
invokes Repo.clone_from() with its own separate git directory to opt in
explicitly.

Assisted-by: GPT 5.6
Co-authored-by: GPT 5.6 <[email protected]>
Assisted-by: GPT 5.6
Co-authored-by: GPT 5.6 <[email protected]>
@Byron
Byron force-pushed the fix-clone-unsafe-option branch from dd59d25 to b68afff Compare August 10, 2026 10:24
@Byron
Byron merged commit b473abb into main Aug 10, 2026
53 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@it-integrations it-integrations mentioned this pull request Sep 18, 2026
🟠 [High] GitPython: Clone_from()/Clone() Omit --Separate-Git-Dir From Unsafe_git_clone_options, Enabling Arbitrary Git-Directory Creation Outside the Destination Latch/connectedhomeip#53
Open
@Byron
Byron deleted the fix-clone-unsafe-option branch October 5, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Byron
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.