From: Yogita Urade <yurade@cisco.com>
To: openembedded-core@lists.openembedded.org
Subject: [OE-core][wrynose][v2 PATCH 05/27] python3-git: fix CVE-2026-67322
Date: Fri, 6 Nov 2026 06:43:09 -0800 [thread overview]
Message-ID: <20261106144331.3354811-6-yurade@cisco.com> (raw)
In-Reply-To: <20261106144331.3354811-1-yurade@cisco.com>
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://security-tracker.debian.org/tracker/CVE-2026-67322
Signed-off-by: Yogita Urade <yurade@cisco.com>
---
Changes in v2:
- Changed the advisory reference from NVD to Debian Security Tracker.
Converted the caller-supplied URL to str before Git.polish_url(),
and converted the normalized clone URL to str before Git.check_unsafe_protocols().
Expanded Backport Changes to explain these GitPython 3.1.43 adaptations.
---
.../python/python3-git/CVE-2026-67322.patch | 171 ++++++++++++++++++
.../python/python3-git_3.1.43.bb | 1 +
2 files changed, 172 insertions(+)
create mode 100644 meta/recipes-devtools/python/python3-git/CVE-2026-67322.patch
diff --git a/meta/recipes-devtools/python/python3-git/CVE-2026-67322.patch b/meta/recipes-devtools/python/python3-git/CVE-2026-67322.patch
new file mode 100644
index 0000000000..a78d2bd37a
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-git/CVE-2026-67322.patch
@@ -0,0 +1,171 @@
+From 3ae11b59c9c4cf15f04397d58b8a90b621b6571b Mon Sep 17 00:00:00 2001
+From: "GPT 5.6" <codex@openai.com>
+Date: Wed, 15 Jul 2026 16:44:13 +0200
+Subject: [PATCH] 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:
+- Omitted test/test_clone.py because the current PyPI source archive
+ does not include the test suite and the python3-git recipe does not
+ run it.
+- In Repo.clone_from(), stringify caller-supplied url before Git.polish_url()
+ because GitPython 3.1.43 accepts PathLike URLs but polish_url() uses string
+ operations. Stringify normalized clone_url before Git.check_unsafe_protocols()
+ because its regex expects str; validate the normalized value passed to Git.
+
+Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
+(cherry picked from commit 8ac5a30519b6f4af85398b9b9d7064ff4d452da2)
+Signed-off-by: Yogita Urade <yurade@cisco.com>
+---
+ git/cmd.py | 19 ++++++++++++-------
+ git/repo/base.py | 7 ++++---
+ git/util.py | 15 +++++++++------
+ 3 files changed, 25 insertions(+), 16 deletions(-)
+
+diff --git a/git/cmd.py b/git/cmd.py
+index 75495dc1..58d219e3 100644
+--- a/git/cmd.py
++++ b/git/cmd.py
+@@ -670,29 +670,34 @@ Git.polish_url
+
+ @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:
++ 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.
++
++ :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 3380e0c5..d661f036 100644
+--- a/git/repo/base.py
++++ b/git/repo/base.py
+@@ -1408,8 +1408,9 @@ Repo.clone_from
+ if multi_options:
+ multi = shlex.split(" ".join(multi_options))
+
++ clone_url = Git.polish_url(str(url), expand_vars=False)
+ if not allow_unsafe_protocols:
+- Git.check_unsafe_protocols(str(url))
++ Git.check_unsafe_protocols(str(clone_url))
+ if not allow_unsafe_options:
+ Git.check_unsafe_options(
+ options=Git._option_candidates([], kwargs),
+@@ -1421,7 +1422,7 @@ Repo.clone_from
+ proc = git.clone(
+ multi,
+ "--",
+- Git.polish_url(str(url)),
++ clone_url,
+ clone_path,
+ with_extended_output=True,
+ as_process=True,
+@@ -1461,7 +1462,7 @@ Repo.clone_from
+ # escape the backslashes. Hence we undo the escaping just to be 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 27b239ab..9619937c 100644
+--- a/git/util.py
++++ b/git/util.py
+@@ -382,13 +382,13 @@ _cygexpath
+ 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.
+@@ -416,7 +416,7 @@ cygpath
+ )
+
+
+-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?
+@@ -424,12 +424,15 @@ cygpath
+ 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
+
diff --git a/meta/recipes-devtools/python/python3-git_3.1.43.bb b/meta/recipes-devtools/python/python3-git_3.1.43.bb
index ca2efce37e..fafb9972ef 100644
--- a/meta/recipes-devtools/python/python3-git_3.1.43.bb
+++ b/meta/recipes-devtools/python/python3-git_3.1.43.bb
@@ -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] = "35f314a9f878467f5453cc1fee295c3e18e52f1b99f10f6cf5b1682e968a9e7c"
--
2.53.0
next prev parent reply other threads:[~2026-11-06 14:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 14:43 [OE-core][wrynose][v2 PATCH 00/27] python3-git: Security fixes Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 01/27] python3-git: fix CVE-2026-67326 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 02/27] python3-git: fix CVE-2026-67323 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 03/27] python3-git: Fix CVE-2026-67325 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 04/27] python3-git: fix CVE-2026-67324 Yogita Urade
2026-11-06 14:43 ` Yogita Urade [this message]
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 06/27] python3-git: fix CVE-2026-69097 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 07/27] python3-git: fix CVE-2026-73625 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 08/27] python3-git: fix CVE-2026-73623 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 09/27] python3-git: fix CVE-2026-73624 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 10/27] python3-git: fix CVE-2026-73622 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 11/27] python3-git: fix CVE-2026-73621 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 12/27] python3-git: fix CVE-2026-73620 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 13/27] python3-git: fix CVE-2026-73619 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 14/27] python3-git: fix CVE-2026-76221 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 15/27] python3-git: fix CVE-2026-76220 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 16/27] python3-git: fix CVE-2026-76219 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 17/27] python3-git: fix CVE-2026-76218 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 18/27] python3-git: fix CVE-2026-76217 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 19/27] python3-git: fix CVE-2026-76222 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 20/27] python3-git: fix CVE-2026-78678 CVE-2026-78679 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 21/27] python3-git: fix CVE-2026-78677 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 22/27] python3-git: fix CVE-2026-78676 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 23/27] python3-git: fix CVE-2026-78675 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 24/27] python3-git: fix CVE-2026-87817 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 25/27] python3-git: fix CVE-2026-87818 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 26/27] python3-git: Fix CVE-2026-87819 Yogita Urade
2026-11-06 14:43 ` [OE-core][wrynose][v2 PATCH 27/27] python3-git: fix CVE-2026-100689 Yogita Urade
2026-11-14 0:16 ` [OE-core][wrynose][v2 PATCH 00/27] python3-git: Security fixes Yoann Congal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261106144331.3354811-6-yurade@cisco.com \
--to=yurade@cisco.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox