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 — Reject unsafe submodule checkout paths by Byron · Pull Request #2225 · gitpython-developers/GitPython

Conversation

@Byron

@Byron Byron commented Sep 1, 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.

Summary

Confine submodule checkout paths to the parent repository before filesystem operations. The shared absolute-path accessor now rejects parent traversal, paths resolving through symlinks outside the worktree, and paths resolving to the worktree root.

Advisory

GHSA-59cr-6r3x-644w

Advisory summary

  • GHSA: GHSA-59cr-6r3x-644w
  • Severity: Medium
  • Package: GitPython (pip)
  • Affected versions: <= 3.1.61
  • Patched version: not yet assigned
  • CVE: not assigned

Validation

  • python -m pytest test/test_submodule.py -q — 45 passed, 3 skipped, 1 xfailed
  • pre-commit run --files git/objects/submodule/base.py test/test_submodule.py
  • mypy git/objects/submodule/base.py
  • git diff --check

Git behavior reference: commit e8d0608944, submodule.c::validate_submodule_path(), and t/t7423-submodule-symlinks.sh reject every existing symlink component before submodule update. read-cache.c::verify_path_internal() rejects parent-traversing index paths.

Commits

  • f67ab162 Reject submodule checkout paths outside the repository
  • 07091717 Reject submodule paths through outside symlinks
  • 914a4ae8 Keep submodule checkouts away from the worktree root
  • dcd956a6 Match Git submodule symlink validation

Sorry, something went wrong.

Uh oh!

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

All reactions
@Byron
Byron force-pushed the submodule-path-hardening branch from dcd956a to c0ed846 Compare September 1, 2026 10:19
@Byron @codex
Reject submodule checkout paths outside the repository
1ed0ebc
GHSA-59cr-6r3x-644w identifies that submodule update paths could reach
filesystem operations without the containment check already used by add and
move.

Add a regression that proves update rejects a parent-directory checkout
path before cloning, and override Submodule.abspath to apply the shared
_to_relative_path guard for every filesystem consumer.

Git baseline: git.git read-cache.c verify_path_internal() rejects invalid index
paths, covered for parent traversal by t/t9300-fast-import.sh.

Assisted-by: GPT 5.6
Co-authored-by: GPT 5.6 <[email protected]>
@Byron
Byron force-pushed the submodule-path-hardening branch from c0ed846 to 1ed0ebc Compare September 1, 2026 11:49
@Byron
Byron marked this pull request as ready for review September 1, 2026 12:51
Copilot AI lite review requested due to automatic review settings September 1, 2026 12:51
@Byron
Byron merged commit 8a14adc into main Sep 1, 2026
53 checks passed

Uh oh!

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

Copilot started reviewing on behalf of Byron September 1, 2026 12:52
View session
Copilot AI reviewed Sep 1, 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 hardens submodule checkout path handling to mitigate GHSA-59cr-6r3x-644w by ensuring submodule paths are confined to the parent repository before filesystem operations, including rejecting paths that traverse through symlink components.

Changes:

  • Add Submodule.abspath validation that rejects checkout paths containing symbolic-link components under a non-bare parent repo.
  • Add regression tests covering updates with checkout paths outside the parent, through a symlink, and at the repository root.
  • Document the security fix in the changelog for the 3.1.62 release entry.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
git/objects/submodule/base.py Adds symlink-component rejection during submodule absolute path resolution.
test/test_submodule.py Adds tests asserting update(init=True) rejects unsafe checkout paths.
doc/source/changes.rst Adds a 3.1.62 changelog entry referencing the security advisory.

💡 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_submodule.py
Comment on lines +1390 to +1391
os.mkdir(osp.join(parent.working_tree_dir, "target"))
os.symlink("target", osp.join(parent.working_tree_dir, "link"))
@cigamit cigamit mentioned this pull request Sep 7, 2026
build: bump gitpython from 3.1.60 to 3.1.61 in /requirements ctrliq/ascender#834
Merged
@blaipr blaipr mentioned this pull request Sep 7, 2026
build: bump gitpython from 3.1.61 to 3.1.62 in /requirements ctrliq/ascender#846
Merged
@Byron
Byron deleted the submodule-path-hardening branch October 5, 2026 03:23
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.