public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Benjamin A. Beasley <code@musicinmybrain.net>
To: git-commits@fedoraproject.org
Subject: [rpms/python-loguru] f43: Backport fix for CVE-2026-120217; Fixes RHBZ#2565692
Date: Wed, 04 Nov 2026 07:52:54 GMT	[thread overview]
Message-ID: <179377877409.1.15044824265958890940.rpms-python-loguru-1a5513df771c@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/python-loguru
Branch : f43
Commit : 1a5513df771ce55c8024e212bb549d6014e874ce
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date   : 2026-11-04T06:55:54+00:00
Stats  : +55/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python-loguru/c/1a5513df771ce55c8024e212bb549d6014e874ce?branch=f43

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 99b780a..7ae922c 100644
--- a/python-loguru.spec
+++ b/python-loguru.spec
@@ -15,6 +15,10 @@ 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
 
@@ -22,7 +26,7 @@ BuildSystem:    pyproject
 BuildOption(install): --assert-license loguru
 
 # 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}

                 reply	other threads:[~2026-11-04  7:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=179377877409.1.15044824265958890940.rpms-python-loguru-1a5513df771c@fedoraproject.org \
    --to=code@musicinmybrain.net \
    --cc=git-commits@fedoraproject.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