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 — fix: harden config parsing boundaries by Byron · Pull Request #2211 · 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.

Summary

  • Preserve parsed multiline Git config values when an unrelated write reserializes the file, keeping each value structurally intact.
  • Disable include merging for .gitmodules, so repository-controlled submodule configuration cannot cause unrelated local files to be opened.

Advisories

  • GHSA-284h-m62q-gf8w (GHSA-284h-m62q-gf8w)
  • GHSA-7833-fr7j-v32q (GHSA-7833-fr7j-v32q)

Both advisories remain private/under triage, so reproduction and exploit details are intentionally omitted here.

Advisory summary

GHSA-284h-m62q-gf8w

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

GHSA-7833-fr7j-v32q

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

Baselines

  • Git config.c at cf5497b14c5a serializes embedded LF with an escape rather than as a physical config line.
  • Existing GitPython hardening in 41ecc6a4 disables include merging for another write-sensitive config parser.

Validation

  • Focused regressions for both advisories
  • pytest -q test/test_config.py (35 passed, 2 skipped)
  • pytest -q (passed after each commit)
  • Targeted Ruff lint and format checks
  • git diff --check

Sorry, something went wrong.

Uh oh!

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

All reactions
@Byron Byron changed the title fix: preserve multiline config values when writing fix: harden config parsing boundaries Aug 10, 2026
Byron and others added 2 commits August 10, 2026 13:21
@Byron @codex
fix: preserve multiline config values when writing
4b4e47f
<!-- agent -->
GitConfigParser decoded valid multiline values into embedded newlines, but
_write() serialized those newlines as indented physical lines. Rewriting an
otherwise unchanged config could therefore change its meaning to Git.

Serialize resident multiline values with Git-compatible escapes inside a
quoted continuation, preserving GitPython read compatibility while keeping
each option structurally intact. This addresses GHSA-284h-m62q-gf8w.

The regression starts with an inert multiline value, performs an unrelated
write, and verifies with both GitPython and git config that it remains one
value and does not create another option.

Git baseline: config.c parse_value() and write_pair() at cf5497b14c5a escape
embedded LF as \\n rather than emitting it as a physical config line.

Assisted-by: GPT 5.6
Co-authored-by: GPT 5.6 <[email protected]>
@Byron @codex
fix: ignore includes in submodule configuration
ef7568e
<!-- agent -->
Submodule configuration is read from .gitmodules, whose contents may come
from an untrusted repository. Its parser inherited merge_includes=True and
could therefore open files named by include directives during ordinary
submodule enumeration.

Disable include merging at the SubmoduleConfigParser construction site. This
matches Repo.config_writer() hardening from 41ecc6a and addresses
GHSA-7833-fr7j-v32q without changing include behavior for trusted config
parsers.

The regression points .gitmodules at a non-config file and verifies the
submodule entry remains readable without opening the included path.

Assisted-by: GPT 5.6
Co-authored-by: GPT 5.6 <[email protected]>
@Byron
Byron force-pushed the config-sanitize-more branch from 5326ebf to ef7568e Compare August 10, 2026 11:31
@Byron
Byron marked this pull request as ready for review August 10, 2026 11:55
Copilot AI lite review requested due to automatic review settings August 10, 2026 11:55
@Byron
Byron merged commit a5e047d into main Aug 10, 2026
54 checks passed

Uh oh!

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

Copilot started reviewing on behalf of Byron August 10, 2026 11:56
View session
@Byron
Byron deleted the config-sanitize-more branch August 10, 2026 11:57
chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Aug 10, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef7568e3b3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread git/config.py Resolved

Uh oh!

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

Comment thread git/config.py Resolved

Uh oh!

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

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

Hardens Git config parsing/serialization to prevent unsafe boundary crossings when rewriting config files and when parsing repository-controlled .gitmodules, aligning GitPython behavior more closely with Git’s escaping and include-handling expectations.

Changes:

  • Update GitConfigParser writer to escape/quote values containing special characters (notably multiline values) instead of emitting physical continuation lines.
  • Disable [include] merging when parsing .gitmodules via SubmoduleConfigParser.
  • Add regression tests covering multiline rewrite safety, special-character escaping, and .gitmodules include isolation.

Reviewed changes

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

File Description
git/config.py Adjusts config serialization to quote/escape special characters to preserve multiline values safely.
git/objects/submodule/base.py Forces .gitmodules parsing to use merge_includes=False to avoid opening arbitrary local files.
test/test_config.py Adds tests to ensure multiline rewrite doesn’t create unintended options and that special chars round-trip and match git config.
test/test_submodule.py Adds a test ensuring .gitmodules does not merge includes (and thus doesn’t parse unrelated files).

💡 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 git/config.py Resolved

Uh oh!

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

@nijel nijel mentioned this pull request Aug 11, 2026
Using # or ; in config values #2214
Closed
This was referenced Sep 18, 2026
🟠 [High] GitPython: Arbitrary Local File Content Disclosure via [Include] Directive in Untrusted .Gitmodules (SubmoduleConfigParser Never Disables Merge_includes) Latch/connectedhomeip#54
Open
🟠 [High] GitPython: Arbitrary Local File Content Disclosure via [Include] Directive in Untrusted .Gitmodules (SubmoduleConfigParser Never Disables Merge_includes) Latch/connectedhomeip#55
Open
@JingHao-Leon JingHao-Leon mentioned this pull request Oct 19, 2026
fix(config): decode escapes in unquoted config values #2297
Merged
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
@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] 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.