Files
poky/meta/recipes-devtools/python/python3-git/CVE-2026-42215_p2.patch
T
Darsh Kelaiya ff174ac8fd python3-git: fix CVE-2026-42215
This patch applies the upstream 3.1.47 backport for
CVE-2026-42215. The upstream fix merge is referenced in [1],
and the public CVE advisory is referenced in [2]. The individual
backported commits are referenced in [3] and [4].

[1] https://github.com/gitpython-developers/GitPython/commit/0f68db0710f9125762fca5dbc2328593537ae923
[2] https://nvd.nist.gov/vuln/detail/CVE-2026-42215
[3] https://github.com/gitpython-developers/GitPython/commit/142195888e713542189533a52cdfc333f05c3af6
[4] https://github.com/gitpython-developers/GitPython/commit/43d92dec4683568d11495956dd556161f17c3ea8

(From OE-Core rev: d1c3217c9cc503d85d4fd796d424c43496255ba7)

Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Paul Barker <paul@pbarker.dev>
2026-09-28 10:17:43 +01:00

48 lines
1.7 KiB
Diff

From 3385ff27397b58288d922838e8d2eae87d7534fd Mon Sep 17 00:00:00 2001
From: w <w@mac.lan>
Date: Tue, 21 Apr 2026 12:03:20 -0400
Subject: [PATCH] git.cmd: harden unsafe option canonicalization and isolate
push test cases
CVE: CVE-2026-42215
Upstream-Status: Backport [https://github.com/gitpython-developers/GitPython/commit/43d92dec4683568d11495956dd556161f17c3ea8]
Backport Changes:
- Omit regression test updates because the Scarthgap PyPI
source archive does not include the upstream test suite.
(cherry picked from commit 43d92dec4683568d11495956dd556161f17c3ea8)
Signed-off-by: Darsh Kelaiya <dkelaiya@cisco.com>
---
git/cmd.py | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/git/cmd.py b/git/cmd.py
index 69756216..73b4c052 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -542,9 +542,18 @@ class Git(LazyMixin):
@classmethod
def _canonicalize_option_name(cls, option: str) -> str:
- """Normalize an option or kwarg name for unsafe-option checks."""
- option_name = option.lstrip("-").split("=", 1)[0].split(None, 1)[0]
- return dashify(option_name)
+ """Return the option name used for unsafe-option checks.
+
+ Examples:
+ ``"--upload-pack=/tmp/helper"`` -> ``"upload-pack"``
+ ``"upload_pack"`` -> ``"upload-pack"``
+ ``"--config core.filemode=false"`` -> ``"config"``
+ """
+ option_name = option.lstrip("-").split("=", 1)[0]
+ option_tokens = option_name.split(None, 1)
+ if not option_tokens:
+ return ""
+ return dashify(option_tokens[0])
@classmethod
def check_unsafe_options(cls, options: List[str], unsafe_options: List[str]) -> None:
--
2.35.6