public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-loguru] epel10: Backport fix for CVE-2026-120217; Fixes RHBZ#2565692
@ 2026-11-04 10:03 Benjamin A. Beasley
0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-11-04 10:03 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-loguru
Branch : epel10
Commit : b80a970ccf9fd96bd6dd51b15e8fa76e623eb9e3
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date : 2026-11-04T09:59:59+00:00
Stats : +55/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/python-loguru/c/b80a970ccf9fd96bd6dd51b15e8fa76e623eb9e3?branch=epel10
Log:
Backport fix for CVE-2026-120217; Fixes RHBZ#2565692
---
diff --git a/CVE-2026-120217.patch b/CVE-2026-120217.patch
new file mode 100644
index 0000000..0b69700
--- /dev/null
+++ b/CVE-2026-120217.patch
@@ -0,0 +1,50 @@
+diff -Naur a/loguru/_colorizer.py b/loguru/_colorizer.py
+--- a/loguru/_colorizer.py 2024-12-06 11:01:27.000000000 +0000
++++ b/loguru/_colorizer.py 2026-11-04 06:55:33.372233034 +0000
+@@ -166,7 +166,8 @@
+ }
+ )
+
+- _regex_tag = re.compile(r"(\\*)(</?(?:[fb]g\s)?[^<>\s]*>)")
++ # The negative lookbehind prevents quadratic re-scan of the whole input.
++ _regex_tag = re.compile(r"(?<!\\)(\\*)(</?(?:[fb]g\s)?[^<>\s]*>)")
+
+ def __init__(self):
+ self._tokens = []
+diff -Naur a/loguru/_logger.py b/loguru/_logger.py
+--- a/loguru/_logger.py 2024-12-06 11:01:27.000000000 +0000
++++ b/loguru/_logger.py 2026-11-04 06:39:16.208366029 +0000
+@@ -667,7 +667,7 @@
+ prepending a ``\`` like for example ``\<blue>``. To prevent the escaping to occur, you can
+ simply double the ``\`` (e.g. ``\\<blue>`` will print a literal ``\`` before colored text).
+ If, for some reason, you need to escape a string programmatically, note that the regex used
+- internally to parse markup tags is ``r"(\\*)(</?(?:[fb]g\s)?[^<>\s]*>)"``.
++ internally to parse markup tags is ``r"(?<!\\)(\\*)(</?(?:[fb]g\s)?[^<>\s]*>)"``.
+
+ Note that when logging a message with ``opt(colors=True)``, color tags present in the
+ formatting arguments (``args`` and ``kwargs``) are completely ignored. This is important if
+diff -Naur a/tests/test_add_option_colorize.py b/tests/test_add_option_colorize.py
+--- a/tests/test_add_option_colorize.py 2024-12-06 11:01:27.000000000 +0000
++++ b/tests/test_add_option_colorize.py 2026-11-04 06:39:52.271871733 +0000
+@@ -1,5 +1,7 @@
+ import pytest
+
++import time
++
+ from loguru import logger
+
+ from .conftest import StreamIsattyException, StreamIsattyFalse, StreamIsattyTrue, parse
+@@ -73,3 +75,13 @@
+ logger.add(stream, format="<blue>{message}</blue>", colorize=None)
+ logger.debug("Message")
+ assert stream.getvalue() == "Message\n"
++
++
++def test_search_through_pathological_pattern():
++ # It's a reDoS if the internal regex is greedy.
++ logger.add(lambda _: None)
++ start = time.perf_counter()
++ logger.opt(colors=True).info("\\" * 200000)
++ end = time.perf_counter()
++ elapsed = end - start
++ assert elapsed < 1.0
diff --git a/python-loguru.spec b/python-loguru.spec
index 013f02d..717f379 100644
--- a/python-loguru.spec
+++ b/python-loguru.spec
@@ -15,11 +15,15 @@ Patch: 0001-Fix-deprecation-warning-raised-by-tests-with-Python-.patch
# Fix failing "exception_modern" unit test with Python 3.14 (#1331)
# https://github.com/Delgan/loguru/commit/84023e2bd8339de95250470f422f096edcb8f7b7
Patch: %{url}/commit/84023e2bd8339de95250470f422f096edcb8f7b7.patch
+# Fix greedy regex causing quadratic scans and possible reDoS
+# https://github.com/Delgan/loguru/commit/4e7762bcb44862fce877b1f90f19063834509575
+# Fixes CVE-2026-120217. Backported to 0.7.3 without the changelog entry.
+Patch: CVE-2026-120217.patch
BuildArch: noarch
# The dev extra pins exact versions and includes unwanted coverage tools etc.
-# (https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters),
+# (https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters),
# and developer tools, so we enumerate test dependencies manually:
BuildRequires: %{py3_dist colorama}
BuildRequires: %{py3_dist freezegun}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-04 10:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 10:03 [rpms/python-loguru] epel10: Backport fix for CVE-2026-120217; Fixes RHBZ#2565692 Benjamin A. Beasley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox