new file mode 100644
@@ -0,0 +1,208 @@
+From 51216053bd6885b546be8e9ed2e8e1000e7ee5a3 Mon Sep 17 00:00:00 2001
+From: Byron <sebastian.thiel@icloud.com>
+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 <yurade@cisco.com>
+---
+ 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
@@ -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"
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 Signed-off-by: Yogita Urade <yurade@cisco.com> --- .../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