Skip to contentSkip to conversation

python3-git: Security fixes

PATCH New Yogita Urade 1 participant 28 messages Oct 16

lore
Share & tools
lore
#0 lore raw

cover python3-git: Security fixes

Backport GitPython security fixes to the Scarthgap python3-git 3.1.42 recipe. The 27-patch series covers 28 CVE IDs and hardens Git option validation, config parsing and serialization, submodule paths, repository discovery, and actor parsing.

The CVE-2026-76222 and CVE-2026-87819 fixes retain their ordered upstream follow-up changes. Patch 0020 carries the shared upstream hardening for CVE-2026-78678 and CVE-2026-78679.

Yogita Urade (27):
python3-git: fix CVE-2026-67326
python3-git: Fix CVE-2026-67323
python3-git: fix CVE-2026-67325
python3-git: fix CVE-2026-67324
python3-git: fix CVE-2026-67322
python3-git: fix CVE-2026-69097
python3-git: fix CVE-2026-73625
python3-git: fix CVE-2026-73623
python3-git: fix CVE-2026-73624
python3-git: fix CVE-2026-73622
python3-git: fix CVE-2026-73621
python3-git: fix CVE-2026-73620
python3-git: fix CVE-2026-73619
python3-git: fix CVE-2026-76221
python3-git: fix CVE-2026-76220
python3-git: fix CVE-2026-76219
python3-git: fix CVE-2026-76218
python3-git: fix CVE-2026-76217
python3-git: fix CVE-2026-76222
python3-git: fix CVE-2026-78678 CVE-2026-78679
python3-git: fix CVE-2026-78677
python3-git: fix CVE-2026-78676
python3-git: fix CVE-2026-78675
python3-git: fix CVE-2026-87817
python3-git: fix CVE-2026-87818
python3-git: fix CVE-2026-87819
python3-git: fix CVE-2026-100689

 .../python/python3-git/CVE-2026-100689.patch  |  60 +++
 .../python/python3-git/CVE-2026-67322.patch   | 174 +++++++
 .../python/python3-git/CVE-2026-67323.patch   | 346 ++++++++++++++
 .../python/python3-git/CVE-2026-67324.patch   | 102 +++++
 .../python3-git/CVE-2026-67325_p1.patch       |  50 ++
 .../python3-git/CVE-2026-67325_p2.patch       |  53 +++
 .../python/python3-git/CVE-2026-67326.patch   | 108 +++++
 .../python/python3-git/CVE-2026-69097.patch   |  61 +++
 .../python/python3-git/CVE-2026-73619.patch   |  59 +++
 .../python/python3-git/CVE-2026-73620.patch   | 130 ++++++
 .../python/python3-git/CVE-2026-73621.patch   |  76 ++++
 .../python/python3-git/CVE-2026-73622.patch   |  61 +++
 .../python/python3-git/CVE-2026-73623.patch   |  54 +++
 .../python/python3-git/CVE-2026-73624.patch   | 135 ++++++
 .../python/python3-git/CVE-2026-73625.patch   |  68 +++
 .../python/python3-git/CVE-2026-76217.patch   | 173 +++++++
 .../python/python3-git/CVE-2026-76218.patch   |  91 ++++
 .../python/python3-git/CVE-2026-76219.patch   | 166 +++++++
 .../python/python3-git/CVE-2026-76220.patch   |  66 +++
 .../python/python3-git/CVE-2026-76221.patch   |  61 +++
 .../CVE-2026-76222-regression.patch           |  35 ++
 .../python3-git/CVE-2026-76222_p1.patch       | 123 +++++
 .../python3-git/CVE-2026-76222_p2.patch       |  49 ++
 .../python/python3-git/CVE-2026-78675.patch   |  49 ++
 .../python/python3-git/CVE-2026-78676.patch   |  55 +++
 .../python/python3-git/CVE-2026-78677.patch   |  87 ++++
 .../CVE-2026-78678_CVE-2026-78679.patch       | 208 +++++++++
 .../python/python3-git/CVE-2026-87817.patch   | 430 ++++++++++++++++++
 .../python/python3-git/CVE-2026-87818.patch   |  56 +++
 .../python3-git/CVE-2026-87819_p1.patch       |  78 ++++
 .../python3-git/CVE-2026-87819_p2.patch       |  58 +++
 .../python/python3-git_3.1.42.bb              |  33 +-
 32 files changed, 3354 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-100689.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67322.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67323.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67324.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67325_p1.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67325_p2.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67326.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-69097.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73619.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73620.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73621.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73622.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73623.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73624.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73625.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76217.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76218.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76219.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76220.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76221.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76222-regression.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76222_p1.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76222_p2.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-78675.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-78676.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-78677.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-78678_CVE-2026-78679.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-87817.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-87818.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-87819_p1.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-87819_p2.patch
Signature · 1 line
2.44.4
#1 lore raw

PATCH 1/27 python3-git: fix CVE-2026-67326

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/54538428f79b0c91ba52cda5229856a6edf7ac06
[2] https://www.cve.org/CVERecord?id=CVE-2026-67326

---
 .../python/python3-git/CVE-2026-67326.patch   | 108 ++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |   3 +-
 2 files changed, 110 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67326.patch
meta/recipes-devtools/python/python3-git/CVE-2026-67326.patch new file +108 -0
new file mode 100644
index 0000000000..336460817a
@@ -0,0 +1,108 @@
+From 8d534d0df8f00033c02e281291e39ed3b26f7690 Mon Sep 17 00:00:00 2001
+From: "GPT 5.5" <[email protected]>
+Date: Tue, 5 May 2026 21:34:42 +0800
+Subject: [PATCH 08/38] Validate config key section names before writing
+
+GitConfigParser already rejected CR, LF, and NUL in config values before
+writing, but section and option names could still reach configparser. Because
+GitPython writes section headers itself, a newline-bearing section name could
+split the output into additional headers.
+
+Reject CR, LF, and NUL in section and option names on write paths that create
+or set config keys: add_section(), set(), set_value(), add_value(), and
+rename_section() destinations. This matches Git config key validation behavior;
+Git source commit 94f057755b7941b321fd11fec1b2e3ca5313a4e0 reports invalid keys
+containing newlines from config.c, and local git 2.50.1 rejects newline-bearing
+config keys.
+
+Add a regression test covering unsafe section and option names while preserving
+safe writes.
+
+CVE: CVE-2026-67326
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/54538428f79b0c91ba52cda5229856a6edf7ac06]
+
+Backport Changes:
+- Omit upstream regression test changes because the Scarthgap PyPI source archive does not include its test suite.
+
+Co-authored-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit 54538428f79b0c91ba52cda5229856a6edf7ac06)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/config.py |   17 ++++++++++++++++-
+ 1 file changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/git/config.py b/git/config.py
+index 7988f5d9..1df1415f 100644
+--- a/git/config.py
++++ b/git/config.py
+@@ -71,6 +71,9 @@ CONDITIONAL_INCLUDE_REGEXP = re.compile(r"(?<=includeIf )\"(gitdir|gitdir/i|onbr
+ See: https://git-scm.com/docs/git-config#_conditional_includes
+ """
+ 
++UNSAFE_CONFIG_CHARS_RE = re.compile(r"[\r\n\x00]")
++"""Characters that cannot be safely written in config names or values."""
++
+ 
+ class MetaParserBuilder(abc.ABCMeta):  # noqa: B024
+     """Utility class wrapping base-class methods into decorators that assure read-only properties."""
+@@ -741,6 +744,7 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
+ 
+     def add_section(self, section: str) -> None:
+         """Assures added options will stay in order"""
++        self._assure_config_name_safe(section, "section")
+         return super().add_section(section)
+ 
+     @property
+@@ -843,10 +847,14 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
+ 
+     def _value_to_string_safe(self, value: Union[str, bytes, int, float, bool]) -> str:
+         value_str = self._value_to_string(value)
+-        if re.search(r"[\r\n\x00]", value_str):
++        if UNSAFE_CONFIG_CHARS_RE.search(value_str):
+             raise ValueError("Git config values must not contain CR, LF, or NUL")
+         return value_str
+ 
++    def _assure_config_name_safe(self, name: "cp._SectionName", label: str) -> None:
++        if isinstance(name, str) and UNSAFE_CONFIG_CHARS_RE.search(name):
++            raise ValueError("Git config %s names must not contain CR, LF, or NUL" % label)
++
+     @needs_values
+     @set_dirty_and_flush_changes
+     def set(
+@@ -855,6 +863,8 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
+         option: str,
+         value: Union[str, bytes, int, float, bool, None] = None,
+     ) -> None:
++        self._assure_config_name_safe(section, "section")
++        self._assure_config_name_safe(option, "option")
+         if value is not None:
+             value = self._value_to_string_safe(value)
+         return super().set(section, option, value)
+@@ -873,6 +883,8 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
+             a string.
+         :return: This instance
+         """
++        self._assure_config_name_safe(section, "section")
++        self._assure_config_name_safe(option, "option")
+         value_str = self._value_to_string_safe(value)
+         if not self.has_section(section):
+             self.add_section(section)
+@@ -894,6 +906,8 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
+             to a string
+         :return: This instance
+         """
++        self._assure_config_name_safe(section, "section")
++        self._assure_config_name_safe(option, "option")
+         value_str = self._value_to_string_safe(value)
+         if not self.has_section(section):
+             self.add_section(section)
+@@ -909,6 +923,7 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
+         """
+         if not self.has_section(section):
+             raise ValueError("Source section '%s' doesn't exist" % section)
++        self._assure_config_name_safe(new_name, "section")
+         if self.has_section(new_name):
+             raise ValueError("Destination section '%s' already exists" % new_name)
+ 
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +2 -1
index 38fbd8a078..1ba34dbf52 100644
@@ -14,13 +14,14 @@ CVE_PRODUCT = "gitpython_project:gitpython"
 
 inherit pypi python_setuptools_build_meta
 
-SRC_URI += "file://CVE-2026-42284.patch \
+SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-44243_p1.patch \
             file://CVE-2026-44243_p2.patch \
             file://CVE-2026-44244_p1.patch \
             file://CVE-2026-44244_p2.patch \
             file://CVE-2026-42215_p1.patch \
             file://CVE-2026-42215_p2.patch \
+            file://CVE-2026-67326.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#2 lore raw

PATCH 2/27 python3-git: Fix CVE-2026-67323

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/701ce32fe5ba8cb622c0e0342a376a6beb47d738
[2] https://www.cve.org/CVERecord?id=CVE-2026-67323

---
 .../python/python3-git/CVE-2026-67323.patch   | 346 ++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |   1 +
 2 files changed, 347 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67323.patch
meta/recipes-devtools/python/python3-git/CVE-2026-67323.patch new file +346 -0
new file mode 100644
index 0000000000..1d1140b65a
@@ -0,0 +1,346 @@
+From be9e81b3ded21bb7e20d9d679cf3409002a7bc79 Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <[email protected]>
+Date: Sun, 12 Jul 2026 15:06:42 +0200
+Subject: [PATCH 11/38] fix: Guard unsafe git command options
+ (GHSA-956x-8gvw-wg5v)
+
+Reject command options that can execute arbitrary helpers or write files when passed through archive, revision traversal, blame, clone, fetch, pull, push, and ls-remote APIs. Validate positional option tokens and transformed keyword options consistently, including Git-supported long-option abbreviations, attached short-option values, and falsey stringifiable remotes. Preserve explicit allow_unsafe_options and allow_unsafe_protocols escape hatches.
+
+Add regression coverage for each guarded API, option spelling and abbreviation forms, inert keyword values, mixed positional and keyword candidates, tuple blame options, stringifiable remotes, and unsafe commands that must not create marker files.
+
+CVE: CVE-2026-67323
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/701ce32fe5ba8cb622c0e0342a376a6beb47d738]
+
+Backport Changes:
+- Omit upstream regression test changes because the current 
+  PyPI source archive does not include its test suite.
+- Port the guards into the 3.1.42 method signatures where 
+  the upstream API had since changed.
+
+Reviewed-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit 701ce32fe5ba8cb622c0e0342a376a6beb47d738)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/cmd.py            |   22 +++++++++++-
+ git/objects/commit.py |   12 ++++++
+ git/remote.py         |   15 ++++++--
+ git/repo/base.py      |   93 +++++++++++++++++++++++++++++++++++++++++++------
+ 4 files changed, 126 insertions(+), 16 deletions(-)
+
+diff --git a/git/cmd.py b/git/cmd.py
+index 8e8cd0c5..81ea0b3c 100644
+--- a/git/cmd.py
++++ b/git/cmd.py
+@@ -316,6 +316,11 @@ class Git(LazyMixin):
+ 
+     re_unsafe_protocol = re.compile(r"(.+)::.+")
+ 
++    unsafe_git_ls_remote_options = [
++        # This option allows arbitrary command execution in git-ls-remote.
++        "--upload-pack",
++    ]
++
+     def __getstate__(self) -> Dict[str, Any]:
+         return slots_to_dict(self, exclude=self._excluded_)
+ 
+@@ -853,6 +858,21 @@ class Git(LazyMixin):
+         else:
+             super()._set_cache_(attr)
+         # END handle version info
++    def ls_remote(
++        self,
++        *args: Any,
++        allow_unsafe_options: bool = False,
++        **kwargs: Any,
++    ) -> Union[str, bytes, Tuple[int, Union[str, bytes], str], "Git.AutoInterrupt"]:
++        """List references in a remote repository.
++
++        :param allow_unsafe_options:
++            Allow unsafe options, like ``--upload-pack``.
++        """
++        if not allow_unsafe_options:
++            candidate_options = self._option_candidates(args, kwargs)
++            Git.check_unsafe_options(options=candidate_options, unsafe_options=self.unsafe_git_ls_remote_options)
++        return self._call_process("ls_remote", *args, **kwargs)
+ 
+     @property
+     def working_dir(self) -> Union[None, PathLike]:
+@@ -1295,7 +1315,7 @@ class Git(LazyMixin):
+         return args
+ 
+     @classmethod
+-    def _unpack_args(cls, arg_list: Sequence[str]) -> List[str]:
++    def _unpack_args(cls, arg_list: Sequence[Any]) -> List[str]:
+         outlist = []
+         if isinstance(arg_list, (list, tuple)):
+             for arg in arg_list:
+diff --git a/git/objects/commit.py b/git/objects/commit.py
+index caec1b6c..ae60d286 100644
+--- a/git/objects/commit.py
++++ b/git/objects/commit.py
+@@ -76,6 +76,12 @@ class Commit(base.Object, TraversableIterableObj, Diffable, Serializable):
+     default_encoding = "UTF-8"
+ 
+     # object configuration
++    # Options to :manpage:`git-rev-list(1)` that can overwrite files.
++    unsafe_git_rev_options = [
++        "--output",
++        "-o",
++    ]
++
+     type: Literal["commit"] = "commit"
+     __slots__ = (
+         "tree",
+@@ -269,6 +275,7 @@ class Commit(base.Object, TraversableIterableObj, Diffable, Serializable):
+         repo: "Repo",
+         rev: Union[str, "Commit", "SymbolicReference"],  # type: ignore
+         paths: Union[PathLike, Sequence[PathLike]] = "",
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> Iterator["Commit"]:
+         """Find all commits matching the given criteria.
+@@ -294,6 +301,11 @@ class Commit(base.Object, TraversableIterableObj, Diffable, Serializable):
+             raise ValueError("--pretty cannot be used as parsing expects single sha's only")
+         # END handle pretty
+ 
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([rev], kwargs), unsafe_options=cls.unsafe_git_rev_options
++            )
++
+         # Use -- in all cases, to prevent possibility of ambiguous arguments.
+         # See https://github.com/gitpython-developers/GitPython/issues/264.
+ 
+diff --git a/git/remote.py b/git/remote.py
+index 3ccac59d..25e076f3 100644
+--- a/git/remote.py
++++ b/git/remote.py
+@@ -1005,7 +1005,10 @@ class Remote(LazyMixin, IterableObj):
+                     Git.check_unsafe_protocols(ref)
+ 
+         if not allow_unsafe_options:
+-            Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_fetch_options)
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs),
++                unsafe_options=self.unsafe_git_fetch_options,
++            )
+ 
+         proc = self.repo.git.fetch(
+             "--", self, *args, as_process=True, with_stdout=False, universal_newlines=True, v=verbose, **kwargs
+@@ -1046,7 +1049,10 @@ class Remote(LazyMixin, IterableObj):
+                 Git.check_unsafe_protocols(ref)
+ 
+         if not allow_unsafe_options:
+-            Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_pull_options)
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs),
++                unsafe_options=self.unsafe_git_pull_options,
++            )
+ 
+         proc = self.repo.git.pull(
+             "--", self, refspec, with_stdout=False, as_process=True, universal_newlines=True, v=True, **kwargs
+@@ -1111,7 +1117,10 @@ class Remote(LazyMixin, IterableObj):
+                 Git.check_unsafe_protocols(ref)
+ 
+         if not allow_unsafe_options:
+-            Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_push_options)
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs),
++                unsafe_options=self.unsafe_git_push_options,
++            )
+ 
+         proc = self.repo.git.push(
+             "--",
+diff --git a/git/repo/base.py b/git/repo/base.py
+index 92ace3a0..5b255997 100644
+--- a/git/repo/base.py
++++ b/git/repo/base.py
+@@ -152,6 +152,20 @@ class Repo:
+     https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---configltkeygtltvaluegt
+     """
+ 
++    unsafe_git_archive_options = [
++        # Allows arbitrary command execution through the remote git-upload-archive command.
++        "--exec",
++        # Writes output to a caller-controlled filesystem path.
++        "--output",
++        "-o",
++    ]
++
++    unsafe_git_revision_options = [
++        # This option allows output to be written to arbitrary files before revision parsing.
++        "--output",
++        "-o",
++    ]
++
+     # Invariants
+     config_level: ConfigLevels_Tup = ("system", "user", "global", "repository")
+     """Represents the configuration level of a configuration file."""
+@@ -690,6 +704,7 @@ class Repo:
+         self,
+         rev: Union[str, Commit, "SymbolicReference", None] = None,
+         paths: Union[PathLike, Sequence[PathLike]] = "",
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> Iterator[Commit]:
+         """A list of Commit objects representing the history of a given ref/commit.
+@@ -705,7 +720,11 @@ class Repo:
+         :param kwargs:
+             Arguments to be passed to git-rev-list - common ones are max_count and skip.
+ 
+-        :note: To receive only commits between two named revisions, use the
++        :param allow_unsafe_options:
++            Allow unsafe options in the revision argument, like ``--output``.
++
++        :note:
++            To receive only commits between two named revisions, use the
+             ``"revA...revB"`` revision specifier.
+ 
+         :return: ``git.Commit[]``
+@@ -713,7 +732,18 @@ class Repo:
+         if rev is None:
+             rev = self.head.commit
+ 
+-        return Commit.iter_items(self, rev, paths, **kwargs)
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([rev], kwargs), unsafe_options=self.unsafe_git_revision_options
++            )
++
++        return Commit.iter_items(
++            self,
++            rev,
++            paths,
++            allow_unsafe_options=allow_unsafe_options,
++            **kwargs,
++        )
+ 
+     def merge_base(self, *rev: TBD, **kwargs: Any) -> List[Union[Commit_ish, None]]:
+         """Find the closest common ancestor for the given revision (Commits, Tags, References, etc.).
+@@ -957,7 +987,9 @@ class Repo:
+         # reveal_type(self.head.reference)  # => Reference
+         return self.head.reference
+ 
+-    def blame_incremental(self, rev: str | HEAD, file: str, **kwargs: Any) -> Iterator["BlameEntry"]:
++    def blame_incremental(
++        self, rev: str | HEAD | None, file: str, allow_unsafe_options: bool = False, **kwargs: Any
++    ) -> Iterator["BlameEntry"]:
+         """Iterator for blame information for the given file at the given revision.
+ 
+         Unlike :meth:`blame`, this does not return the actual file's contents, only a
+@@ -965,13 +997,21 @@ class Repo:
+ 
+         :param rev: Revision specifier, see git-rev-parse for viable options.
+ 
+-        :return: Lazy iterator of :class:`BlameEntry` tuples, where the commit indicates
+-            the commit to blame for the line, and range indicates a span of line numbers
+-            in the resulting file.
++        :param allow_unsafe_options:
++            Allow unsafe options in revision argument, like ``--output``.
++
++        :return:
++            Lazy iterator of :class:`BlameEntry` tuples, where the commit indicates the
++            commit to blame for the line, and range indicates a span of line numbers in
++            the resulting file.
+ 
+         If you combine all line number ranges outputted by this command, you should get
+         a continuous range spanning all line numbers in the file.
+         """
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([rev], kwargs), unsafe_options=self.unsafe_git_revision_options
++            )
+ 
+         data: bytes = self.git.blame(rev, "--", file, p=True, incremental=True, stdout_as_string=False, **kwargs)
+         commits: Dict[bytes, Commit] = {}
+@@ -1048,13 +1088,17 @@ class Repo:
+         rev: Union[str, HEAD],
+         file: str,
+         incremental: bool = False,
+-        rev_opts: Optional[List[str]] = None,
++        rev_opts: Optional[Sequence[str]] = None,
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> List[List[Commit | List[str | bytes] | None]] | Iterator[BlameEntry] | None:
+         """The blame information for the given file at the given revision.
+ 
+         :param rev: Revision specifier, see git-rev-parse for viable options.
+ 
++        :param allow_unsafe_options:
++            Allow unsafe options in revision argument, like ``--output``.
++
+         :return:
+             list: [git.Commit, list: [<line>]]
+ 
+@@ -1063,9 +1107,14 @@ class Repo:
+             of appearance.
+         """
+         if incremental:
+-            return self.blame_incremental(rev, file, **kwargs)
+-        rev_opts = rev_opts or []
+-        data: bytes = self.git.blame(rev, *rev_opts, "--", file, p=True, stdout_as_string=False, **kwargs)
++            return self.blame_incremental(rev, file, allow_unsafe_options=allow_unsafe_options, **kwargs)
++        rev_opts_list = list(rev_opts or [])
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([rev, rev_opts_list], kwargs),
++                unsafe_options=self.unsafe_git_revision_options,
++            )
++        data: bytes = self.git.blame(rev, *rev_opts_list, "--", file, p=True, stdout_as_string=False, **kwargs)
+         commits: Dict[str, Commit] = {}
+         blames: List[List[Commit | List[str | bytes] | None]] = []
+ 
+@@ -1270,7 +1319,10 @@ class Repo:
+         if not allow_unsafe_protocols:
+             Git.check_unsafe_protocols(str(url))
+         if not allow_unsafe_options:
+-            Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=cls.unsafe_git_clone_options)
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs),
++                unsafe_options=cls.unsafe_git_clone_options,
++            )
+         if not allow_unsafe_options and multi:
+             Git.check_unsafe_options(options=multi, unsafe_options=cls.unsafe_git_clone_options)
+ 
+@@ -1419,6 +1471,8 @@ class Repo:
+         ostream: Union[TextIO, BinaryIO],
+         treeish: Optional[str] = None,
+         prefix: Optional[str] = None,
++        allow_unsafe_options: bool = False,
++        allow_unsafe_protocols: bool = False,
+         **kwargs: Any,
+     ) -> Repo:
+         """Archive the tree at the given revision.
+@@ -1436,7 +1490,14 @@ class Repo:
+             * You may specify the special **path** keyword, which may either be a repository-relative
+               path to a directory or file to place into the archive, or a list or tuple of multiple paths.
+ 
+-        :raise GitCommandError: If something went wrong.
++        :param allow_unsafe_options:
++            Allow unsafe options, like ``--exec`` or ``--output``.
++
++        :param allow_unsafe_protocols:
++            Allow unsafe protocols to be used in ``remote``, like ``ext``.
++
++        :raise git.exc.GitCommandError:
++            If something went wrong.
+ 
+         :return: self
+         """
+@@ -1444,6 +1505,14 @@ class Repo:
+             treeish = self.head.commit
+         if prefix and "prefix" not in kwargs:
+             kwargs["prefix"] = prefix
++        remote = kwargs.get("remote")
++        if not allow_unsafe_protocols and remote is not None:
++            Git.check_unsafe_protocols(str(remote))
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs),
++                unsafe_options=self.unsafe_git_archive_options,
++            )
+         kwargs["output_stream"] = ostream
+         path = kwargs.pop("path", [])
+         path = cast(Union[PathLike, List[PathLike], Tuple[PathLike, ...]], path)
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 1ba34dbf52..f3d2c9de80 100644
@@ -22,6 +22,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-42215_p1.patch \
             file://CVE-2026-42215_p2.patch \
             file://CVE-2026-67326.patch \
+            file://CVE-2026-67323.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#3 lore raw

PATCH 3/27 python3-git: fix CVE-2026-67325

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [3], using the commit shown in [1] and [2].

[1] https://github.com/gitpython-developers/GitPython/commit/2ab051697940144545a14d2f4a639c6409c3187f
[2] https://github.com/gitpython-developers/GitPython/commit/181e8ede7543dbbdcee92756cea260f675316c63
[3] https://www.cve.org/CVERecord?id=CVE-2026-67325

---
 .../python3-git/CVE-2026-67325_p1.patch       | 50 +++++++++++++++++
 .../python3-git/CVE-2026-67325_p2.patch       | 53 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  2 +
 3 files changed, 105 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67325_p1.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67325_p2.patch
meta/recipes-devtools/python/python3-git/CVE-2026-67325_p1.patch new file +50 -0
new file mode 100644
index 0000000000..7c49ff0543
@@ -0,0 +1,50 @@
+From 2375813d552210675950e73cbdad1baec3be8d74 Mon Sep 17 00:00:00 2001
+From: abhiprd2000 <[email protected]>
+Date: Thu, 9 Jul 2026 21:22:50 +0530
+Subject: [PATCH 09/38] Reject abbreviated forms of unsafe git options
+
+CVE: CVE-2026-67325
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/2ab051697940144545a14d2f4a639c6409c3187f]
+
+Backport Changes:
+- Omit upstream regression test changes because the current 
+  PyPI source archive does not include its test suite.
+
+(cherry picked from commit 2ab051697940144545a14d2f4a639c6409c3187f)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/cmd.py |   17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/git/cmd.py b/git/cmd.py
+index c09d47ba..e965c586 100644
+--- a/git/cmd.py
++++ b/git/cmd.py
+@@ -563,13 +563,20 @@ class Git(LazyMixin):
+         arbitrary commands, this are blocked by default.
+         """
+         # Options can be of the form `foo`, `--foo`, `--foo bar`, or `--foo=bar`.
++        # Git accepts any unambiguous prefix of a long option, so an abbreviated
++        # spelling such as `--upl` for `--upload-pack` must be rejected too. An
++        # option is unsafe if its canonical name is a prefix of any blocked
++        # option's canonical name.
+         canonical_unsafe_options = {cls._canonicalize_option_name(option): option for option in unsafe_options}
+         for option in options:
+-            unsafe_option = canonical_unsafe_options.get(cls._canonicalize_option_name(option))
+-            if unsafe_option is not None:
+-                raise UnsafeOptionError(
+-                    f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it."
+-                )
++            candidate = cls._canonicalize_option_name(option)
++            if not candidate:
++                continue
++            for canonical, unsafe_option in canonical_unsafe_options.items():
++                if canonical.startswith(candidate):
++                    raise UnsafeOptionError(
++                        f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it."
++                    )
+ 
+     class AutoInterrupt:
+         """Process wrapper that terminates the wrapped process on finalization.
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git/CVE-2026-67325_p2.patch new file +53 -0

53 lines not on this page · raw message

meta/recipes-devtools/python/python3-git_3.1.42.bb +2 -0
index f3d2c9de80..a36a0faa29 100644
@@ -23,6 +23,8 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-42215_p2.patch \
             file://CVE-2026-67326.patch \
             file://CVE-2026-67323.patch \
+            file://CVE-2026-67325_p1.patch \
+            file://CVE-2026-67325_p2.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#4 lore raw

PATCH 4/27 python3-git: fix CVE-2026-67324

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/56806080c1348749b07daa4a2024ce47b3cad285
[2] https://www.cve.org/CVERecord?id=CVE-2026-67324

---
 .../python/python3-git/CVE-2026-67324.patch   | 102 ++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |   1 +
 2 files changed, 103 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67324.patch
meta/recipes-devtools/python/python3-git/CVE-2026-67324.patch new file +102 -0
new file mode 100644
index 0000000000..a780464905
@@ -0,0 +1,102 @@
+From a5742dea36a84dece8a01526cdef0714aecac070 Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <[email protected]>
+Date: Sun, 12 Jul 2026 14:12:16 +0200
+Subject: [PATCH 12/38] fix: reject joined unsafe short options
+
+GitPython blocks options such as --upload-pack/-u and --config/-c
+because they can execute arbitrary commands unless unsafe options are
+explicitly allowed. Git also accepts a short option with its value
+joined to the same token, including after clusterable flags. Forms
+such as -uVALUE, -fuVALUE, -cVALUE, and -vcVALUE could therefore
+bypass an exact-token check.
+
+Parse single-dash option tokens sufficiently to recognize blocked
+short options while preserving safe attached values such as
+-oupstream. Also distinguish clone multi-option values from bare
+kwargs so positional values are not treated as long-option
+abbreviations.
+
+This completes the option-validation hardening for
+GHSA-2f96-g7mh-g2hx.
+
+CVE: CVE-2026-67324
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/56806080c1348749b07daa4a2024ce47b3cad285]
+
+Backport Changes:
+- Omit upstream regression test changes because the current 
+  PyPI source archive does not include its test suite.
+
+Reviewed-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit 56806080c1348749b07daa4a2024ce47b3cad285)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/cmd.py |   40 ++++++++++++++++++++++++++++++++++++----
+ 1 file changed, 36 insertions(+), 4 deletions(-)
+
+diff --git a/git/cmd.py b/git/cmd.py
+index 81ea0b3c..1903bb01 100644
+--- a/git/cmd.py
++++ b/git/cmd.py
+@@ -562,10 +562,23 @@ class Git(LazyMixin):
+ 
+     @classmethod
+     def check_unsafe_options(cls, options: List[str], unsafe_options: List[str]) -> None:
+-        """Check for unsafe options.
+-
+-        Some options that are passed to `git <command>` can be used to execute
+-        arbitrary commands, this are blocked by default.
++        """Raise :class:`~git.exc.UnsafeOptionError` for blocked option spellings.
++
++        In addition to exact matches, this rejects abbreviated long options accepted
++        by Git (for example, ``--upl`` for ``--upload-pack``) and unsafe short options
++        whose values are joined to the same token, including after clusterable flags
++        (for example, ``-uVALUE`` and ``-fuVALUE``).
++
++        A list containing only bare names is treated as normalized keyword arguments,
++        so multi-character names such as ``upload_p`` are checked as long-option
++        abbreviations. If any item starts with ``-``, the list is treated as tokenized
++        command-line input: bare items can be option values and are not checked as
++        abbreviations. Thus ``["--origin", "upload"]`` is allowed. Single-dash options
++        use short-option parsing rather than broad prefix matching, preserving safe
++        attached values such as ``-oupstream`` and ``-bcurrent``.
++
++        Some options passed to ``git <command>`` can execute arbitrary commands and
++        are therefore blocked by default unless the caller explicitly allows them.
+         """
+         # Options can be of the form `foo`, `--foo`, `--foo bar`, or `--foo=bar`.
+         # Git accepts any unambiguous prefix of a long option, so an abbreviated
+@@ -575,6 +588,15 @@ class Git(LazyMixin):
+         # can be abbreviations; single-character short options remain exact-match
+         # only.
+         canonical_unsafe_options = {cls._canonicalize_option_name(option): option for option in unsafe_options}
++        unsafe_short_options = {
++            canonical: option
++            for canonical, option in canonical_unsafe_options.items()
++            if option.startswith("-") and not option.startswith("--") and len(canonical) == 1
++        }
++        # These value-less Git flags can be clustered before another short option
++        # (for example, ``-fuVALUE``). Stop at any other character because it may
++        # begin an attached value, as ``o`` does in the safe option ``-oupstream``.
++        clusterable_short_options = frozenset("46flnqsv")
+         options_are_kwargs = all(not option.startswith("-") for option in options)
+         for option in options:
+             candidate = cls._canonicalize_option_name(option)
+@@ -583,6 +605,16 @@ class Git(LazyMixin):
+             unsafe_option = canonical_unsafe_options.get(candidate)
+             if unsafe_option is not None:
+                 raise UnsafeOptionError(f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it.")
++            option_token = option.split("=", 1)[0].split(None, 1)[0]
++            if option_token.startswith("-") and not option_token.startswith("--"):
++                for option_char in option_token[1:]:
++                    unsafe_option = unsafe_short_options.get(option_char)
++                    if unsafe_option is not None:
++                        raise UnsafeOptionError(
++                            f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it."
++                        )
++                    if option_char not in clusterable_short_options:
++                        break
+             if not (option.startswith("--") or (options_are_kwargs and len(candidate) > 1)):
+                 continue
+             for canonical, unsafe_option in canonical_unsafe_options.items():
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index a36a0faa29..788cc4c173 100644
@@ -25,6 +25,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-67323.patch \
             file://CVE-2026-67325_p1.patch \
             file://CVE-2026-67325_p2.patch \
+            file://CVE-2026-67324.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#5 lore raw

PATCH 5/27 python3-git: fix CVE-2026-67322

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1]

[1] https://github.com/gitpython-developers/GitPython/commit/8ac5a30519b6f4af85398b9b9d7064ff4d452da2
[2] https://www.cve.org/CVERecord?id=CVE-2026-67322

---
 .../python/python3-git/CVE-2026-67322.patch   | 174 ++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |   1 +
 2 files changed, 175 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67322.patch
meta/recipes-devtools/python/python3-git/CVE-2026-67322.patch new file +174 -0
new file mode 100644
index 0000000000..1c378c9e77
@@ -0,0 +1,174 @@
+From eca51fe4d3741f64b4204a6da04536d428390a4f Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <[email protected]>
+Date: Wed, 15 Jul 2026 16:44:13 +0200
+Subject: [PATCH 13/38] fix: prevent environment expansion in clone URLs
+
+Repo.clone_from() expanded environment-variable references in caller-supplied
+URLs before passing them to git clone. This could expose process environment
+values to an untrusted remote and made protocol validation apply to a different
+value than Git received.
+
+Polish clone URLs without variable or home expansion on native and Cygwin
+Git, then apply unsafe-protocol validation to that exact normalized value.
+Preserve the literal URL when normalizing the stored origin after a successful
+clone, while retaining the existing Git.polish_url() default for callers
+that intentionally normalize local paths. Add regression coverage for
+POSIX and Windows variable syntax, Cygwin conversion, stored origins, and
+post-normalization protocol validation.
+
+Git baseline: git clone passes URL arguments through literally; t/t5601-clone.sh
+covers the accepted URL forms without shell-style environment expansion.
+
+Security: GHSA-rwj8-pgh3-r573.
+
+CVE: CVE-2026-67322
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/8ac5a30519b6f4af85398b9b9d7064ff4d452da2]
+
+Backport Changes:
+- Omit upstream regression test changes because the current 
+  PyPI source archive does not include its test suite.
+
+Co-authored-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit 8ac5a30519b6f4af85398b9b9d7064ff4d452da2)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/cmd.py       |   29 ++++++++++++++++-------------
+ git/repo/base.py |    7 ++++---
+ git/util.py      |   15 +++++++++------
+ 3 files changed, 29 insertions(+), 22 deletions(-)
+
+diff --git a/git/cmd.py b/git/cmd.py
+index 1903bb01..46619459 100644
+--- a/git/cmd.py
++++ b/git/cmd.py
+@@ -497,31 +497,34 @@ class Git(LazyMixin):
+ 
+     @overload
+     @classmethod
+-    def polish_url(cls, url: str, is_cygwin: Literal[False] = ...) -> str:
+-        ...
++    def polish_url(cls, url: str, is_cygwin: Literal[False] = ..., expand_vars: bool = ...) -> str: ...
+ 
+     @overload
+     @classmethod
+-    def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None) -> str:
+-        ...
++    def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None, expand_vars: bool = True) -> str: ...
+ 
+     @classmethod
+-    def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None) -> PathLike:
+-        """Remove any backslashes from urls to be written in config files.
++    def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None, expand_vars: bool = True) -> PathLike:
++        """Remove any backslashes from URLs to be written in config files.
++
++        Windows might create config files containing paths with backslashes, but git
++        stops liking them as it will escape the backslashes. Hence we undo the escaping
++        just to be sure.
+ 
+-        Windows might create config files containing paths with backslashes,
+-        but git stops liking them as it will escape the backslashes. Hence we
+-        undo the escaping just to be sure.
++        :param expand_vars:
++            Expand environment variables and an initial ``~``. Disable this for values
++            obtained from an untrusted source, such as remote URLs.
+         """
+         if is_cygwin is None:
+             is_cygwin = cls.is_cygwin()
+ 
+         if is_cygwin:
+-            url = cygpath(url)
++            url = cygpath(url, expand_vars=expand_vars)
+         else:
+-            url = os.path.expandvars(url)
+-            if url.startswith("~"):
+-                url = os.path.expanduser(url)
++            if expand_vars:
++                url = os.path.expandvars(url)
++                if url.startswith("~"):
++                    url = os.path.expanduser(url)
+             url = url.replace("\\\\", "\\").replace("\\", "/")
+         return url
+ 
+diff --git a/git/repo/base.py b/git/repo/base.py
+index 5b255997..0440a92d 100644
+--- a/git/repo/base.py
++++ b/git/repo/base.py
+@@ -1316,8 +1316,9 @@ class Repo:
+         if multi_options:
+             multi = shlex.split(" ".join(multi_options))
+ 
++        clone_url = Git.polish_url(url, expand_vars=False)
+         if not allow_unsafe_protocols:
+-            Git.check_unsafe_protocols(str(url))
++            Git.check_unsafe_protocols(clone_url)
+         if not allow_unsafe_options:
+             Git.check_unsafe_options(
+                 options=Git._option_candidates([], kwargs),
+@@ -1329,7 +1330,7 @@ class Repo:
+         proc = git.clone(
+             multi,
+             "--",
+-            Git.polish_url(str(url)),
++            clone_url,
+             clone_path,
+             with_extended_output=True,
+             as_process=True,
+@@ -1370,7 +1371,7 @@ class Repo:
+         # sure.
+         if repo.remotes:
+             with repo.remotes[0].config_writer as writer:
+-                writer.set_value("url", Git.polish_url(repo.remotes[0].url))
++                writer.set_value("url", Git.polish_url(repo.remotes[0].url, expand_vars=False))
+         # END handle remote repo
+         return repo
+ 
+diff --git a/git/util.py b/git/util.py
+index 5a136d18..d3eaeb8b 100644
+--- a/git/util.py
++++ b/git/util.py
+@@ -361,13 +361,13 @@ def py_where(program: str, path: Optional[PathLike] = None) -> List[str]:
+     return progs
+ 
+ 
+-def _cygexpath(drive: Optional[str], path: str) -> str:
++def _cygexpath(drive: Optional[str], path: str, expand_vars: bool = True) -> str:
+     if osp.isabs(path) and not drive:
+         # Invoked from `cygpath()` directly with `D:Apps\123`?
+         #  It's an error, leave it alone just slashes)
+         p = path  # convert to str if AnyPath given
+     else:
+-        p = path and osp.normpath(osp.expandvars(osp.expanduser(path)))
++        p = path and osp.normpath(osp.expandvars(osp.expanduser(path)) if expand_vars else path)
+         if osp.isabs(p):
+             if drive:
+                 # Confusing, maybe a remote system should expand vars.
+@@ -395,7 +395,7 @@ _cygpath_parsers: Tuple[Tuple[Pattern[str], Callable, bool], ...] = (
+ )
+ 
+ 
+-def cygpath(path: str) -> str:
++def cygpath(path: str, expand_vars: bool = True) -> str:
+     """Use :meth:`git.cmd.Git.polish_url` instead, that works on any environment."""
+     path = str(path)  # Ensure is str and not AnyPath.
+     # Fix to use Paths when 3.5 dropped. Or to be just str if only for URLs?
+@@ -403,12 +403,15 @@ def cygpath(path: str) -> str:
+         for regex, parser, recurse in _cygpath_parsers:
+             match = regex.match(path)
+             if match:
+-                path = parser(*match.groups())
++                if parser is _cygexpath:
++                    path = parser(*match.groups(), expand_vars=expand_vars)
++                else:
++                    path = parser(*match.groups())
+                 if recurse:
+-                    path = cygpath(path)
++                    path = cygpath(path, expand_vars=expand_vars)
+                 break
+         else:
+-            path = _cygexpath(None, path)
++            path = _cygexpath(None, path, expand_vars=expand_vars)
+ 
+     return path
+ 
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 788cc4c173..cbfdb5e757 100644
@@ -26,6 +26,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-67325_p1.patch \
             file://CVE-2026-67325_p2.patch \
             file://CVE-2026-67324.patch \
+            file://CVE-2026-67322.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#6 lore raw

PATCH 6/27 python3-git: fix CVE-2026-69097

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/1ed1b924f4e2d2ee7bab296df77b978af21853f1
[2] https://www.cve.org/CVERecord?id=CVE-2026-69097

---
 .../python/python3-git/CVE-2026-69097.patch   | 61 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-69097.patch
meta/recipes-devtools/python/python3-git/CVE-2026-69097.patch new file +61 -0
new file mode 100644
index 0000000000..9d472d3358
@@ -0,0 +1,61 @@
+From 128f8da8dac072f61427b5bf7801173915d69b85 Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <[email protected]>
+Date: Mon, 20 Jul 2026 14:13:22 +0200
+Subject: [PATCH 14/38] fix: validate config section delimiters
+
+GHSA-3rp5-jjmw-4wv2 identified that configuration section names could alter the
+structure of serialized config despite the existing control-character checks.
+
+Reject unquoted closing section delimiters across all writer entry points
+while preserving valid delimiters inside quoted subsections and the
+existing option-name behavior. Add regression coverage for unsafe plain and
+quoted-subsection-shaped names as well as a valid quoted subsection.
+
+Git baseline: a23bace963d508bd96983cc637131392d3face18. Git config parsing
+treats an unquoted closing bracket as the end of a basic section header, while
+its extended form permits brackets inside a quoted subsection and requires a
+final bracket after the closing quote.
+
+CVE: CVE-2026-69097
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/1ed1b924f4e2d2ee7bab296df77b978af21853f1]
+
+Backport Changes:
+- Omit upstream regression test changes because the current 
+  PyPI source archive does not include its test suite.
+
+Co-authored-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit 1ed1b924f4e2d2ee7bab296df77b978af21853f1)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/config.py |   16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/git/config.py b/git/config.py
+index 1df1415f..3015bb73 100644
+--- a/git/config.py
++++ b/git/config.py
+@@ -854,6 +854,22 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
+     def _assure_config_name_safe(self, name: "cp._SectionName", label: str) -> None:
+         if isinstance(name, str) and UNSAFE_CONFIG_CHARS_RE.search(name):
+             raise ValueError("Git config %s names must not contain CR, LF, or NUL" % label)
++        if label == "section" and isinstance(name, str):
++            in_quotes = False
++            escaped = False
++            for index, char in enumerate(name):
++                if escaped:
++                    escaped = False
++                elif in_quotes and char == "\\":
++                    escaped = True
++                elif char == '"':
++                    if not in_quotes and (index == 0 or name[index - 1] not in " \t"):
++                        raise ValueError("Git config quoted subsection names must begin after whitespace")
++                    in_quotes = not in_quotes
++                elif char == "]" and not in_quotes:
++                    raise ValueError("Git config section names must not contain an unquoted closing bracket")
++            if in_quotes:
++                raise ValueError("Git config section names must not contain an unterminated quote")
+ 
+     @needs_values
+     @set_dirty_and_flush_changes
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index cbfdb5e757..c5cefeaee8 100644
@@ -27,6 +27,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-67325_p2.patch \
             file://CVE-2026-67324.patch \
             file://CVE-2026-67322.patch \
+            file://CVE-2026-69097.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#7 lore raw

PATCH 7/27 python3-git: fix CVE-2026-73625

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/e8d0fbf774d1f6baa3b481adfe48bd262e43b453
[2] https://www.cve.org/CVERecord?id=CVE-2026-73625

---
 .../python/python3-git/CVE-2026-73625.patch   | 68 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 69 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73625.patch
meta/recipes-devtools/python/python3-git/CVE-2026-73625.patch new file +68 -0
new file mode 100644
index 0000000000..995c7cbaa0
@@ -0,0 +1,68 @@
+From ac1290549f1f8fa8ba19370805200f69b52a56db Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <[email protected]>
+Date: Wed, 22 Jul 2026 04:39:00 +0200
+Subject: [PATCH 15/38] fix: validate split short-option values
+
+<!-- agent -->
+
+Single-character keyword arguments are transformed into an option token and
+a separate value token. The unsafe-option candidate builder only checked the
+keyword name, allowing an option-like value to bypass guards shared by clone,
+remote, revision, blame, and archive operations.
+
+Include dash-prefixed values only when short options are actually split,
+including sequence values, while preserving bare values and the non-splitting
+compatibility path.
+
+Git baseline a23bace9 defines clone -n and --upload-pack as distinct options,
+matching the argv boundary this validation now preserves.
+
+Refs GHSA-r9mr-m37c-5fr3.
+
+CVE: CVE-2026-73625
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/e8d0fbf774d1f6baa3b481adfe48bd262e43b453]
+
+Backport Changes:
+- Omit upstream regression test changes because the current 
+  PyPI source archive does not include its test suite.
+
+Co-authored-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit e8d0fbf774d1f6baa3b481adfe48bd262e43b453)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/cmd.py |   20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/git/cmd.py b/git/cmd.py
+index 46619459..f907fa4e 100644
+--- a/git/cmd.py
++++ b/git/cmd.py
+@@ -626,6 +626,26 @@ class Git(LazyMixin):
+                         f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it."
+                     )
+ 
++    @classmethod
++    def _option_candidates(cls, args: Sequence[Any] = (), kwargs: Optional[Mapping[str, Any]] = None) -> List[str]:
++        """Collect possible option spellings before command-line transformation."""
++        options = [
++            option for option in cls._unpack_args([arg for arg in args if arg is not None]) if option.startswith("-")
++        ]
++        if kwargs:
++            split_single_char_options = kwargs.get("split_single_char_options", True)
++            for key, value in kwargs.items():
++                values = value if isinstance(value, (list, tuple)) else (value,)
++                if any(value is True or (value is not False and value is not None) for value in values):
++                    key = str(key)
++                    options.append(f"-{key}" if len(key) == 1 else f"--{dashify(key)}")
++                    if len(key) == 1 and split_single_char_options:
++                        options.extend(
++                            str(value)
++                            for value in values
++                            if value is not True and value not in (False, None) and str(value).startswith("-")
++                        )
++        return options
+     class AutoInterrupt:
+         """Process wrapper that terminates the wrapped process on finalization.
+ 
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index c5cefeaee8..18132b8af9 100644
@@ -28,6 +28,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-67324.patch \
             file://CVE-2026-67322.patch \
             file://CVE-2026-69097.patch \
+            file://CVE-2026-73625.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#8 lore raw

PATCH 8/27 python3-git: fix CVE-2026-73623

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/ffcb5359e87619f4fe4a70a4aff5f08c5580ba97
[2] https://www.cve.org/CVERecord?id=CVE-2026-73623

---
 .../python/python3-git/CVE-2026-73623.patch   | 54 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 55 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73623.patch
meta/recipes-devtools/python/python3-git/CVE-2026-73623.patch new file +54 -0
new file mode 100644
index 0000000000..ebfa4a1fab
@@ -0,0 +1,54 @@
+From 915629fa543e06f6066441f8ba13c68f89304104 Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <[email protected]>
+Date: Wed, 22 Jul 2026 04:43:26 +0200
+Subject: [PATCH 16/38] fix: reject unsafe clone templates
+
+<!-- agent -->
+
+Treat git clone --template as unsafe because caller-controlled
+templates can install hooks that execute during clone.
+
+Add regression coverage for both direct option and keyword forms.
+
+References GHSA-6p8h-3wgx-97gf.
+Validated against Git baseline a23bace9.
+
+CVE: CVE-2026-73623
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/ffcb5359e87619f4fe4a70a4aff5f08c5580ba97]
+
+Backport Changes:
+- Omit upstream regression test changes because the current
+  PyPI source archive does not include its test suite.
+
+Co-authored-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit ffcb5359e87619f4fe4a70a4aff5f08c5580ba97)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/repo/base.py |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/git/repo/base.py b/git/repo/base.py
+index 0440a92d..0d4fae8a 100644
+--- a/git/repo/base.py
++++ b/git/repo/base.py
+@@ -140,6 +140,8 @@ class Repo:
+         # Can override configuration variables that execute arbitrary commands:
+         "--config",
+         "-c",
++        # Can install hooks that execute during clone:
++        "--template",
+     ]
+     """Options to ``git clone`` that allow arbitrary commands to be executed.
+ 
+@@ -150,6 +152,9 @@ class Repo:
+     The ``--config``/``-c`` option allows users to override configuration variables like
+     ``protocol.allow`` and ``core.gitProxy`` to execute arbitrary commands:
+     https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---configltkeygtltvaluegt
++
++    The ``--template`` option can install hooks that execute during clone:
++    https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---templatetemplate-directory
+     """
+ 
+     unsafe_git_archive_options = [
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 18132b8af9..959186eeee 100644
@@ -29,6 +29,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-67322.patch \
             file://CVE-2026-69097.patch \
             file://CVE-2026-73625.patch \
+            file://CVE-2026-73623.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#9 lore raw

PATCH 9/27 python3-git: fix CVE-2026-73624

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/1d51b891d7f236044a6aa17498ec682b63dad6e6
[2] https://www.cve.org/CVERecord?id=CVE-2026-73624

---
 .../python/python3-git/CVE-2026-73624.patch   | 135 ++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |   1 +
 2 files changed, 136 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73624.patch
meta/recipes-devtools/python/python3-git/CVE-2026-73624.patch new file +135 -0
new file mode 100644
index 0000000000..b44e805f06
@@ -0,0 +1,135 @@
+From fc5d625a6c45ac58a59dcf8fef246635080a1cbb Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <[email protected]>
+Date: Wed, 22 Jul 2026 04:46:13 +0200
+Subject: [PATCH 17/38] fix: guard diff output options
+
+<!-- agent -->
+
+Reject unsafe diff options before revision parsing or Git invocation so
+callers cannot write command output to arbitrary filesystem paths.
+
+Cover commit and index diffs, including option-like revisions, and
+preserve an explicit allow_unsafe_options escape hatch.
+
+References GHSA-fjr4-x663-mwxc.
+Validated against Git baseline a23bace9.
+
+CVE: CVE-2026-73624
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/1d51b891d7f236044a6aa17498ec682b63dad6e6]
+
+Backport Changes:
+- Omit upstream regression test changes because the current
+  PyPI source archive does not include its test suite.
+- Use the Scarthgap IndexFile.Index spelling while carrying 
+  the upstream guard into the existing API.
+
+Co-authored-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit 1d51b891d7f236044a6aa17498ec682b63dad6e6)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/diff.py       |   15 +++++++++++++--
+ git/index/base.py |   17 +++++++++++++++--
+ 2 files changed, 28 insertions(+), 4 deletions(-)
+
+diff --git a/git/diff.py b/git/diff.py
+index aba1a108..37ff2624 100644
+--- a/git/diff.py
++++ b/git/diff.py
+@@ -5,7 +5,7 @@
+ 
+ import re
+ 
+-from git.cmd import handle_process_output
++from git.cmd import Git, handle_process_output
+ from git.compat import defenc
+ from git.util import finalize_process, hex_to_bin
+ 
+@@ -109,6 +109,7 @@ class Diffable:
+         other: Union[Type["Index"], "Tree", "Commit", None, str, object] = Index,
+         paths: Union[PathLike, List[PathLike], Tuple[PathLike, ...], None] = None,
+         create_patch: bool = False,
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> "DiffIndex":
+         """Create diffs between two items being trees, trees and index or an
+@@ -134,6 +135,10 @@ class Diffable:
+             applied makes the self to other. Patches are somewhat costly as blobs have
+             to be read and diffed.
+ 
++        :param allow_unsafe_options:
++            If ``True``, allow options such as ``--output`` that can write to arbitrary
++            filesystem paths.
++
+         :param kwargs:
+             Additional arguments passed to git-diff, such as ``R=True`` to swap both
+             sides of the diff.
+@@ -145,7 +150,13 @@ class Diffable:
+             :class:`~Diffable.Index`, or as :class:`~git.objects.tree.Tree` or
+             :class:`~git.objects.commit.Commit`, or a git command error will occur.
+         """
+-        args: List[Union[PathLike, Diffable, Type["Diffable.Index"], object]] = []
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([other], kwargs),
++                unsafe_options=self.repo.unsafe_git_revision_options,
++            )
++
++        args: List[Union[PathLike, Diffable]] = []
+         args.append("--abbrev=40")  # We need full shas.
+         args.append("--full-index")  # Get full index paths, not only filenames.
+ 
+diff --git a/git/index/base.py b/git/index/base.py
+index 9d1db4e3..c3d1771c 100644
+--- a/git/index/base.py
++++ b/git/index/base.py
+@@ -19,6 +19,7 @@ from git.compat import (
+     force_bytes,
+     defenc,
+ )
++from git.cmd import Git
+ from git.exc import GitCommandError, CheckoutError, GitError, InvalidGitRepositoryError
+ from git.objects import (
+     Blob,
+@@ -1411,6 +1412,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+         other: Union[Type["git_diff.Diffable.Index"], "Tree", "Commit", str, None] = git_diff.Diffable.Index,
+         paths: Union[PathLike, List[PathLike], Tuple[PathLike, ...], None] = None,
+         create_patch: bool = False,
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> git_diff.DiffIndex:
+         """Diff this index against the working copy or a Tree or Commit object.
+@@ -1422,6 +1424,11 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             Will only work with indices that represent the default git index as
+             they have not been initialized with a stream.
+         """
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([other], kwargs),
++                unsafe_options=self.repo.unsafe_git_revision_options,
++            )
+ 
+         # Only run if we are the default repository index.
+         if self._file_path != self._index_path():
+@@ -1441,7 +1448,13 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             # Invert the existing R flag.
+             cur_val = kwargs.get("R", False)
+             kwargs["R"] = not cur_val
+-            return other.diff(self.Index, paths, create_patch, **kwargs)
++            return other.diff(
++                self.Index,
++                paths,
++                create_patch,
++                allow_unsafe_options=allow_unsafe_options,
++                **kwargs,
++            )
+         # END diff against other item handling
+ 
+         # If other is not None here, something is wrong.
+@@ -1449,4 +1462,4 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             raise ValueError("other must be None, Diffable.Index, a Tree or Commit, was %r" % other)
+ 
+         # Diff against working copy - can be handled by superclass natively.
+-        return super().diff(other, paths, create_patch, **kwargs)
++        return super().diff(other, paths, create_patch, allow_unsafe_options=allow_unsafe_options, **kwargs)
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 959186eeee..734144dc31 100644
@@ -30,6 +30,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-69097.patch \
             file://CVE-2026-73625.patch \
             file://CVE-2026-73623.patch \
+            file://CVE-2026-73624.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#10 lore raw

PATCH 10/27 python3-git: fix CVE-2026-73622

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/863417457a0633db7ea5aed4fd01e0b291a41162
[2] https://www.cve.org/CVERecord?id=CVE-2026-73622

---
 .../python/python3-git/CVE-2026-73622.patch   | 61 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73622.patch
meta/recipes-devtools/python/python3-git/CVE-2026-73622.patch new file +61 -0
new file mode 100644
index 0000000000..e8df692c03
@@ -0,0 +1,61 @@
+From 6bb3d376f6e22140b5ff3d1d4c67c1408ee7e4e6 Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <[email protected]>
+Date: Wed, 22 Jul 2026 15:42:44 +0200
+Subject: [PATCH 18/38] fix: prevent environment expansion in remote URLs
+
+Remote and submodule creation expanded environment-variable references in
+caller-supplied URLs before storing them in Git configuration. This could
+expose process environment values through a later network request or a tracked
+.gitmodules file.
+
+Preserve variables literally in the remaining untrusted URL callers while
+retaining Git.polish_url() expansion for intentional local-path normalization.
+Add regression tests covering remote configuration and submodule configuration.
+
+Git baseline: git remote add and git submodule add accept URL arguments
+literally; Git does not perform shell-style environment expansion on those
+arguments.
+
+CVE: CVE-2026-73622
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/863417457a0633db7ea5aed4fd01e0b291a41162]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Co-authored-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit 863417457a0633db7ea5aed4fd01e0b291a41162)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/objects/submodule/base.py |    2 +-
+ git/remote.py                 |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
+index d08e967b..4fe2ff3f 100644
+--- a/git/objects/submodule/base.py
++++ b/git/objects/submodule/base.py
+@@ -516,7 +516,7 @@ class Submodule(IndexObject, TraversableIterableObj):
+         # END verify url
+ 
+         ## See #525 for ensuring git URLs in config-files are valid under Windows.
+-        url = Git.polish_url(url)
++        url = Git.polish_url(url, expand_vars=False)
+ 
+         # It's important to add the URL to the parent config, to let `git submodule` know.
+         # Otherwise there is a '-' character in front of the submodule listing:
+diff --git a/git/remote.py b/git/remote.py
+index 25e076f3..28fd35a5 100644
+--- a/git/remote.py
++++ b/git/remote.py
+@@ -759,7 +759,7 @@ class Remote(LazyMixin, IterableObj):
+         """
+         scmd = "add"
+         kwargs["insert_kwargs_after"] = scmd
+-        url = Git.polish_url(url)
++        url = Git.polish_url(url, expand_vars=False)
+         if not allow_unsafe_protocols:
+             Git.check_unsafe_protocols(url)
+         repo.git.remote(scmd, "--", name, url, **kwargs)
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 734144dc31..fe809b2229 100644
@@ -31,6 +31,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-73625.patch \
             file://CVE-2026-73623.patch \
             file://CVE-2026-73624.patch \
+            file://CVE-2026-73622.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#11 lore raw

PATCH 11/27 python3-git: fix CVE-2026-73621

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1]

[1] https://github.com/gitpython-developers/GitPython/commit/38553b6fddc7f6a667cdb45a6762343a08fc72b2
[2] https://www.cve.org/CVERecord?id=CVE-2026-73621

---
 .../python/python3-git/CVE-2026-73621.patch   | 76 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 77 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73621.patch
meta/recipes-devtools/python/python3-git/CVE-2026-73621.patch new file +76 -0
new file mode 100644
index 0000000000..4f17cdc23c
@@ -0,0 +1,76 @@
+From f4029fab1d9f47bd31ccd8334f433249c430e0a4 Mon Sep 17 00:00:00 2001
+From: Sebastian Thiel <[email protected]>
+Date: Sat, 25 Jul 2026 06:27:01 +0200
+Subject: [PATCH 19/38] fix: reject unsafe output options in Commit.count
+
+<!-- agent -->
+
+Commit.count forwards keyword arguments to git rev-list but did not apply the
+unsafe-option validation used by the sibling revision APIs.
+
+Validate forwarded options with the existing Git.check_unsafe_options helper
+and retain the explicit allow_unsafe_options escape hatch. This covers
+GHSA-p538-c434-8v24 without adding another option parser.
+
+Git baseline: git.git a23bace963 defines --output as a shared diff option
+consumed by setup_revisions; t/t6000-rev-list-misc.sh exercises that option
+with rev-list.
+
+CVE: CVE-2026-73621
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/38553b6fddc7f6a667cdb45a6762343a08fc72b2]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit 38553b6fddc7f6a667cdb45a6762343a08fc72b2)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/objects/commit.py |   19 ++++++++++++++++---
+ 1 file changed, 16 insertions(+), 3 deletions(-)
+
+diff --git a/git/objects/commit.py b/git/objects/commit.py
+index ae60d286..ff852489 100644
+--- a/git/objects/commit.py
++++ b/git/objects/commit.py
+@@ -241,21 +241,34 @@ class Commit(base.Object, TraversableIterableObj, Diffable, Serializable):
+         else:
+             return self.message.split(b"\n", 1)[0]
+ 
+-    def count(self, paths: Union[PathLike, Sequence[PathLike]] = "", **kwargs: Any) -> int:
++    def count(
++        self,
++        paths: Union[PathLike, Sequence[PathLike]] = "",
++        allow_unsafe_options: bool = False,
++        **kwargs: Any,
++    ) -> int:
+         """Count the number of commits reachable from this commit.
+ 
+         :param paths:
+             An optional path or a list of paths restricting the return value
+             to commits actually containing the paths.
+ 
++        :param allow_unsafe_options:
++            Allow unsafe options, like ``--output``.
++
+         :param kwargs:
+             Additional options to be passed to git-rev-list. They must not alter
+             the output style of the command, or parsing will yield incorrect results.
+ 
+         :return: An int defining the number of reachable commits
+         """
+-        # Yes, it makes a difference whether empty paths are given or not in our case
+-        # as the empty paths version will ignore merge commits for some reason.
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs), unsafe_options=self.unsafe_git_rev_options
++            )
++
++        # Yes, it makes a difference whether empty paths are given or not in our case as
++        # the empty paths version will ignore merge commits for some reason.
+         if paths:
+             return len(self.repo.git.rev_list(self.hexsha, "--", paths, **kwargs).splitlines())
+         return len(self.repo.git.rev_list(self.hexsha, **kwargs).splitlines())
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index fe809b2229..5bbb20c842 100644
@@ -32,6 +32,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-73623.patch \
             file://CVE-2026-73624.patch \
             file://CVE-2026-73622.patch \
+            file://CVE-2026-73621.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#12 lore raw

PATCH 12/27 python3-git: fix CVE-2026-73620

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/3af0c2516c5e18c829da30338614688f6b69b49c
[2] https://www.cve.org/CVERecord?id=CVE-2026-73620

---
 .../python/python3-git/CVE-2026-73620.patch   | 130 ++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |   1 +
 2 files changed, 131 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73620.patch
meta/recipes-devtools/python/python3-git/CVE-2026-73620.patch new file +130 -0
new file mode 100644
index 0000000000..9b26f7bf0a
@@ -0,0 +1,130 @@
+From 5cb503e8d600c1946ed57e720dcee1a31dd5a65e Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <[email protected]>
+Date: Sun, 26 Jul 2026 05:54:27 +0200
+Subject: [PATCH 20/38] Block unsafe checkout-index and tag file options
+
+GHSA-3f7w-8rr8-f37f reports that caller-controlled options forwarded by
+IndexFile.checkout() and TagReference.create() can make Git write to or read
+from arbitrary filesystem paths.
+
+Add regression coverage proving the unsafe options are rejected by default while
+preserving the explicit allow_unsafe_options escape hatch. Reuse GitPython's
+existing option candidate normalization and unsafe-option guard at both public
+API boundaries.
+
+Git baseline: a23bace963d508bd96983cc637131392d3face18.
+Documentation/git-checkout-index.adoc defines --prefix as prepending an output
+path, and Documentation/git-tag.adoc defines -F/--file as reading a tag message
+from a file.
+
+CVE: CVE-2026-73620
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/3af0c2516c5e18c829da30338614688f6b69b49c]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Co-authored-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit 3af0c2516c5e18c829da30338614688f6b69b49c)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/index/base.py |   12 ++++++++++++
+ git/refs/tag.py   |   13 +++++++++++++
+ 2 files changed, 25 insertions(+)
+
+diff --git a/git/index/base.py b/git/index/base.py
+index c3d1771c..687b72da 100644
+--- a/git/index/base.py
++++ b/git/index/base.py
+@@ -141,6 +141,8 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+     before operating on it using the git command.
+     """
+ 
++    unsafe_git_checkout_index_options = ["--prefix"]
++
+     __slots__ = ("repo", "version", "entries", "_extension_data", "_file_path")
+ 
+     _VERSION = 2
+@@ -1156,6 +1158,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+         paths: Union[None, Iterable[PathLike]] = None,
+         force: bool = False,
+         fprogress: Callable = lambda *args: None,
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> Union[None, Iterator[PathLike], Sequence[PathLike]]:
+         """Check out the given paths or all files from the version known to the index
+@@ -1179,6 +1182,9 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             explicit paths are given. Otherwise progress information will be send
+             prior and after a file has been checked out.
+ 
++        :param allow_unsafe_options:
++            Allow unsafe options, such as ``--prefix``.
++
+         :param kwargs:
+             Additional arguments to be passed to git-checkout-index.
+ 
+@@ -1200,6 +1206,12 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             different to *head.checkout*, i.e. if you want git-checkout like behaviour,
+             use head.checkout instead of index.checkout.
+         """
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs),
++                unsafe_options=self.unsafe_git_checkout_index_options,
++            )
++
+         args = ["--index"]
+         if force:
+             args.append("--force")
+diff --git a/git/refs/tag.py b/git/refs/tag.py
+index a59a5133..640e9702 100644
+--- a/git/refs/tag.py
++++ b/git/refs/tag.py
+@@ -2,6 +2,7 @@
+ # 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
+ 
+ from .reference import Reference
++from git.cmd import Git
+ 
+ __all__ = ["TagReference", "Tag"]
+ 
+@@ -36,6 +37,8 @@ class TagReference(Reference):
+ 
+     __slots__ = ()
+ 
++    unsafe_git_tag_options = ["--file", "-F"]
++
+     _common_default = "tags"
+     _common_path_default = Reference._common_path_default + "/" + _common_default
+ 
+@@ -83,6 +86,7 @@ class TagReference(Reference):
+         reference: Union[str, "SymbolicReference"] = "HEAD",
+         logmsg: Union[str, None] = None,
+         force: bool = False,
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> "TagReference":
+         """Create a new tag reference.
+@@ -108,11 +112,20 @@ class TagReference(Reference):
+         :param force:
+             If True, force creation of a tag even though that tag already exists.
+ 
++        :param allow_unsafe_options:
++            Allow unsafe options, such as ``--file``.
++
+         :param kwargs:
+             Additional keyword arguments to be passed to git-tag.
+ 
+         :return: A new TagReference.
+         """
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs),
++                unsafe_options=cls.unsafe_git_tag_options,
++            )
++
+         if "ref" in kwargs and kwargs["ref"]:
+             reference = kwargs["ref"]
+ 
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 5bbb20c842..3f04fe8fdb 100644
@@ -33,6 +33,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-73624.patch \
             file://CVE-2026-73622.patch \
             file://CVE-2026-73621.patch \
+            file://CVE-2026-73620.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#13 lore raw

PATCH 13/27 python3-git: fix CVE-2026-73619

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/7a4f5dcb7bf3cbcbf6e438017efcdfe0bc0d36ca
[2] https://www.cve.org/CVERecord?id=CVE-2026-73619

---
 .../python/python3-git/CVE-2026-73619.patch   | 59 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 60 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-73619.patch
meta/recipes-devtools/python/python3-git/CVE-2026-73619.patch new file +59 -0
new file mode 100644
index 0000000000..9ef25fd959
@@ -0,0 +1,59 @@
+From 03c9b0fc2530fb81d15bf3f41f39da7e2308289c Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <[email protected]>
+Date: Sun, 26 Jul 2026 06:00:59 +0200
+Subject: [PATCH 21/38] Block unsafe archive additions and bundle URI
+
+GHSA-539m-9xh6-q6rr reports incomplete unsafe option lists for archive inputs
+and clone bundle URLs. Caller-controlled archive additions can expose or inject
+filesystem content, while clone --bundle-uri can dereference an additional
+caller-controlled URL.
+
+Extend the existing archive denylist with --add-file and --add-virtual-file,
+and the clone denylist with --bundle-uri. Regression coverage exercises archive
+kwargs plus both clone multi-option and keyword paths.
+
+Git baseline: a23bace963d508bd96983cc637131392d3face18.
+Documentation/git-archive.adoc defines --add-file/--add-virtual-file, and
+Documentation/git-clone.adoc defines --bundle-uri as fetching from the supplied
+URI.
+
+CVE: CVE-2026-73619
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/7a4f5dcb7bf3cbcbf6e438017efcdfe0bc0d36ca]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Co-authored-by: Sebastian Thiel <[email protected]>
+(cherry picked from commit 7a4f5dcb7bf3cbcbf6e438017efcdfe0bc0d36ca)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/repo/base.py |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/git/repo/base.py b/git/repo/base.py
+index 0d4fae8a..7142f220 100644
+--- a/git/repo/base.py
++++ b/git/repo/base.py
+@@ -142,6 +142,8 @@ class Repo:
+         "-c",
+         # Can install hooks that execute during clone:
+         "--template",
++        # Fetches from a caller-controlled URL:
++        "--bundle-uri",
+     ]
+     """Options to ``git clone`` that allow arbitrary commands to be executed.
+ 
+@@ -163,6 +165,10 @@ class Repo:
+         # Writes output to a caller-controlled filesystem path.
+         "--output",
+         "-o",
++        # Reads from a caller-controlled filesystem path:
++        "--add-file",
++        # Injects a caller-controlled path and contents:
++        "--add-virtual-file",
+     ]
+ 
+     unsafe_git_revision_options = [
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 3f04fe8fdb..c2fbc65db2 100644
@@ -34,6 +34,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-73622.patch \
             file://CVE-2026-73621.patch \
             file://CVE-2026-73620.patch \
+            file://CVE-2026-73619.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#14 lore raw

PATCH 14/27 python3-git: fix CVE-2026-76221

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/a495ccd3b547ccd60b2187215823b72a9c0188bf
[2] https://www.cve.org/CVERecord?id=CVE-2026-76221

---
 .../python/python3-git/CVE-2026-76221.patch   | 61 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76221.patch
meta/recipes-devtools/python/python3-git/CVE-2026-76221.patch new file +61 -0
new file mode 100644
index 0000000000..ef6e591e7d
@@ -0,0 +1,61 @@
+From 46f9c03ed10d25146293003791476955f8b26a73 Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Sun, 2 Aug 2026 08:57:12 +0000
+Subject: [PATCH 22/38] Reject syntax-bearing git config option names
+
+<!-- agent -->
+GHSA-jm78-9fvv-mhgr reports that config option names containing Git
+syntax can be serialized as unintended directives. A regression test showed
+that set, set_value, and add_value accepted delimiter, comment, bracket, and
+whitespace characters in option names.
+
+Restrict written option names to GitPython's established safe character set of
+letters, digits, hyphens, underscores, and dots. This blocks characters that
+can change config syntax while preserving option names historically supported
+by the writer and SectionConstraint.
+
+A broader audit confirmed that every public option-creating config API and
+SectionConstraint delegate reaches this validator; no separate config writer
+sink was found. The behavior was checked against Git cf5497b14, and the full
+config test module plus dotted-option regression pass.
+
+CVE: CVE-2026-76221
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/a495ccd3b547ccd60b2187215823b72a9c0188bf]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit a495ccd3b547ccd60b2187215823b72a9c0188bf)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/config.py |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/git/config.py b/git/config.py
+index 3015bb73..ff88bd18 100644
+--- a/git/config.py
++++ b/git/config.py
+@@ -74,6 +74,9 @@ See: https://git-scm.com/docs/git-config#_conditional_includes
+ UNSAFE_CONFIG_CHARS_RE = re.compile(r"[\r\n\x00]")
+ """Characters that cannot be safely written in config names or values."""
+ 
++VALID_CONFIG_OPTION_NAME_RE = re.compile(r"^[A-Za-z0-9_.-]+$")
++"""Pattern for option names that can be written without changing config syntax."""
++
+ 
+ class MetaParserBuilder(abc.ABCMeta):  # noqa: B024
+     """Utility class wrapping base-class methods into decorators that assure read-only properties."""
+@@ -854,6 +857,8 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
+     def _assure_config_name_safe(self, name: "cp._SectionName", label: str) -> None:
+         if isinstance(name, str) and UNSAFE_CONFIG_CHARS_RE.search(name):
+             raise ValueError("Git config %s names must not contain CR, LF, or NUL" % label)
++        if label == "option" and isinstance(name, str) and not VALID_CONFIG_OPTION_NAME_RE.fullmatch(name):
++            raise ValueError("Git config option names may contain only letters, digits, '-', '_', or '.'")
+         if label == "section" and isinstance(name, str):
+             in_quotes = False
+             escaped = False
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index c2fbc65db2..80cdc59f92 100644
@@ -35,6 +35,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-73621.patch \
             file://CVE-2026-73620.patch \
             file://CVE-2026-73619.patch \
+            file://CVE-2026-76221.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#15 lore raw

PATCH 15/27 python3-git: fix CVE-2026-76220

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/96a888f4d782cb2f80452148e48e60ce4af6d541
[2] https://www.cve.org/CVERecord?id=CVE-2026-76220

---
 .../python/python3-git/CVE-2026-76220.patch   | 66 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 67 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76220.patch
meta/recipes-devtools/python/python3-git/CVE-2026-76220.patch new file +66 -0
new file mode 100644
index 0000000000..cf88138008
@@ -0,0 +1,66 @@
+From a45e209e84248dbddbbbddae5c31d057ef00bfec Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Sun, 2 Aug 2026 08:59:57 +0000
+Subject: [PATCH 23/38] Check joined short-option values before Git execution
+
+<!-- agent -->
+GHSA-wvpp-8hx9-p66j reports that unsafe-option checks omitted the value
+joined to a one-character option when split_single_char_options was false. A
+regression test reproduced the mismatch: GitPython checked only -n even though
+it emitted a joined -nVALUE token that Git parses as clustered short options.
+
+Collect the exact joined token for unsplit one-character keyword arguments so
+the existing clustered-short-option validation sees every option character.
+The split form and long-option behavior remain unchanged.
+
+A broader audit confirmed that all guarded keyword-forwarding APIs use
+_option_candidates, including clone, ls-remote, fetch, pull, push, archive,
+revision, diff, checkout-index, and tag paths. Git cf5497b14 confirms repeated
+short-option parsing within a joined token. Focused candidate and unsafe-option
+tests pass.
+
+CVE: CVE-2026-76220
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/96a888f4d782cb2f80452148e48e60ce4af6d541]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit 96a888f4d782cb2f80452148e48e60ce4af6d541)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/cmd.py |   12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/git/cmd.py b/git/cmd.py
+index f907fa4e..b1aef9d3 100644
+--- a/git/cmd.py
++++ b/git/cmd.py
+@@ -638,13 +638,21 @@ class Git(LazyMixin):
+                 values = value if isinstance(value, (list, tuple)) else (value,)
+                 if any(value is True or (value is not False and value is not None) for value in values):
+                     key = str(key)
+-                    options.append(f"-{key}" if len(key) == 1 else f"--{dashify(key)}")
+-                    if len(key) == 1 and split_single_char_options:
++                    if len(key) != 1:
++                        options.append(f"--{dashify(key)}")
++                    elif split_single_char_options:
++                        options.append(f"-{key}")
+                         options.extend(
+                             str(value)
+                             for value in values
+                             if value is not True and value not in (False, None) and str(value).startswith("-")
+                         )
++                    else:
++                        options.extend(
++                            f"-{key}" if value is True else f"-{key}{value}"
++                            for value in values
++                            if value is True or (value is not False and value is not None)
++                        )
+         return options
+     class AutoInterrupt:
+         """Process wrapper that terminates the wrapped process on finalization.
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 80cdc59f92..37de657041 100644
@@ -36,6 +36,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-73620.patch \
             file://CVE-2026-73619.patch \
             file://CVE-2026-76221.patch \
+            file://CVE-2026-76220.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#16 lore raw

PATCH 16/27 python3-git: fix CVE-2026-76219

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/9b5dcaf85da5946dbf69dcd53f9edba08f760b32
[2] https://www.cve.org/CVERecord?id=CVE-2026-76219

---
 .../python/python3-git/CVE-2026-76219.patch   | 166 ++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |   1 +
 2 files changed, 167 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76219.patch
meta/recipes-devtools/python/python3-git/CVE-2026-76219.patch new file +166 -0
new file mode 100644
index 0000000000..0299aa026a
@@ -0,0 +1,166 @@
+From 5e0fc3555d6e9912ea9dc152252bf252fd428185 Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Sun, 2 Aug 2026 09:06:40 +0000
+Subject: [PATCH 24/38] Guard read-tree index output paths
+
+<!-- agent -->
+GHSA-4gmw-gg2m-w46p reports that caller-controlled treeish arguments could
+be parsed by git read-tree as --index-output and select an arbitrary output
+path. A regression test showed that from_tree reached Git instead of raising
+UnsafeOptionError; the same unchecked path was reachable through reset and
+both merge_tree treeish positions.
+
+Add the project-standard unsafe-option guard and explicit opt-out to
+from_tree, merge_tree, and reset. Check positional and keyword candidates so
+abbreviations and alternate forwarding forms are covered before read-tree
+runs.
+
+A broader audit found only two read-tree sinks in the codebase; both are now
+guarded, and reset delegates to the guarded from_tree path. The only remaining
+index-output use is GitPython's controlled temporary index. Git cf5497b14
+confirms read-tree parses this path-taking option before tree arguments.
+Focused index tests and Ruff checks pass.
+
+CVE: CVE-2026-76219
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/9b5dcaf85da5946dbf69dcd53f9edba08f760b32]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit 9b5dcaf85da5946dbf69dcd53f9edba08f760b32)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/index/base.py |   52 ++++++++++++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 44 insertions(+), 8 deletions(-)
+
+diff --git a/git/index/base.py b/git/index/base.py
+index 687b72da..2e11f38b 100644
+--- a/git/index/base.py
++++ b/git/index/base.py
+@@ -142,6 +142,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+     """
+ 
+     unsafe_git_checkout_index_options = ["--prefix"]
++    unsafe_git_read_tree_options = ["--index-output"]
+ 
+     __slots__ = ("repo", "version", "entries", "_extension_data", "_file_path")
+ 
+@@ -270,8 +271,13 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+ 
+     @post_clear_cache
+     @default_index
+-    def merge_tree(self, rhs: Treeish, base: Union[None, Treeish] = None) -> "IndexFile":
+-        """Merge the given rhs treeish into the current index, possibly taking
++    def merge_tree(
++        self,
++        rhs: Treeish,
++        base: Union[None, Treeish] = None,
++        allow_unsafe_options: bool = False,
++    ) -> "IndexFile":
++        """Merge the given `rhs` treeish into the current index, possibly taking
+         a common base treeish into account.
+ 
+         As opposed to the :func:`IndexFile.from_tree` method, this allows you to use an
+@@ -284,6 +290,9 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             Optional treeish reference pointing to the common base of 'rhs' and this
+             index which equals lhs.
+ 
++        :param allow_unsafe_options:
++            Allow options that may write to arbitrary paths.
++
+         :return:
+             self (containing the merge and possibly unmerged entries in case of
+             conflicts)
+@@ -294,6 +303,12 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             yourself, you have to commit the changed index (or make a valid tree from
+             it) and retry with a three-way index.from_tree call.
+         """
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([base, rhs]),
++                unsafe_options=self.unsafe_git_read_tree_options,
++            )
++
+         # -i : ignore working tree status
+         # --aggressive : handle more merge cases
+         # -m : do an actual merge
+@@ -337,8 +352,14 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+         return inst
+ 
+     @classmethod
+-    def from_tree(cls, repo: "Repo", *treeish: Treeish, **kwargs: Any) -> "IndexFile":
+-        """Merge the given treeish revisions into a new index which is returned.
++    def from_tree(
++        cls,
++        repo: "Repo",
++        *treeish: Treeish,
++        allow_unsafe_options: bool = False,
++        **kwargs: Any,
++    ) -> "IndexFile":
++        R"""Merge the given treeish revisions into a new index which is returned.
+         The original index will remain unaltered.
+ 
+         :param repo:
+@@ -358,6 +379,9 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+         :param kwargs:
+             Additional arguments passed to git-read-tree.
+ 
++        :param allow_unsafe_options:
++            Allow options that may write to arbitrary paths.
++
+         :return:
+             New IndexFile instance. It will point to a temporary index location which
+             does not exist anymore. If you intend to write such a merged Index, supply
+@@ -375,6 +399,12 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+         if len(treeish) == 0 or len(treeish) > 3:
+             raise ValueError("Please specify between 1 and 3 treeish, got %i" % len(treeish))
+ 
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates(treeish, kwargs),
++                unsafe_options=cls.unsafe_git_read_tree_options,
++            )
++
+         arg_list: List[Union[Treeish, str]] = []
+         # Ignore that the working tree and index possibly are out of date.
+         if len(treeish) > 1:
+@@ -1350,6 +1380,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+         working_tree: bool = False,
+         paths: Union[None, Iterable[PathLike]] = None,
+         head: bool = False,
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> "IndexFile":
+         """Reset the index to reflect the tree at the given commit. This will not
+@@ -1375,6 +1406,9 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             The paths need to exist at the commit, otherwise an exception will be
+             raised.
+ 
++        :param allow_unsafe_options:
++            Allow options that may write to arbitrary paths.
++
+         :param kwargs:
+             Additional keyword arguments passed to git-reset
+ 
+@@ -1383,10 +1417,12 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             check out the files according to their state in the index.
+             If you want git-reset like behaviour, use *HEAD.reset* instead.
+ 
+-        :return: self"""
+-        # What we actually want to do is to merge the tree into our existing
+-        # index, which is what git-read-tree does.
+-        new_inst = type(self).from_tree(self.repo, commit)
++        :return:
++            self
++        """
++        # What we actually want to do is to merge the tree into our existing index,
++        # which is what git-read-tree does.
++        new_inst = type(self).from_tree(self.repo, commit, allow_unsafe_options=allow_unsafe_options)
+         if not paths:
+             self.entries = new_inst.entries
+         else:
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 37de657041..a56970cc84 100644
@@ -37,6 +37,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-73619.patch \
             file://CVE-2026-76221.patch \
             file://CVE-2026-76220.patch \
+            file://CVE-2026-76219.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#17 lore raw

PATCH 17/27 python3-git: fix CVE-2026-76218

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/d9ddb55bdc66ffe8c9932fe460e6b8c8211e47c7
[2] https://www.cve.org/CVERecord?id=CVE-2026-76218

---
 .../python/python3-git/CVE-2026-76218.patch   | 91 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 92 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76218.patch
meta/recipes-devtools/python/python3-git/CVE-2026-76218.patch new file +91 -0
new file mode 100644
index 0000000000..a9de5abba2
@@ -0,0 +1,91 @@
+From 7c287bb0e4044b0f0fd8c6423a0b2a2cc05468e4 Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Tue, 4 Aug 2026 02:48:01 +0000
+Subject: [PATCH 25/38] Guard unsafe git init options
+
+<!-- agent -->
+GHSA-9rj7-rf2p-w77r reports that Repo.init forwarded git-init
+options without applying GitPython's unsafe-option policy. A regression
+showed template and abbreviated option spellings reached Git without an
+UnsafeOptionError and could create the destination before validation.
+
+Add a git-init denylist for template installation and separate Git
+directory redirection, check keyword options before any path or directory
+mutation, and provide the standard explicit allow_unsafe_options escape
+hatch. This preserves trusted uses while rejecting untrusted forwarding by
+default.
+
+An audit against Git cf5497b14c5a24f10c13f7e0ee85cb95af13ea6a
+(v2.55.0.windows.3-16-gcf5497b14c) confirmed that init and clone are the
+built-in commands that consume repository template directories. Clone,
+clone_from, and submodule cloning already share the guarded clone helper;
+the similarly named commit option only reads a commit-message template.
+
+Validated with the focused init regression, the clone/init unsafe-option
+suite, 185 config/Git/index/clone tests, Ruff, and basedpyright.
+
+CVE: CVE-2026-76218
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/d9ddb55bdc66ffe8c9932fe460e6b8c8211e47c7]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit d9ddb55bdc66ffe8c9932fe460e6b8c8211e47c7)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/repo/base.py |   18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/git/repo/base.py b/git/repo/base.py
+index 7142f220..772beb75 100644
+--- a/git/repo/base.py
++++ b/git/repo/base.py
+@@ -133,6 +133,14 @@ class Repo:
+     re_author_committer_start = re.compile(r"^(author|committer)")
+     re_tab_full_line = re.compile(r"^\t(.*)$")
+ 
++    unsafe_git_init_options = [
++        # Can install hooks that execute during later Git commands:
++        "--template",
++        # Redirects the repository metadata to a caller-controlled path:
++        "--separate-git-dir",
++    ]
++    """Options to :manpage:`git-init(1)` that permit unsafe code execution or I/O."""
++
+     unsafe_git_clone_options = [
+         # Executes arbitrary commands:
+         "--upload-pack",
+@@ -1256,6 +1264,7 @@ class Repo:
+         mkdir: bool = True,
+         odbt: Type[GitCmdObjectDB] = GitCmdObjectDB,
+         expand_vars: bool = True,
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> "Repo":
+         """Initialize a git repository at the given path if specified.
+@@ -1279,11 +1288,20 @@ class Repo:
+             can lead to information disclosure, allowing attackers to
+             access the contents of environment variables.
+ 
++        :param allow_unsafe_options:
++            Allow unsafe options to be used, such as ``--template`` and
++            ``--separate-git-dir``.
++
+         :param kwargs:
+             Keyword arguments serving as additional options to the git-init command.
+ 
+         :return: ``git.Repo`` (the newly created repo)
+         """
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs),
++                unsafe_options=cls.unsafe_git_init_options,
++            )
+         if path:
+             path = expand_path(path, expand_vars)
+         if mkdir and path and not osp.exists(path):
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index a56970cc84..883bd418b1 100644
@@ -38,6 +38,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-76221.patch \
             file://CVE-2026-76220.patch \
             file://CVE-2026-76219.patch \
+            file://CVE-2026-76218.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#18 lore raw

PATCH 18/27 python3-git: fix CVE-2026-76217

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/f2550b65bf60ca087190981e2c7b6865e201f40c
[2] https://www.cve.org/CVERecord?id=CVE-2026-76217

---
 .../python/python3-git/CVE-2026-76217.patch   | 173 ++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |   1 +
 2 files changed, 174 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76217.patch
meta/recipes-devtools/python/python3-git/CVE-2026-76217.patch new file +173 -0
new file mode 100644
index 0000000000..22331a51c2
@@ -0,0 +1,173 @@
+From 77915268777d0928ea156f00c95fa77c6f8294bb Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Tue, 4 Aug 2026 03:18:54 +0000
+Subject: [PATCH 26/38] Guard pathspec file inputs in high-level commands
+
+<!-- agent -->
+GHSA-hh9p-6wh2-4mfc reports that high-level rm and checkout wrappers
+forwarded pathspec file options without GitPython's unsafe-option policy.
+A regression showed that both commands surfaced multi-line pathspec data in
+Git errors, while reset consumed the same caller-selected file without a
+validation error. The audit also found that reset's positional commit could
+carry the option before its argument separator.
+
+Define one shared unsafe pathspec-file option list and apply it to
+IndexFile.remove, Head.checkout, and HEAD.reset before invoking Git. Check
+reset's positional commit as well as keyword options, retain the standard
+allow_unsafe_options escape hatch for trusted callers, and cover abbreviated
+long-option spellings.
+
+An audit against Git cf5497b14c5a24f10c13f7e0ee85cb95af13ea6a
+(v2.55.0.windows.3-16-gcf5497b14c) found pathspec-file support in add,
+checkout/restore, commit, reset, rm, and stash. GitPython has no arbitrary
+high-level option forwarding to the other commands, and git mv does not
+support this option.
+
+Validated with focused rejection and opt-in tests, 214 affected-module
+regressions, Ruff, basedpyright, and git diff --check.
+
+CVE: CVE-2026-76217
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/f2550b65bf60ca087190981e2c7b6865e201f40c]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit f2550b65bf60ca087190981e2c7b6865e201f40c)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/cmd.py        |    6 ++++++
+ git/index/base.py |   10 ++++++++++
+ git/refs/head.py  |   27 ++++++++++++++++++++++++++-
+ 3 files changed, 42 insertions(+), 1 deletion(-)
+
+diff --git a/git/cmd.py b/git/cmd.py
+index b1aef9d3..398c68ff 100644
+--- a/git/cmd.py
++++ b/git/cmd.py
+@@ -333,2 +333,8 @@
++    unsafe_git_pathspec_from_file_options = [
++        # Reads pathspecs from a caller-controlled file. Some commands include an
++        # unmatched pathspec in their error output, which can disclose the file.
++        "--pathspec-from-file",
++    ]
++
+     def __getstate__(self) -> Dict[str, Any]:
+         return slots_to_dict(self, exclude=self._excluded_)
+diff --git a/git/index/base.py b/git/index/base.py
+index 2e11f38b..a92ba82b 100644
+--- a/git/index/base.py
++++ b/git/index/base.py
+@@ -986,6 +986,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+         self,
+         items: Sequence[Union[PathLike, Blob, BaseIndexEntry, "Submodule"]],
+         working_tree: bool = False,
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> List[str]:
+         """Remove the given items from the index and optionally from
+@@ -1014,6 +1015,10 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             removing the respective file. This may fail if there are uncommitted changes
+             in it.
+ 
++        :param allow_unsafe_options:
++            Allow unsafe options such as ``--pathspec-from-file`` to be passed to
++            :manpage:`git-rm(1)`.
++
+         :param kwargs:
+             Additional keyword arguments to be passed to git-rm, such
+             as 'r' to allow recursive removal of
+@@ -1024,6 +1029,11 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+             This is interesting to know in case you have provided a directory or
+             globs. Paths are relative to the repository.
+         """
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs),
++                unsafe_options=Git.unsafe_git_pathspec_from_file_options,
++            )
+         args = []
+         if not working_tree:
+             args.append("--cached")
+diff --git a/git/refs/head.py b/git/refs/head.py
+index ebc71eb9..5900d3c6 100644
+--- a/git/refs/head.py
++++ b/git/refs/head.py
+@@ -17,6 +17,7 @@ from .reference import Reference
+ 
+ from typing import Any, Sequence, Union, TYPE_CHECKING
+ 
++from git.cmd import Git
+ from git.types import PathLike, Commit_ish
+ 
+ if TYPE_CHECKING:
+@@ -63,6 +64,7 @@ class HEAD(SymbolicReference):
+         index: bool = True,
+         working_tree: bool = False,
+         paths: Union[PathLike, Sequence[PathLike], None] = None,
++        allow_unsafe_options: bool = False,
+         **kwargs: Any,
+     ) -> "HEAD":
+         """Reset our HEAD to the given commit optionally synchronizing
+@@ -86,11 +88,20 @@ class HEAD(SymbolicReference):
+             Single path or list of paths relative to the git root directory
+             that are to be reset. This allows to partially reset individual files.
+ 
++        :param allow_unsafe_options:
++            Allow unsafe options such as ``--pathspec-from-file`` to be passed to
++            :manpage:`git-reset(1)`.
++
+         :param kwargs:
+             Additional arguments passed to git-reset.
+ 
+         :return: self
+         """
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([commit], kwargs),
++                unsafe_options=Git.unsafe_git_pathspec_from_file_options,
++            )
+         mode: Union[str, None]
+         mode = "--soft"
+         if index:
+@@ -230,7 +241,12 @@ class Head(Reference):
+         self.path = "%s/%s" % (self._common_path_default, new_path)
+         return self
+ 
+-    def checkout(self, force: bool = False, **kwargs: Any) -> Union["HEAD", "Head"]:
++    def checkout(
++        self,
++        force: bool = False,
++        allow_unsafe_options: bool = False,
++        **kwargs: Any,
++    ) -> Union["HEAD", "Head"]:
+         """Check out this head by setting the HEAD to this reference, by updating the
+         index to reflect the tree we point to and by updating the working tree to
+         reflect the latest index.
+@@ -242,6 +258,10 @@ class Head(Reference):
+             If False, :class:`~git.exc.GitCommandError` will be raised in that
+             situation.
+ 
++        :param allow_unsafe_options:
++            Allow unsafe options such as ``--pathspec-from-file`` to be passed to
++            :manpage:`git-checkout(1)`.
++
+         :param kwargs:
+             Additional keyword arguments to be passed to git checkout, e.g.
+             ``b="new_branch"`` to create a new branch at the given spot.
+@@ -257,6 +277,11 @@ class Head(Reference):
+             will leave the HEAD detached which is allowed and possible, but remains
+             a special state that some tools might not be able to handle.
+         """
++        if not allow_unsafe_options:
++            Git.check_unsafe_options(
++                options=Git._option_candidates([], kwargs),
++                unsafe_options=Git.unsafe_git_pathspec_from_file_options,
++            )
+         kwargs["f"] = force
+         if kwargs["f"] is False:
+             kwargs.pop("f")
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 883bd418b1..d634239cdb 100644
@@ -39,6 +39,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-76220.patch \
             file://CVE-2026-76219.patch \
             file://CVE-2026-76218.patch \
+            file://CVE-2026-76217.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#19 lore raw

PATCH 19/27 python3-git: fix CVE-2026-76222

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [4], using the commit shown in [1], regression fix in [2] and follow-up fix in [3].

[1] https://github.com/gitpython-developers/GitPython/commit/e4b8e7d026ca6abb4cf604f8e77093432ce23c06
[2] https://github.com/gitpython-developers/GitPython/commit/b324c831cbc02c82b99c18113b622d03539d23cd
[3] https://github.com/gitpython-developers/GitPython/commit/4299c990e1ca21896f9485277caf7bb0ae5b404c
[4] https://nvd.nist.gov/vuln/detail/CVE-2026-76222

---
 .../CVE-2026-76222-regression.patch           |  35 +++++
 .../python3-git/CVE-2026-76222_p1.patch       | 123 ++++++++++++++++++
 .../python3-git/CVE-2026-76222_p2.patch       |  49 +++++++
 .../python/python3-git_3.1.42.bb              |   3 +
 4 files changed, 210 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76222-regression.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76222_p1.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-76222_p2.patch
meta/recipes-devtools/python/python3-git/CVE-2026-76222-regression.patch new file +35 -0
new file mode 100644
index 0000000000..725403d1bb
@@ -0,0 +1,35 @@
+From a82b22c137622eb76112d5ec04e86b246e57eab3 Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Tue, 4 Aug 2026 11:07:02 +0200
+Subject: [PATCH] Initialize submodule repository before handled failures
+
+Direct recursive updates with keep_going could swallow an invalid-name
+validation error and then access mrepo before assignment. Initialize
+mrepo before validation so recursion is safely skipped.
+
+CVE: CVE-2026-76222
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/b324c831cbc02c82b99c18113b622d03539d23cd]
+
+Backport Changes:
+- Omitted `test/test_submodule.py` because the PyPI source archive omits
+  tests, which are outside this recipe's test surface.
+- Omitted `.basedpyright/baseline.json` because it is development-only
+  static-analysis metadata absent from the source archive.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit b324c831cbc02c82b99c18113b622d03539d23cd)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/objects/submodule/base.py | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
+index ec0a534f..45fc4551 100644
+--- a/git/objects/submodule/base.py
++++ b/git/objects/submodule/base.py
+@@ -640,3 +640 @@ class Submodule(IndexObject, TraversableIterableObj):
+-        # To keep things plausible in dry-run mode.
+-        if dry_run:
+-            mrepo = None
++        mrepo = None
meta/recipes-devtools/python/python3-git/CVE-2026-76222_p1.patch new file +123 -0

123 lines not on this page · raw message

meta/recipes-devtools/python/python3-git/CVE-2026-76222_p2.patch new file +49 -0

49 lines not on this page · raw message

meta/recipes-devtools/python/python3-git_3.1.42.bb +3 -0
index d634239cdb..4375809d3a 100644
@@ -40,6 +40,9 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-76219.patch \
             file://CVE-2026-76218.patch \
             file://CVE-2026-76217.patch \
+            file://CVE-2026-76222_p1.patch \
+            file://CVE-2026-76222-regression.patch \
+            file://CVE-2026-76222_p2.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#20 lore raw

PATCH 20/27 python3-git: fix CVE-2026-78678 CVE-2026-78679

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2] and [3], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/1b0d2d9b91575f7db44ef4ff58ac37fc9335e5f6
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-78678
[3] https://nvd.nist.gov/vuln/detail/cve-2026-78679

---
 .../CVE-2026-78678_CVE-2026-78679.patch       | 208 ++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |   1 +
 2 files changed, 209 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-78678_CVE-2026-78679.patch
meta/recipes-devtools/python/python3-git/CVE-2026-78678_CVE-2026-78679.patch new file +208 -0
new file mode 100644
index 0000000000..6277a9e509
@@ -0,0 +1,208 @@
+From 51216053bd6885b546be8e9ed2e8e1000e7ee5a3 Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Wed, 5 Aug 2026 04:48:36 +0200
+Subject: [PATCH] Block file-reading Git options
+
+<!-- agent -->
+Reject file-reading options passed to blame, diff, and tag APIs. Inspect
+positional values after resolving aliases, recognize unsafe options
+behind command-specific short-flag clusters, and retain the explicit
+allow_unsafe_options escape hatch. This closes GHSA-5xxx-qhh7-9287 and
+GHSA-3wxw-xv34-2frg and covers the adjacent diff order-file sink.
+
+Regression tests cover long, short, and clustered options, incremental blame,
+tag path/reference positionals, the ref keyword alias, both diff entry points,
+and preservation of diff pickaxe behavior.
+
+Git baseline: cf5497b14c; git-blame, git-diff, and git-tag document the relevant file-input options.
+
+CVE: CVE-2026-78678 CVE-2026-78679
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/1b0d2d9b91575f7db44ef4ff58ac37fc9335e5f6]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+(cherry picked from commit 1b0d2d9b91575f7db44ef4ff58ac37fc9335e5f6)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/cmd.py        |  8 +++++---
+ git/diff.py       |  7 ++++---
+ git/index/base.py |  3 ++-
+ git/repo/base.py  | 27 +++++++++++++++++++++------
+ git/refs/tag.py   | 10 ++++++----
+ 5 files changed, 39 insertions(+), 16 deletions(-)
+
+diff --git a/git/cmd.py b/git/cmd.py
+index 1b1da383..a91f8a0f 100644
+--- a/git/cmd.py
++++ b/git/cmd.py
+@@ -571,7 +571,9 @@ class Git(LazyMixin):
+         return dashify(option_tokens[0])
+ 
+     @classmethod
+-    def check_unsafe_options(cls, options: List[str], unsafe_options: List[str]) -> None:
++    def check_unsafe_options(
++        cls, options: List[str], unsafe_options: List[str], clusterable_short_options: str = "46flnqsv"
++    ) -> None:
+         """Raise :class:`~git.exc.UnsafeOptionError` for blocked option spellings.
+ 
+         In addition to exact matches, this rejects abbreviated long options accepted
+@@ -606,7 +608,7 @@ class Git(LazyMixin):
+         # These value-less Git flags can be clustered before another short option
+         # (for example, ``-fuVALUE``). Stop at any other character because it may
+         # begin an attached value, as ``o`` does in the safe option ``-oupstream``.
+-        clusterable_short_options = frozenset("46flnqsv")
++        clusterable_short_options_set = frozenset(clusterable_short_options)
+         options_are_kwargs = all(not option.startswith("-") for option in options)
+         for option in options:
+             candidate = cls._canonicalize_option_name(option)
+@@ -623,7 +625,7 @@ class Git(LazyMixin):
+                         raise UnsafeOptionError(
+                             f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it."
+                         )
+-                    if option_char not in clusterable_short_options:
++                    if option_char not in clusterable_short_options_set:
+                         break
+             if not (option.startswith("--") or (options_are_kwargs and len(candidate) > 1)):
+                 continue
+diff --git a/git/diff.py b/git/diff.py
+index 37ff2624..84e7687b 100644
+--- a/git/diff.py
++++ b/git/diff.py
+@@ -136,8 +136,8 @@ class Diffable:
+             to be read and diffed.
+ 
+         :param allow_unsafe_options:
+-            If ``True``, allow options such as ``--output`` that can write to arbitrary
+-            filesystem paths.
++            If ``True``, allow options such as ``--output`` and ``-O`` that can write to
++            or read from arbitrary filesystem paths.
+ 
+         :param kwargs:
+             Additional arguments passed to git-diff, such as ``R=True`` to swap both
+@@ -153,7 +153,8 @@ class Diffable:
+         if not allow_unsafe_options:
+             Git.check_unsafe_options(
+                 options=Git._option_candidates([other], kwargs),
+-                unsafe_options=self.repo.unsafe_git_revision_options,
++                unsafe_options=self.repo.unsafe_git_diff_options,
++                clusterable_short_options="46abceflmnpqrstuvwzBCDMNRW",
+             )
+ 
+         args: List[Union[PathLike, Diffable]] = []
+diff --git a/git/index/base.py b/git/index/base.py
+index a92ba82b..520c703c 100644
+--- a/git/index/base.py
++++ b/git/index/base.py
+@@ -1485,7 +1485,8 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
+         if not allow_unsafe_options:
+             Git.check_unsafe_options(
+                 options=Git._option_candidates([other], kwargs),
+-                unsafe_options=self.repo.unsafe_git_revision_options,
++                unsafe_options=self.repo.unsafe_git_diff_options,
++                clusterable_short_options="46abceflmnpqrstuvwzBCDMNRW",
+             )
+ 
+         # Only run if we are the default repository index.
+diff --git a/git/repo/base.py b/git/repo/base.py
+index 9011b0a4..ebad63b8 100644
+--- a/git/repo/base.py
++++ b/git/repo/base.py
+@@ -187,6 +187,19 @@ class Repo:
+         "-o",
+     ]
+ 
++    unsafe_git_blame_options = unsafe_git_revision_options + [
++        # These options read arbitrary files and expose their contents through blame output.
++        "--contents",
++        "-S",
++        "--ignore-revs-file",
++    ]
++
++    unsafe_git_diff_options = unsafe_git_revision_options + [
++        # Reads caller-controlled order patterns from an arbitrary file.
++        "-O",
++        "--orderfile",
++    ]
++
+     # Invariants
+     config_level: ConfigLevels_Tup = ("system", "user", "global", "repository")
+     """Represents the configuration level of a configuration file."""
+@@ -755,7 +768,8 @@ class Repo:
+ 
+         if not allow_unsafe_options:
+             Git.check_unsafe_options(
+-                options=Git._option_candidates([rev], kwargs), unsafe_options=self.unsafe_git_revision_options
++                options=Git._option_candidates([rev], kwargs),
++                unsafe_options=self.unsafe_git_revision_options
+             )
+ 
+         return Commit.iter_items(
+@@ -1019,7 +1033,7 @@ class Repo:
+         :param rev: Revision specifier, see git-rev-parse for viable options.
+ 
+         :param allow_unsafe_options:
+-            Allow unsafe options in revision argument, like ``--output``.
++            Allow unsafe options in revision argument, like ``--output`` or ``--contents``.
+ 
+         :return:
+             Lazy iterator of :class:`BlameEntry` tuples, where the commit indicates the
+@@ -1031,7 +1045,9 @@ class Repo:
+         """
+         if not allow_unsafe_options:
+             Git.check_unsafe_options(
+-                options=Git._option_candidates([rev], kwargs), unsafe_options=self.unsafe_git_revision_options
++                options=Git._option_candidates([rev], kwargs),
++                unsafe_options=self.unsafe_git_blame_options,
++                clusterable_short_options="46bceflnpqstvw",
+             )
+ 
+         data: bytes = self.git.blame(rev, "--", file, p=True, incremental=True, stdout_as_string=False, **kwargs)
+@@ -1118,7 +1134,7 @@ class Repo:
+         :param rev: Revision specifier, see git-rev-parse for viable options.
+ 
+         :param allow_unsafe_options:
+-            Allow unsafe options in revision argument, like ``--output``.
++            Allow unsafe options in revision argument, like ``--output`` or ``--contents``.
+ 
+         :return:
+             list: [git.Commit, list: [<line>]]
+@@ -1133,7 +1149,8 @@ class Repo:
+         if not allow_unsafe_options:
+             Git.check_unsafe_options(
+                 options=Git._option_candidates([rev, rev_opts_list], kwargs),
+-                unsafe_options=self.unsafe_git_revision_options,
++                unsafe_options=self.unsafe_git_blame_options,
++                clusterable_short_options="46bceflnpqstvw",
+             )
+         data: bytes = self.git.blame(rev, *rev_opts_list, "--", file, p=True, stdout_as_string=False, **kwargs)
+         commits: Dict[str, Commit] = {}
+diff --git a/git/refs/tag.py b/git/refs/tag.py
+index 640e9702..15da4c6d 100644
+--- a/git/refs/tag.py
++++ b/git/refs/tag.py
+@@ -120,15 +120,17 @@ class TagReference(Reference):
+ 
+         :return: A new TagReference.
+         """
++        legacy_ref = kwargs.pop("ref", None)
++        if legacy_ref:
++            reference = legacy_ref
++
+         if not allow_unsafe_options:
+             Git.check_unsafe_options(
+-                options=Git._option_candidates([], kwargs),
++                options=Git._option_candidates([path, reference], kwargs),
+                 unsafe_options=cls.unsafe_git_tag_options,
++                clusterable_short_options="46adefilnqsv",
+             )
+ 
+-        if "ref" in kwargs and kwargs["ref"]:
+-            reference = kwargs["ref"]
+-
+         if "message" in kwargs and kwargs["message"]:
+             kwargs["m"] = kwargs["message"]
+             del kwargs["message"]
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 4375809d3a..a77fddda5b 100644
@@ -43,6 +43,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-76222_p1.patch \
             file://CVE-2026-76222-regression.patch \
             file://CVE-2026-76222_p2.patch \
+            file://CVE-2026-78678_CVE-2026-78679.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#21 lore raw

PATCH 21/27 python3-git: fix CVE-2026-78677

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/b68afff45af0f49e79a3e2d2162018986b37ad5d
[2] https://www.cve.org/CVERecord?id=CVE-2026-78677

---
 .../python/python3-git/CVE-2026-78677.patch   | 87 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 88 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-78677.patch
meta/recipes-devtools/python/python3-git/CVE-2026-78677.patch new file +87 -0
new file mode 100644
index 0000000000..23e0fc931a
@@ -0,0 +1,87 @@
+From 2e39328f9df501adf6656ced51bda466dd164bfe Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Mon, 10 Aug 2026 11:20:03 +0200
+Subject: [PATCH 29/38] Block separate git directories during clone
+
+<!-- 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.
+
+CVE: CVE-2026-78677
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/b68afff45af0f49e79a3e2d2162018986b37ad5d]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit b68afff45af0f49e79a3e2d2162018986b37ad5d)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/objects/submodule/base.py |   10 ++++++++++
+ git/repo/base.py              |    4 +++-
+ 2 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
+index 09a784e1..4f2315fa 100644
+--- a/git/objects/submodule/base.py
++++ b/git/objects/submodule/base.py
+@@ -7,6 +7,7 @@ import logging
+ import ntpath
+ import os
+ import os.path as osp
++import shlex
+ import stat
+ import uuid
+ 
+@@ -312,6 +313,15 @@ class Submodule(IndexObject, TraversableIterableObj):
+         module_abspath = cls._module_abspath(repo, path, name)
+         module_checkout_path = module_abspath
+         if cls._need_gitfile_submodules(repo.git):
++            if not allow_unsafe_options:
++                Git.check_unsafe_options(Git._option_candidates([], kwargs), repo.unsafe_git_clone_options)
++                multi_options = kwargs.get("multi_options")
++                if multi_options:
++                    Git.check_unsafe_options(
++                        shlex.split(" ".join(cast("Sequence[str]", multi_options))),
++                        repo.unsafe_git_clone_options,
++                    )
++            allow_unsafe_options = True
+             kwargs["separate_git_dir"] = module_abspath
+             module_abspath_dir = osp.dirname(module_abspath)
+             if not osp.isdir(module_abspath_dir):
+diff --git a/git/repo/base.py b/git/repo/base.py
+index 772beb75..9011b0a4 100644
+--- a/git/repo/base.py
++++ b/git/repo/base.py
+@@ -150,7 +150,9 @@ class Repo:
+         "-c",
+         # Can install hooks that execute during clone:
+         "--template",
+-        # Fetches from a caller-controlled URL:
++        # Redirects the repository metadata to a caller-controlled path:
++        "--separate-git-dir",
++        # Fetches from an additional caller-controlled URI:
+         "--bundle-uri",
+     ]
+     """Options to ``git clone`` that allow arbitrary commands to be executed.
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index a77fddda5b..56d55b14c4 100644
@@ -44,6 +44,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-76222-regression.patch \
             file://CVE-2026-76222_p2.patch \
             file://CVE-2026-78678_CVE-2026-78679.patch \
+            file://CVE-2026-78677.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#22 lore raw

PATCH 22/27 python3-git: fix CVE-2026-78676

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/4b4e47fc1224e23b0c8ee7220a7192818f2e4abb
[2] https://www.cve.org/CVERecord?id=CVE-2026-78676

---
 .../python/python3-git/CVE-2026-78676.patch   | 55 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 56 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-78676.patch
meta/recipes-devtools/python/python3-git/CVE-2026-78676.patch new file +55 -0
new file mode 100644
index 0000000000..7547158173
@@ -0,0 +1,55 @@
+From 414dab405a73c62e70306afc79de3529a1f2a4d0 Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Mon, 10 Aug 2026 12:22:31 +0200
+Subject: [PATCH 30/38] fix: preserve multiline config values when writing
+
+<!-- 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.
+
+CVE: CVE-2026-78676
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/4b4e47fc1224e23b0c8ee7220a7192818f2e4abb]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit 4b4e47fc1224e23b0c8ee7220a7192818f2e4abb)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/config.py |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/git/config.py b/git/config.py
+index ff88bd18..cc7091dd 100644
+--- a/git/config.py
++++ b/git/config.py
+@@ -665,7 +665,11 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
+                     continue
+ 
+                 for v in values:
+-                    fp.write(("\t%s = %s\n" % (key, self._value_to_string(v).replace("\n", "\n\t"))).encode(defenc))
++                    value = self._value_to_string(v)
++                    if any(char in value for char in '\n\t\b\\"'):
++                        value = value.replace("\\", "\\\\").replace('"', '\\"')
++                        value = '"%s\\\n"' % value.replace("\n", "\\n").replace("\t", "\\t").replace("\b", "\\b")
++                    fp.write(("\t%s = %s\n" % (key, value)).encode(defenc))
+                 # END if key is not __name__
+ 
+         # END section writing
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 56d55b14c4..813dd5a3f3 100644
@@ -45,6 +45,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-76222_p2.patch \
             file://CVE-2026-78678_CVE-2026-78679.patch \
             file://CVE-2026-78677.patch \
+            file://CVE-2026-78676.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#23 lore raw

PATCH 23/27 python3-git: fix CVE-2026-78675

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/ef7568e3b317ce617eacda39b8b54dcdff8c3b5c
[2] https://www.cve.org/CVERecord?id=CVE-2026-78675

---
 .../python/python3-git/CVE-2026-78675.patch   | 49 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-78675.patch
meta/recipes-devtools/python/python3-git/CVE-2026-78675.patch new file +49 -0
new file mode 100644
index 0000000000..89616c8575
@@ -0,0 +1,49 @@
+From f65d897b463910ef494e480fc28d9fb8c856dfa1 Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Mon, 10 Aug 2026 12:32:24 +0200
+Subject: [PATCH 31/38] fix: ignore includes in submodule configuration
+
+<!-- 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 41ecc6a4 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.
+
+CVE: CVE-2026-78675
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/ef7568e3b317ce617eacda39b8b54dcdff8c3b5c]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit ef7568e3b317ce617eacda39b8b54dcdff8c3b5c)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/objects/submodule/base.py |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
+index 4f2315fa..b0c660fb 100644
+--- a/git/objects/submodule/base.py
++++ b/git/objects/submodule/base.py
+@@ -239,7 +239,7 @@ class Submodule(IndexObject, TraversableIterableObj):
+             raise ValueError("Cannot write blobs of 'historical' submodule configurations")
+         # END handle writes of historical submodules
+ 
+-        return SubmoduleConfigParser(fp_module, read_only=read_only)
++        return SubmoduleConfigParser(fp_module, read_only=read_only, merge_includes=False)
+ 
+     def _clear_cache(self) -> None:
+         """Clear the possibly changed values."""
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 813dd5a3f3..54bc423fa6 100644
@@ -46,6 +46,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-78678_CVE-2026-78679.patch \
             file://CVE-2026-78677.patch \
             file://CVE-2026-78676.patch \
+            file://CVE-2026-78675.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#24 lore raw

PATCH 24/27 python3-git: fix CVE-2026-87817

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/c7cf4d13b1ed0a2e70f2a1f3c6b4fc6c2652cf0b
[2] https://www.cve.org/CVERecord?id=CVE-2026-87817

---
 .../python/python3-git/CVE-2026-87817.patch   | 430 ++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |   1 +
 2 files changed, 431 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-87817.patch
meta/recipes-devtools/python/python3-git/CVE-2026-87817.patch new file +430 -0
new file mode 100644
index 0000000000..c69c906144
@@ -0,0 +1,430 @@
+From e1997b93556ee52ddb4ddfa2da174e8fdb4609cb Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Tue, 25 Aug 2026 04:57:29 +0200
+Subject: [PATCH 35/38] fix: prefer `.git` during repository discovery
+
+<!-- agent -->
+GitPython considered worktree administration and bare-repository signatures
+before a worktree's real .git entry. Align discovery with Git so .git files
+and directories win, malformed .git files stop discovery, and candidate git
+directories validate HEAD plus commondir-backed object and ref storage. This
+addresses GHSA-239g-whfq-7xj9.
+
+Regression coverage compares ambiguous layouts with git rev-parse and rejects
+invalid HEAD/.git metadata.
+
+Git baseline: 15c6308cf7ad276b306aa5b3ababfbdebfb1a917; setup.c
+setup_git_directory_gently_1(), is_git_directory(), and validate_headref().
+
+Repository validation can use GIT_COMMON_DIR for refs and objects. Preserve the
+same value on Repo so later config, ref, and object access uses the directory
+that made discovery succeed.
+
+Capture GIT_COMMON_DIR before the first repository config read so bare-state
+detection uses the same metadata location as discovery. Resolve relative
+environment values immediately so later working-directory changes cannot
+retarget the Repo.
+
+Review feedback: relative GIT_COMMON_DIR left Git subprocesses resolving GIT_DIR
+and GIT_COMMON_DIR from a different working directory; malformed commondir data,
+empty GIT_OBJECT_DIRECTORY, and the linked-worktree signature were also handled
+inconsistently.
+
+Pin the repository environment to resolved paths, reject invalid
+metadata without consulting the process working directory, and
+restore HEAD-based linked-worktree detection. Keep the loose HEAD
+and dangling .git behavior because both match Git setup.c at baseline
+15c6308cf7ad276b306aa5b3ababfbdebfb1a917.
+
+Review feedback identified that chained or self-referential .git pointers
+recurse, filesystem-encoded metadata can fail text decoding, and a relative
+GIT_DIR is not retained for later Git commands.
+
+Parse one regular, size-bounded Gitfile exactly once, decode Gitfile and
+commondir paths with the filesystem codec, and retain the resolved GIT_DIR
+for subprocesses. This rejects cycles like Git instead of recursing and keeps
+commands stable after working-directory changes.
+
+Review feedback noted that a dangling commondir symlink was treated as absent,
+allowing local objects and refs to validate the repository.
+
+Distinguish a truly missing commondir from a dangling symlink. This follows
+Git's get_common_dir_noenv(), whose file_exists check uses lstat before
+attempting to read the entry.
+
+Python 3.9 on Windows raised UnicodeDecodeError while the repository-discovery
+regression test parsed invalid commondir bytes, causing the Python package test
+(windows, 3.9) check to fail.
+
+Treat UnicodeError like an unreadable metadata file in both commondir and
+gitfile parsing. Invalid bytes now make discovery reject the candidate
+repository, matching Git's behavior.
+
+Review feedback noted that GIT_OBJECT_DIRECTORY made discovery succeed without
+becoming the Repo ODB root, while a relative value could later be resolved from
+the Git wrapper's different working directory.
+
+Resolve the environment value against the construction directory, use it as the
+ODB root, and preserve the absolute value for later Git commands. The regression
+moves the only object store outside the git directory and verifies access
+through both GitDB and git cat-file after the original environment and current
+directory are restored.
+
+Review feedback identified four setup mismatches: non-missing .git stat failures
+could fall through to another repository, explicit GIT_DIR could be redirected
+through a nested .git entry, Gitfile reads were not bounded to the stat-reported
+size, and alternates ignored GIT_OBJECT_DIRECTORY.
+
+Match Git setup.c by bypassing discovery for an environment-selected GIT_DIR,
+stopping discovery when Gitfile stat fails for reasons other than a missing
+path, and reading exactly the previously observed Gitfile size. Resolve
+alternates below the active ODB root so custom object stores remain internally
+consistent.
+
+The commit review noted that treating every present GIT_DIR as explicit broke
+two documented cases: an empty GIT_DIR must fall back to current-directory
+discovery, while an empty Repo path must still use a nonempty GIT_DIR.
+
+CVE: CVE-2026-87817
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/c7cf4d13b1ed0a2e70f2a1f3c6b4fc6c2652cf0b]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+- Transport the discovery checks into the 3.1.42 Repo constructor/helper 
+  layout. Omit upstream release-note changes.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit c7cf4d13b1ed0a2e70f2a1f3c6b4fc6c2652cf0b)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/repo/base.py |  101 +++++++++++++++++++++++++++++++---------------
+ git/repo/fun.py  |  119 ++++++++++++++++++++++++++++++++++--------------------
+ 2 files changed, 144 insertions(+), 76 deletions(-)
+
+diff --git a/git/repo/base.py b/git/repo/base.py
+index ebad63b8..c8e8f6ed 100644
+--- a/git/repo/base.py
++++ b/git/repo/base.py
+@@ -218,6 +218,10 @@ class Repo:
+     ) -> None:
+         """Create a new Repo instance.
+ 
++        .. note::
++            Repositories using reftable may be opened, but GitPython's direct reference
++            access does not support reftable.
++
+         :param path:
+             The path to either the root git directory or the bare git repo::
+ 
+@@ -248,7 +252,11 @@ class Repo:
+         :return: git.Repo
+         """
+ 
+-        epath = path or os.getenv("GIT_DIR")
++        git_dir_env = os.getenv("GIT_DIR")
++        object_dir_env = os.getenv("GIT_OBJECT_DIRECTORY")
++        if object_dir_env is not None:
++            object_dir_env = osp.abspath(object_dir_env)
++        epath = path or git_dir_env
+         if not epath:
+             epath = os.getcwd()
+         if Git.is_cygwin():
+@@ -271,17 +279,49 @@ class Repo:
+             if not os.path.exists(epath):
+                 raise NoSuchPathError(epath)
+ 
+-        ## Walk up the path to find the `.git` dir.
+-        #
+-        curpath = epath
+-        git_dir = None
++        # Walk up the path to find the `.git` dir.
++        curpath = os.fspath(epath) if epath is not None else ""
++        git_dir: Optional[str] = None
++        explicit_git_dir = not path and bool(git_dir_env)
+         while curpath:
+             # ABOUT osp.NORMPATH
+-            # It's important to normalize the paths, as submodules will otherwise initialize their
+-            # repo instances with paths that depend on path-portions that will not exist after being
+-            # removed. It's just cleaner.
++            # It's important to normalize the paths, as submodules will otherwise
++            # initialize their repo instances with paths that depend on path-portions
++            # that will not exist after being removed. It's just cleaner.
++            if not explicit_git_dir:
++                dotgit = osp.join(curpath, ".git")
++                try:
++                    sm_gitpath = find_submodule_git_dir(dotgit)
++                except OSError:
++                    break
++                if sm_gitpath is not None:
++                    # Worktrees can use relative paths as of Git 2.48, so join to curpath.
++                    git_dir = osp.normpath(osp.join(curpath, os.fspath(sm_gitpath)))
++                    self._working_tree_dir = curpath
++                    break
++
++                # Like Git, do not fall back to a bare repository or parent directory when
++                # a non-directory .git entry exists but is not a valid gitfile.
++                if osp.exists(dotgit) and not osp.isdir(dotgit):
++                    break
++
+             if is_git_dir(curpath):
+                 git_dir = curpath
++                if osp.isfile(osp.join(curpath, "gitdir")) and osp.isfile(osp.join(curpath, "commondir")):
++                    if "GIT_WORK_TREE" in os.environ:
++                        self._working_tree_dir = os.getenv("GIT_WORK_TREE")
++                    else:
++                        # Linked worktree administrative directories store the path to
++                        # the worktree's .git file in gitdir (without a "gitdir: " prefix).
++                        with open(osp.join(git_dir, "gitdir")) as fp:
++                            worktree_gitfile = fp.read().strip()
++
++                        if not osp.isabs(worktree_gitfile):
++                            worktree_gitfile = osp.normpath(osp.join(git_dir, worktree_gitfile))
++
++                        self._working_tree_dir = osp.dirname(worktree_gitfile)
++                    break
++
+                 # from man git-config : core.worktree
+                 # Set the path to the root of the working tree. If GIT_COMMON_DIR environment
+                 # variable is set, core.worktree is ignored and not used for determining the
+@@ -299,21 +339,7 @@ class Repo:
+                     self._working_tree_dir = os.getenv("GIT_WORK_TREE")
+                 break
+ 
+-            dotgit = osp.join(curpath, ".git")
+-            sm_gitpath = find_submodule_git_dir(dotgit)
+-            if sm_gitpath is not None:
+-                git_dir = osp.normpath(sm_gitpath)
+-
+-            sm_gitpath = find_submodule_git_dir(dotgit)
+-            if sm_gitpath is None:
+-                sm_gitpath = find_worktree_git_dir(dotgit)
+-
+-            if sm_gitpath is not None:
+-                git_dir = expand_path(sm_gitpath, expand_vars)
+-                self._working_tree_dir = curpath
+-                break
+-
+-            if not search_parent_directories:
++            if explicit_git_dir or not search_parent_directories:
+                 break
+             curpath, tail = osp.split(curpath)
+             if not tail:
+@@ -324,6 +350,16 @@ class Repo:
+             raise InvalidGitRepositoryError(epath)
+         self.git_dir = git_dir
+ 
++        common_dir_env = os.getenv("GIT_COMMON_DIR")
++        if common_dir_env is not None:
++            self._common_dir = osp.abspath(common_dir_env)
++        else:
++            try:
++                common_dir = os.fsdecode((Path(self.git_dir) / "commondir").read_bytes()).rstrip("\r\n")
++                self._common_dir = osp.join(self.git_dir, common_dir)
++            except OSError:
++                self._common_dir = ""
++
+         self._bare = False
+         try:
+             self._bare = self.config_reader("repository").getboolean("core", "bare")
+@@ -331,12 +367,6 @@ class Repo:
+             # Let's not assume the option exists, although it should.
+             pass
+ 
+-        try:
+-            common_dir = (Path(self.git_dir) / "commondir").read_text().splitlines()[0].strip()
+-            self._common_dir = osp.join(self.git_dir, common_dir)
+-        except OSError:
+-            self._common_dir = ""
+-
+         # Adjust the working directory in case we are actually bare - we didn't know
+         # that in the first place.
+         if self._bare:
+@@ -345,9 +375,15 @@ class Repo:
+ 
+         self.working_dir: PathLike = self._working_tree_dir or self.common_dir
+         self.git = self.GitCommandWrapperType(self.working_dir)
++        if common_dir_env is not None:
++            self.git.update_environment(GIT_DIR=os.fspath(self.git_dir), GIT_COMMON_DIR=os.fspath(self.common_dir))
++        elif git_dir_env is not None:
++            self.git.update_environment(GIT_DIR=os.fspath(self.git_dir))
++        if object_dir_env is not None:
++            self.git.update_environment(GIT_OBJECT_DIRECTORY=object_dir_env)
+ 
+         # Special handling, in special times.
+-        rootpath = osp.join(self.common_dir, "objects")
++        rootpath = object_dir_env if object_dir_env is not None else osp.join(self.common_dir, "objects")
+         if issubclass(odbt, GitCmdObjectDB):
+             self.odb = odbt(rootpath, self.git)
+         else:
+@@ -876,8 +912,7 @@ class Repo:
+ 
+         :return: List of strings being pathnames of alternates
+         """
+-        if self.git_dir:
+-            alternates_path = osp.join(self.git_dir, "objects", "info", "alternates")
++        alternates_path = osp.join(self.odb.root_path(), "info", "alternates")
+ 
+         if osp.exists(alternates_path):
+             with open(alternates_path, "rb") as f:
+@@ -898,7 +933,7 @@ class Repo:
+             The method does not check for the existence of the paths in alts
+             as the caller is responsible.
+         """
+-        alternates_path = osp.join(self.common_dir, "objects", "info", "alternates")
++        alternates_path = osp.join(self.odb.root_path(), "info", "alternates")
+         if not alts:
+             if osp.isfile(alternates_path):
+                 os.remove(alternates_path)
+diff --git a/git/repo/fun.py b/git/repo/fun.py
+index 63bcfdfc..663b6ee1 100644
+--- a/git/repo/fun.py
++++ b/git/repo/fun.py
+@@ -60,21 +60,61 @@ def is_git_dir(d: "PathLike") -> bool:
+     """This is taken from the git setup.c:is_git_directory
+     function.
+ 
+-    @throws WorkTreeRepositoryUnsupported if it sees a worktree directory. It's quite hacky to do that here,
+-            but at least clearly indicates that we don't support it.
+-            There is the unlikely danger to throw if we see directories which just look like a worktree dir,
+-            but are none."""
++    .. note::
++        This function recognizes repositories using reftable through their
++        compatibility files, but GitPython's direct reference access does not support
++        reftable.
++
++    :raise git.exc.WorkTreeRepositoryUnsupported:
++        If it sees a worktree directory. It's quite hacky to do that here, but at least
++        clearly indicates that we don't support it. There is the unlikely danger to
++        throw if we see directories which just look like a worktree dir, but are none.
++    """
+     if osp.isdir(d):
+-        if (osp.isdir(osp.join(d, "objects")) or "GIT_OBJECT_DIRECTORY" in os.environ) and osp.isdir(
+-            osp.join(d, "refs")
+-        ):
+-            headref = osp.join(d, "HEAD")
+-            return osp.isfile(headref) or (osp.islink(headref) and os.readlink(headref).startswith("refs"))
+-        elif (
+-            osp.isfile(osp.join(d, "gitdir"))
+-            and osp.isfile(osp.join(d, "commondir"))
+-            and osp.isfile(osp.join(d, "gitfile"))
+-        ):
++        headref = osp.join(d, "HEAD")
++        if osp.islink(headref):
++            try:
++                valid_head = os.readlink(headref).startswith("refs/")
++            except OSError:
++                valid_head = False
++        else:
++            try:
++                with open(headref, "rb") as fp:
++                    head = fp.read(256)
++            except OSError:
++                valid_head = False
++            else:
++                valid_head = (head.startswith(b"ref:") and head[4:].lstrip().startswith(b"refs/")) or bool(
++                    re.match(rb"(?:[0-9A-Fa-f]{64}|[0-9A-Fa-f]{40})", head)
++                )
++
++        common_dir = os.getenv("GIT_COMMON_DIR")
++        if common_dir == "":
++            return False
++        if common_dir is None:
++            common_dir_file = Path(d) / "commondir"
++            try:
++                common_dir = os.fsdecode(common_dir_file.read_bytes()).rstrip("\r\n")
++            except FileNotFoundError:
++                if osp.lexists(common_dir_file):
++                    return False
++                common_dir = os.fspath(d)
++            except (OSError, UnicodeError):
++                return False
++            else:
++                if not common_dir:
++                    return False
++                try:
++                    common_dir = osp.realpath(osp.join(d, common_dir))
++                except (OSError, ValueError):
++                    return False
++
++        object_dir = os.getenv("GIT_OBJECT_DIRECTORY")
++        if object_dir is None:
++            object_dir = osp.join(common_dir, "objects")
++        if valid_head and osp.isdir(object_dir) and osp.isdir(osp.join(common_dir, "refs")):
++            return True
++        if osp.isfile(osp.join(d, "gitdir")) and osp.isfile(osp.join(d, "commondir")) and osp.isfile(headref):
+             raise WorkTreeRepositoryUnsupported(d)
+     return False
+ 
+@@ -83,19 +123,20 @@ def find_worktree_git_dir(dotgit: "PathLike") -> Optional[str]:
+     """Search for a gitdir for this worktree."""
+     try:
+         statbuf = os.stat(dotgit)
+-    except OSError:
++    except (FileNotFoundError, NotADirectoryError):
+         return None
+-    if not stat.S_ISREG(statbuf.st_mode):
++    if not stat.S_ISREG(statbuf.st_mode) or statbuf.st_size > (1 << 20):
+         return None
+ 
+     try:
+-        lines = Path(dotgit).read_text().splitlines()
+-        for key, value in [line.strip().split(": ") for line in lines]:
+-            if key == "gitdir":
+-                return value
+-    except ValueError:
+-        pass
+-    return None
++        with open(dotgit, "rb") as fp:
++            content_bytes = fp.read(statbuf.st_size)
++        if len(content_bytes) != statbuf.st_size:
++            return None
++        content = os.fsdecode(content_bytes).rstrip("\r\n")
++    except (OSError, UnicodeError):
++        return None
++    return content[8:] if len(content) >= 9 and content.startswith("gitdir: ") else None
+ 
+ 
+ def find_submodule_git_dir(d: "PathLike") -> Optional["PathLike"]:
+@@ -103,26 +144,18 @@ def find_submodule_git_dir(d: "PathLike") -> Optional["PathLike"]:
+     if is_git_dir(d):
+         return d
+ 
+-    try:
+-        with open(d) as fp:
+-            content = fp.read().rstrip()
+-    except IOError:
+-        # it's probably not a file
+-        pass
+-    else:
+-        if content.startswith("gitdir: "):
+-            path = content[8:]
+-
+-            if Git.is_cygwin():
+-                ## Cygwin creates submodules prefixed with `/cygdrive/...` suffixes.
+-                # Cygwin git understands Cygwin paths much better than Windows ones
+-                # Also the Cygwin tests are assuming Cygwin paths.
+-                path = cygpath(path)
+-            if not osp.isabs(path):
+-                path = osp.normpath(osp.join(osp.dirname(d), path))
+-            return find_submodule_git_dir(path)
+-    # END handle exception
+-    return None
++    path = find_worktree_git_dir(d)
++    if path is None:
++        return None
++
++    if Git.is_cygwin():
++        # Cygwin creates submodules prefixed with `/cygdrive/...`.
++        # Cygwin git understands Cygwin paths much better than Windows ones.
++        # Also the Cygwin tests are assuming Cygwin paths.
++        path = cygpath(path)
++    if not osp.isabs(path):
++        path = osp.normpath(osp.join(osp.dirname(d), path))
++    return path if is_git_dir(path) else None
+ 
+ 
+ def short_to_long(odb: "GitCmdObjectDB", hexsha: str) -> Optional[bytes]:
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 54bc423fa6..decd1ccc00 100644
@@ -47,6 +47,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-78677.patch \
             file://CVE-2026-78676.patch \
             file://CVE-2026-78675.patch \
+            file://CVE-2026-87817.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#25 lore raw

PATCH 25/27 python3-git: fix CVE-2026-87818

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/09f2cf383a992d1af697364569e9f384748c1bd8
[2] https://www.cve.org/CVERecord?id=CVE-2026-87818

---
 .../python/python3-git/CVE-2026-87818.patch   | 56 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 57 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-87818.patch
meta/recipes-devtools/python/python3-git/CVE-2026-87818.patch new file +56 -0
new file mode 100644
index 0000000000..98d120e2e7
@@ -0,0 +1,56 @@
+From 03a6fe1a628749fb173d8b7e020ceb01c150c600 Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Mon, 17 Aug 2026 06:15:12 +0200
+Subject: [PATCH 36/38] fix: require opt-in for no-index diffs
+
+<!-- agent -->
+Treat --no-index as an unsafe diff option because it changes path operands
+from repository pathspecs to arbitrary filesystem paths. This addresses
+GHSA-whh4-5q6c-9v3x without exposing advisory reproduction details.
+
+CVE: CVE-2026-87818
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/09f2cf383a992d1af697364569e9f384748c1bd8]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit 09f2cf383a992d1af697364569e9f384748c1bd8)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/diff.py      |    4 ++--
+ git/repo/base.py |    2 ++
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/git/diff.py b/git/diff.py
+index 84e7687b..7db268ff 100644
+--- a/git/diff.py
++++ b/git/diff.py
+@@ -136,8 +136,8 @@ class Diffable:
+             to be read and diffed.
+ 
+         :param allow_unsafe_options:
+-            If ``True``, allow options such as ``--output`` and ``-O`` that can write to
+-            or read from arbitrary filesystem paths.
++            If ``True``, allow options such as ``--output``, ``--no-index``, and ``-O``
++            that can write to or read from arbitrary filesystem paths.
+ 
+         :param kwargs:
+             Additional arguments passed to git-diff, such as ``R=True`` to swap both
+diff --git a/git/repo/base.py b/git/repo/base.py
+index c8e8f6ed..e0d12439 100644
+--- a/git/repo/base.py
++++ b/git/repo/base.py
+@@ -195,6 +195,8 @@ class Repo:
+     ]
+ 
+     unsafe_git_diff_options = unsafe_git_revision_options + [
++        # Treats path operands as arbitrary filesystem paths.
++        "--no-index",
+         # Reads caller-controlled order patterns from an arbitrary file.
+         "-O",
+         "--orderfile",
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index decd1ccc00..71275b0861 100644
@@ -48,6 +48,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-78676.patch \
             file://CVE-2026-78675.patch \
             file://CVE-2026-87817.patch \
+            file://CVE-2026-87818.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#26 lore raw

PATCH 26/27 python3-git: fix CVE-2026-87819

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [3], using the commit shown in [1] and [2].

[1] https://github.com/gitpython-developers/GitPython/commit/751473a5f3221d6f989291cbebcc404353fd3ba8
[2] https://github.com/gitpython-developers/GitPython/commit/bc63b027e2fc737e2ec0222bfa764e1aa76a427f
[3] https://www.cve.org/CVERecord?id=CVE-2026-87819

---
 .../python3-git/CVE-2026-87819_p1.patch       | 78 +++++++++++++++++++
 .../python3-git/CVE-2026-87819_p2.patch       | 58 ++++++++++++++
 .../python/python3-git_3.1.42.bb              |  2 +
 3 files changed, 138 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-87819_p1.patch
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-87819_p2.patch
meta/recipes-devtools/python/python3-git/CVE-2026-87819_p1.patch new file +78 -0
new file mode 100644
index 0000000000..46ce789834
@@ -0,0 +1,78 @@
+From dc8a898eb74ac5614c7ca013de21e30e8dac2e17 Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Date: Tue, 11 Aug 2026 14:18:25 +0200
+Subject: [PATCH 37/38] fix: parse actor identities without regular expressions
+
+<!-- agent -->
+GHSA-g5vv-9gxw-82hx reports quadratic backtracking when an actor
+identity contains a long unterminated email delimiter.
+
+Add a regression that exercises a 20,000-character malformed identity,
+then replace both actor regexes with direct delimiter scans following
+Git's first-opening, first-closing delimiter behavior. Keep GitPython's
+whole-string fallback when either delimiter is absent.
+
+Reference Git baseline cf5497b14c5a24f10c13f7e0ee85cb95
+ident.c::split_ident_line and its invalid-committer cases in
+t/t9300-fast-import.sh. Also reference gix-actor's signature decoder and
+lenient identity tests.
+
+CVE: CVE-2026-87819
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/751473a5f3221d6f989291cbebcc404353fd3ba8]
+
+Backport Changes:
+- Omit upstream regression test changes because the current PyPI 
+  source archive does not include its test suite.
+
+Assisted-by: GPT 5.6
+Co-authored-by: GPT 5.6 <[email protected]>
+(cherry picked from commit 751473a5f3221d6f989291cbebcc404353fd3ba8)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/util.py |   24 ++++++++----------------
+ 1 file changed, 8 insertions(+), 16 deletions(-)
+
+diff --git a/git/util.py b/git/util.py
+index d3eaeb8b..292d5671 100644
+--- a/git/util.py
++++ b/git/util.py
+@@ -756,10 +756,6 @@ class Actor:
+     can be committers and authors or anything with a name and an email as
+     mentioned in the git log entries."""
+ 
+-    # PRECOMPILED REGEX
+-    name_only_regex = re.compile(r"<(.*)>")
+-    name_email_regex = re.compile(r"(.*) <(.*?)>")
+-
+     # ENVIRONMENT VARIABLES
+     # These are read when creating new commits.
+     env_author_name = "GIT_AUTHOR_NAME"
+@@ -802,18 +798,14 @@ class Actor:
+ 
+         :return: Actor
+         """
+-        m = cls.name_email_regex.search(string)
+-        if m:
+-            name, email = m.groups()
+-            return Actor(name, email)
+-        else:
+-            m = cls.name_only_regex.search(string)
+-            if m:
+-                return Actor(m.group(1), None)
+-            # Assume the best and use the whole string as name.
+-            return Actor(string, None)
+-            # END special case name
+-        # END handle name/email matching
++        line = string.partition("\n")[0]
++        left_bracket = line.find("<")
++        right_bracket = line.find(">", left_bracket + 1)
++        if left_bracket >= 0 and right_bracket >= 0:
++            return Actor(line[:left_bracket].rstrip(), line[left_bracket + 1 : right_bracket])
++
++        # Assume the best and use the whole string as name.
++        return Actor(string, None)
+ 
+     @classmethod
+     def _main_actor(
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git/CVE-2026-87819_p2.patch new file +58 -0

58 lines not on this page · raw message

meta/recipes-devtools/python/python3-git_3.1.42.bb +2 -0
index 71275b0861..0102e8c329 100644
@@ -49,6 +49,8 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-78675.patch \
             file://CVE-2026-87817.patch \
             file://CVE-2026-87818.patch \
+            file://CVE-2026-87819_p1.patch \
+            file://CVE-2026-87819_p2.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4
#27 lore raw

PATCH 27/27 python3-git: fix CVE-2026-100689

In reply to Yogita Urade

This patch applies the upstream fix as referenced in [2], using the commit shown in [1].

[1] https://github.com/gitpython-developers/GitPython/commit/1ed0ebc2f2e74d979cdc367a4864a7731fdcc093
[2] https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-59cr-6r3x-644w

---
 .../python/python3-git/CVE-2026-100689.patch  | 60 +++++++++++++++++++
 .../python/python3-git_3.1.42.bb              |  1 +
 2 files changed, 61 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-100689.patch
meta/recipes-devtools/python/python3-git/CVE-2026-100689.patch new file +60 -0
new file mode 100644
index 0000000000..2712854d6f
@@ -0,0 +1,60 @@
+From 1ed0ebc2f2e74d979cdc367a4864a7731fdcc093 Mon Sep 17 00:00:00 2001
+From: Byron <[email protected]>
+Subject: [PATCH] Reject submodule checkout paths outside the repository
+
+The submodule path from .gitmodules reaches filesystem operations during
+update without the containment validation used by other operations.
+Validate the checkout path and reject symbolic links before returning its
+absolute path.
+
+CVE: CVE-2026-100689
+Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/1ed0ebc2f2e74d979cdc367a4864a7731fdcc093]
+
+Backport Changes:
+- GitPython 3.1.42's _to_relative_path() does not reject relative parent
+  traversal or the repository root. Add canonical containment validation
+  in abspath before its upstream component and symlink checks.
+- Omit upstream regression tests because the PyPI source archive does not
+  contain the test suite. Omit the documentation-only release note.
+
+(cherry picked from commit 1ed0ebc2f2e74d979cdc367a4864a7731fdcc093)
+Signed-off-by: Yogita Urade <[email protected]>
+---
+ git/objects/submodule/base.py | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
+index 84d6bcdc..d6d317ab 100644
+--- a/git/objects/submodule/base.py
++++ b/git/objects/submodule/base.py
+@@ -354,4 +354,28 @@ class Submodule(IndexObject, TraversableIterableObj):
+         return path
+ 
++    @property
++    def abspath(self) -> PathLike:
++        root = self.repo.working_tree_dir
++        if root is None:
++            return super().abspath
++
++        root = osp.realpath(root)
++        checkout_path = osp.realpath(osp.join(root, os.fspath(self.path)))
++        try:
++            common_path = osp.commonpath([root, checkout_path])
++        except ValueError as e:
++            raise ValueError("Submodule checkout path %r is not in repository" % self.path) from e
++        if osp.normcase(common_path) != osp.normcase(root):
++            raise ValueError("Submodule checkout path %r is not in repository" % self.path)
++        if osp.normcase(checkout_path) == osp.normcase(root):
++            raise ValueError("Submodule checkout path must not be the repository root")
++
++        path = root
++        for component in os.fspath(self._to_relative_path(self.repo, self.path)).split("/"):
++            path = join_path_native(path, component)
++            if osp.islink(path):
++                raise ValueError("Submodule checkout path %r contains a symbolic link" % self.path)
++        return path
++
+     @classmethod
+     def _write_git_file_and_module_config(cls, working_tree_dir: PathLike, module_abspath: PathLike) -> None:
+-- 
+2.35.6
meta/recipes-devtools/python/python3-git_3.1.42.bb +1 -0
index 0102e8c329..59c40b575a 100644
@@ -51,6 +51,7 @@ SRC_URI += "            file://CVE-2026-42284.patch \
             file://CVE-2026-87818.patch \
             file://CVE-2026-87819_p1.patch \
             file://CVE-2026-87819_p2.patch \
+            file://CVE-2026-100689.patch \
            "
 SRC_URI[sha256sum] = "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
 
Signature · 1 line
2.44.4