Skip to contentSkip to conversation

python3-django CVE fixes

PATCH In review Ankur Tyagi 2 participants 12 messages Oct 22, 2025 – Oct 30, 2025 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

v2 cover python3-django CVE fixes

changes in v2
- renamed CVE-2025-26699.patch and removed CVE tag because it is not a CVE fix but fixes a regression caused by CVE fix

Ankur Tyagi (7):
python-django: fix 4.2.20 regression
python3-django: patch CVE-2025-32873
python3-django: patch CVE-2025-48432
python3-django: patch CVE-2025-57833
python3-django: patch CVE-2025-59681
python3-django: patch CVE-2025-59682
python3-django: upgrade 5.0.11 -> 5.0.14

Soumya Sambu (1):
python3-django: upgrade 4.2.18 -> 4.2.20

 .../CVE-2025-32873.patch                      |  86 +++++++
 .../CVE-2025-48432-1.patch                    | 166 +++++++++++++
 .../CVE-2025-48432-2.patch                    | 225 ++++++++++++++++++
 .../CVE-2025-48432-3.patch                    | 165 +++++++++++++
 .../CVE-2025-48432-4.patch                    | 193 +++++++++++++++
 .../CVE-2025-48432-5.patch                    |  76 ++++++
 .../CVE-2025-48432-6.patch                    | 167 +++++++++++++
 .../CVE-2025-57833.patch                      |  83 +++++++
 .../CVE-2025-59681.patch                      | 174 ++++++++++++++
 .../CVE-2025-59682.patch                      |  72 ++++++
 ...ntroduced-when-fixing-CVE-2025-26699.patch | 102 ++++++++
 .../python/python3-django_4.2.18.bb           |  14 --
 .../python/python3-django_4.2.20.bb           |  28 +++
 ...ngo_5.0.11.bb => python3-django_5.0.14.bb} |   2 +-
 14 files changed, 1538 insertions(+), 15 deletions(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-32873.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-1.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-2.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-3.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-4.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-5.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-6.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-57833.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-59681.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-59682.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/fix-regression-introduced-when-fixing-CVE-2025-26699.patch
 delete mode 100644 meta-python/recipes-devtools/python/python3-django_4.2.18.bb
 create mode 100644 meta-python/recipes-devtools/python/python3-django_4.2.20.bb
 rename meta-python/recipes-devtools/python/{python3-django_5.0.11.bb => python3-django_5.0.14.bb} (56%)
#1 lore raw

PATCH v2 1/8 python3-django: upgrade 4.2.18 -> 4.2.20

From: Soumya Sambu <[email protected]>

Includes fix for CVE-2025-26699

Release Notes:
https://docs.djangoproject.com/en/dev/releases/4.2.19/
https://docs.djangoproject.com/en/dev/releases/4.2.20/

(cherry picked from commit 54f5df8907cbf1212d0733ffddc049c7b8b8aaf0)
---
 .../{python3-django_4.2.18.bb => python3-django_4.2.20.bb}    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename meta-python/recipes-devtools/python/{python3-django_4.2.18.bb => python3-django_4.2.20.bb} (63%)
meta-python/recipes-devtools/python/python3-django_4.2.20.bb renamed from meta-python/recipes-devtools/python/python3-django_4.2.18.bb +2 -2
similarity index 63%
rename from meta-python/recipes-devtools/python/python3-django_4.2.18.bb
rename to meta-python/recipes-devtools/python/python3-django_4.2.20.bb
index c9be3c0462..3fb8b03224 100644
@@ -1,7 +1,7 @@
 require python-django.inc
 inherit setuptools3
 
-SRC_URI[sha256sum] = "52ae8eacf635617c0f13b44f749e5ea13dc34262819b2cc8c8636abb08d82c4b"
+SRC_URI[sha256sum] = "92bac5b4432a64532abb73b2ac27203f485e40225d2640a7fbef2b62b876e789"
 
 RDEPENDS:${PN} += "\
     python3-sqlparse \
@@ -10,5 +10,5 @@ RDEPENDS:${PN} += "\
 
 # Set DEFAULT_PREFERENCE so that the LTS version of django is built by
 # default. To build the 4.x branch, 
-# PREFERRED_VERSION_python3-django = "4.2.18" can be added to local.conf
+# PREFERRED_VERSION_python3-django = "4.2.20" can be added to local.conf
 DEFAULT_PREFERENCE = "-1"
#2 lore raw

PATCH v2 2/8 python-django: fix 4.2.20 regression

In reply to Ankur Tyagi

This fixes a regression in Django 4.2.20, introduced when fixing CVE-2025-26699

Details https://code.djangoproject.com/ticket/36341

---
 ...ntroduced-when-fixing-CVE-2025-26699.patch | 102 ++++++++++++++++++
 .../python/python3-django_4.2.20.bb           |   4 +
 2 files changed, 106 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/fix-regression-introduced-when-fixing-CVE-2025-26699.patch
meta-python/recipes-devtools/python/python3-django-4.2.20/fix-regression-introduced-when-fixing-CVE-2025-26699.patch new file +102 -0
new file mode 100644
index 0000000000..0b4dd69f2c
@@ -0,0 +1,102 @@
+From 9e8a009a7360349d5adb96e896a0a17f53dc9826 Mon Sep 17 00:00:00 2001
+From: Matti Pohjanvirta <[email protected]>
+Date: Sun, 20 Apr 2025 18:22:51 +0300
+Subject: [PATCH] Fix regression introduced when fixing CVE-2025-26699
+
+[4.2.x] Fixed #36341 -- Preserved whitespaces in wordwrap template filter.
+
+Regression in 55d89e25f4115c5674cdd9b9bcba2bb2bb6d820b.
+
+This work improves the django.utils.text.wrap() function to ensure that
+empty lines and lines with whitespace only are kept instead of being
+dropped.
+
+Thanks Matti Pohjanvirta for the report and fix.
+
+Co-authored-by: Natalia <[email protected]>
+
+Backport of 1e9db35836d42a3c72f3d1015c2f302eb6fee046 from main.
+
+Upstream-Status: Backport [https://github.com/django/django/commit/e61e3daaf037507211028494d61f24382be31e5a]
+(cherry picked from commit e61e3daaf037507211028494d61f24382be31e5a)
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ django/utils/text.py                          | 13 +++++-
+ .../filter_tests/test_wordwrap.py             | 41 +++++++++++++++++++
+ 2 files changed, 52 insertions(+), 2 deletions(-)
+
+diff --git a/django/utils/text.py b/django/utils/text.py
+index 81ae88dc76..b018f2601f 100644
+--- a/django/utils/text.py
++++ b/django/utils/text.py
+@@ -102,10 +102,19 @@ def wrap(text, width):
+         width=width,
+         break_long_words=False,
+         break_on_hyphens=False,
++        replace_whitespace=False,
+     )
+     result = []
+-    for line in text.splitlines(True):
+-        result.extend(wrapper.wrap(line))
++    for line in text.splitlines():
++        wrapped = wrapper.wrap(line)
++        if not wrapped:
++            # If `line` contains only whitespaces that are dropped, restore it.
++            result.append(line)
++        else:
++            result.extend(wrapped)
++    if text.endswith("\n"):
++        # If `text` ends with a newline, preserve it.
++        result.append("")
+     return "\n".join(result)
+ 
+ 
+diff --git a/tests/template_tests/filter_tests/test_wordwrap.py b/tests/template_tests/filter_tests/test_wordwrap.py
+index 4afa1dd234..1692332e1e 100644
+--- a/tests/template_tests/filter_tests/test_wordwrap.py
++++ b/tests/template_tests/filter_tests/test_wordwrap.py
+@@ -89,3 +89,44 @@ class FunctionTests(SimpleTestCase):
+             "I'm afraid",
+             wordwrap(long_text, 10),
+         )
++
++    def test_wrap_preserve_newlines(self):
++        cases = [
++            (
++                "this is a long paragraph of text that really needs to be wrapped\n\n"
++                "that is followed by another paragraph separated by an empty line\n",
++                "this is a long paragraph of\ntext that really needs to be\nwrapped\n\n"
++                "that is followed by another\nparagraph separated by an\nempty line\n",
++                30,
++            ),
++            ("\n\n\n", "\n\n\n", 5),
++            ("\n\n\n\n\n\n", "\n\n\n\n\n\n", 5),
++        ]
++        for text, expected, width in cases:
++            with self.subTest(text=text):
++                self.assertEqual(wordwrap(text, width), expected)
++
++    def test_wrap_preserve_whitespace(self):
++        width = 5
++        width_spaces = " " * width
++        cases = [
++            (
++                f"first line\n{width_spaces}\nsecond line",
++                f"first\nline\n{width_spaces}\nsecond\nline",
++            ),
++            (
++                "first line\n \t\t\t \nsecond line",
++                "first\nline\n \t\t\t \nsecond\nline",
++            ),
++            (
++                f"first line\n{width_spaces}\nsecond line\n\nthird{width_spaces}\n",
++                f"first\nline\n{width_spaces}\nsecond\nline\n\nthird\n",
++            ),
++            (
++                f"first line\n{width_spaces}{width_spaces}\nsecond line",
++                f"first\nline\n{width_spaces}{width_spaces}\nsecond\nline",
++            ),
++        ]
++        for text, expected in cases:
++            with self.subTest(text=text):
++                self.assertEqual(wordwrap(text, width), expected)
meta-python/recipes-devtools/python/python3-django_4.2.20.bb +4 -0
index 3fb8b03224..1bb14aeb71 100644
@@ -1,6 +1,10 @@
 require python-django.inc
 inherit setuptools3
 
+SRC_URI += " \
+    file://fix-regression-introduced-when-fixing-CVE-2025-26699.patch \
+"
+
 SRC_URI[sha256sum] = "92bac5b4432a64532abb73b2ac27203f485e40225d2640a7fbef2b62b876e789"
 
 RDEPENDS:${PN} += "\
#3 lore raw

PATCH v2 3/8 python3-django: patch CVE-2025-32873

In reply to Ankur Tyagi

Details https://nvd.nist.gov/vuln/detail/CVE-2025-32873

---
 .../CVE-2025-32873.patch                      | 86 +++++++++++++++++++
 .../python/python3-django_4.2.20.bb           |  1 +
 2 files changed, 87 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-32873.patch
meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-32873.patch new file +86 -0
new file mode 100644
index 0000000000..cb1e32846a
@@ -0,0 +1,86 @@
+From 3571c537ae0b504cf1326807908682f28aff9613 Mon Sep 17 00:00:00 2001
+From: Sarah Boyce <[email protected]>
+Date: Tue, 8 Apr 2025 16:30:17 +0200
+Subject: [PATCH] CVE-2025-32873
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+[4.2.x] Fixed CVE-2025-32873 -- Mitigated potential DoS in strip_tags().
+
+Thanks to Elias Myllymäki for the report, and Shai Berger and Jake
+Howard for the reviews.
+
+Co-authored-by: Natalia <[email protected]>
+
+Backport of 9f3419b519799d69f2aba70b9d25abe2e70d03e0 from main.
+
+CVE: CVE-2025-32873
+Upstream-Status: Backport [https://github.com/django/django/commit/9cd8028f3e38dca8e51c1388f474eecbe7d6ca3c]
+(cherry picked from commit 9cd8028f3e38dca8e51c1388f474eecbe7d6ca3c)
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ django/utils/html.py           |  6 ++++++
+ tests/utils_tests/test_html.py | 15 ++++++++++++++-
+ 2 files changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/django/utils/html.py b/django/utils/html.py
+index a3a7238cba..84c37d1186 100644
+--- a/django/utils/html.py
++++ b/django/utils/html.py
+@@ -17,6 +17,9 @@ from django.utils.text import normalize_newlines
+ MAX_URL_LENGTH = 2048
+ MAX_STRIP_TAGS_DEPTH = 50
+ 
++# HTML tag that opens but has no closing ">" after 1k+ chars.
++long_open_tag_without_closing_re = _lazy_re_compile(r"<[a-zA-Z][^>]{1000,}")
++
+ 
+ @keep_lazy(SafeString)
+ def escape(text):
+@@ -175,6 +178,9 @@ def _strip_once(value):
+ def strip_tags(value):
+     """Return the given HTML with all tags stripped."""
+     value = str(value)
++    for long_open_tag in long_open_tag_without_closing_re.finditer(value):
++        if long_open_tag.group().count("<") >= MAX_STRIP_TAGS_DEPTH:
++            raise SuspiciousOperation
+     # Note: in typical case this loop executes _strip_once twice (the second
+     # execution does not remove any more tags).
+     strip_tags_depth = 0
+diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
+index 579bb2a1e3..25168e2348 100644
+--- a/tests/utils_tests/test_html.py
++++ b/tests/utils_tests/test_html.py
+@@ -115,17 +115,30 @@ class TestUtilsHtml(SimpleTestCase):
+             ("><!" + ("&" * 16000) + "D", "><!" + ("&" * 16000) + "D"),
+             ("X<<<<br>br>br>br>X", "XX"),
+             ("<" * 50 + "a>" * 50, ""),
++            (">" + "<a" * 500 + "a", ">" + "<a" * 500 + "a"),
++            ("<a" * 49 + "a" * 951, "<a" * 49 + "a" * 951),
++            ("<" + "a" * 1_002, "<" + "a" * 1_002),
+         )
+         for value, output in items:
+             with self.subTest(value=value, output=output):
+                 self.check_output(strip_tags, value, output)
+                 self.check_output(strip_tags, lazystr(value), output)
+ 
+-    def test_strip_tags_suspicious_operation(self):
++    def test_strip_tags_suspicious_operation_max_depth(self):
+         value = "<" * 51 + "a>" * 51, "<a>"
+         with self.assertRaises(SuspiciousOperation):
+             strip_tags(value)
+ 
++    def test_strip_tags_suspicious_operation_large_open_tags(self):
++        items = [
++            ">" + "<a" * 501,
++            "<a" * 50 + "a" * 950,
++        ]
++        for value in items:
++            with self.subTest(value=value):
++                with self.assertRaises(SuspiciousOperation):
++                    strip_tags(value)
++
+     def test_strip_tags_files(self):
+         # Test with more lengthy content (also catching performance regressions)
+         for filename in ("strip_tags1.html", "strip_tags2.txt"):
meta-python/recipes-devtools/python/python3-django_4.2.20.bb +1 -0
index 1bb14aeb71..39451dd07e 100644
@@ -3,6 +3,7 @@ inherit setuptools3
 
 SRC_URI += " \
     file://fix-regression-introduced-when-fixing-CVE-2025-26699.patch \
+    file://CVE-2025-32873.patch \
 "
 
 SRC_URI[sha256sum] = "92bac5b4432a64532abb73b2ac27203f485e40225d2640a7fbef2b62b876e789"
#4 lore raw

PATCH v2 4/8 python3-django: patch CVE-2025-48432

In reply to Ankur Tyagi

Details https://nvd.nist.gov/vuln/detail/CVE-2025-48432

Following patches are needed to avoid cherry-pick conflicts
- CVE-2025-48432-1.patch
- CVE-2025-48432-2.patch
- CVE-2025-48432-4.patch

---
 .../CVE-2025-48432-1.patch                    | 166 +++++++++++++
 .../CVE-2025-48432-2.patch                    | 225 ++++++++++++++++++
 .../CVE-2025-48432-3.patch                    | 165 +++++++++++++
 .../CVE-2025-48432-4.patch                    | 193 +++++++++++++++
 .../CVE-2025-48432-5.patch                    |  76 ++++++
 .../CVE-2025-48432-6.patch                    | 167 +++++++++++++
 .../python/python3-django_4.2.20.bb           |   6 +
 7 files changed, 998 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-1.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-2.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-3.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-4.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-5.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-6.patch
meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-1.patch new file +166 -0
new file mode 100644
index 0000000000..b7a6379660
@@ -0,0 +1,166 @@
+From be9a242fadb72bbb678095b958605d74543f112c Mon Sep 17 00:00:00 2001
+From: Natalia <[email protected]>
+Date: Mon, 19 May 2025 22:45:38 -0300
+Subject: [PATCH] [4.2.x] Refs #26688 -- Added tests for `log_response()`
+ internal helper.
+
+Backport of 897046815944cc9a2da7ed9e8082f45ffe8110e3 from main.
+
+CVE: CVE-2025-48432
+Upstream-Status: Backport [https://github.com/django/django/commit/acbe655a0fa1200d2de31c6020f310ba9aa2f636]
+(cherry picked from commit acbe655a0fa1200d2de31c6020f310ba9aa2f636)
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ tests/logging_tests/tests.py | 121 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 121 insertions(+)
+
+diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py
+index c73a3acd6d..2138a7fe50 100644
+--- a/tests/logging_tests/tests.py
++++ b/tests/logging_tests/tests.py
+@@ -1,6 +1,7 @@
+ import logging
+ from contextlib import contextmanager
+ from io import StringIO
++from unittest import TestCase
+ 
+ from admin_scripts.tests import AdminScriptTestCase
+ 
+@@ -9,6 +10,7 @@ from django.core import mail
+ from django.core.exceptions import DisallowedHost, PermissionDenied, SuspiciousOperation
+ from django.core.files.temp import NamedTemporaryFile
+ from django.core.management import color
++from django.http import HttpResponse
+ from django.http.multipartparser import MultiPartParserError
+ from django.test import RequestFactory, SimpleTestCase, override_settings
+ from django.test.utils import LoggingCaptureMixin
+@@ -19,6 +21,7 @@ from django.utils.log import (
+     RequireDebugFalse,
+     RequireDebugTrue,
+     ServerFormatter,
++    log_response,
+ )
+ from django.views.debug import ExceptionReporter
+ 
+@@ -646,3 +649,121 @@ class LogFormattersTests(SimpleTestCase):
+             self.assertRegex(
+                 logger_output.getvalue(), r"^\[[/:,\w\s\d]+\] %s\n" % log_msg
+             )
++
++
++class LogResponseRealLoggerTests(TestCase):
++    request = RequestFactory().get("/test-path/")
++
++    def assertResponseLogged(self, logger_cm, msg, levelno, status_code, request):
++        self.assertEqual(
++            records_len := len(logger_cm.records),
++            1,
++            f"Unexpected number of records for {logger_cm=} in {levelno=} (expected 1, "
++            f"got {records_len}).",
++        )
++        record = logger_cm.records[0]
++        self.assertEqual(record.getMessage(), msg)
++        self.assertEqual(record.levelno, levelno)
++        self.assertEqual(record.status_code, status_code)
++        self.assertEqual(record.request, request)
++
++    def test_missing_response_raises_attribute_error(self):
++        with self.assertRaises(AttributeError):
++            log_response("No response provided", response=None, request=self.request)
++
++    def test_missing_request_logs_with_none(self):
++        response = HttpResponse(status=403)
++        with self.assertLogs("django.request", level="INFO") as cm:
++            log_response(msg := "Missing request", response=response, request=None)
++        self.assertResponseLogged(cm, msg, logging.WARNING, 403, request=None)
++
++    def test_logs_5xx_as_error(self):
++        response = HttpResponse(status=508)
++        with self.assertLogs("django.request", level="ERROR") as cm:
++            log_response(
++                msg := "Server error occurred", response=response, request=self.request
++            )
++        self.assertResponseLogged(cm, msg, logging.ERROR, 508, self.request)
++
++    def test_logs_4xx_as_warning(self):
++        response = HttpResponse(status=418)
++        with self.assertLogs("django.request", level="WARNING") as cm:
++            log_response(
++                msg := "This is a teapot!", response=response, request=self.request
++            )
++        self.assertResponseLogged(cm, msg, logging.WARNING, 418, self.request)
++
++    def test_logs_2xx_as_info(self):
++        response = HttpResponse(status=201)
++        with self.assertLogs("django.request", level="INFO") as cm:
++            log_response(msg := "OK response", response=response, request=self.request)
++        self.assertResponseLogged(cm, msg, logging.INFO, 201, self.request)
++
++    def test_custom_log_level(self):
++        response = HttpResponse(status=403)
++        with self.assertLogs("django.request", level="DEBUG") as cm:
++            log_response(
++                msg := "Debug level log",
++                response=response,
++                request=self.request,
++                level="debug",
++            )
++        self.assertResponseLogged(cm, msg, logging.DEBUG, 403, self.request)
++
++    def test_logs_only_once_per_response(self):
++        response = HttpResponse(status=500)
++        with self.assertLogs("django.request", level="ERROR") as cm:
++            log_response("First log", response=response, request=self.request)
++            log_response("Second log", response=response, request=self.request)
++        self.assertResponseLogged(cm, "First log", logging.ERROR, 500, self.request)
++
++    def test_exc_info_output(self):
++        response = HttpResponse(status=500)
++        try:
++            raise ValueError("Simulated failure")
++        except ValueError as exc:
++            with self.assertLogs("django.request", level="ERROR") as cm:
++                log_response(
++                    "With exception",
++                    response=response,
++                    request=self.request,
++                    exception=exc,
++                )
++        self.assertResponseLogged(
++            cm, "With exception", logging.ERROR, 500, self.request
++        )
++        self.assertIn("ValueError", "\n".join(cm.output))  # Stack trace included
++
++    def test_format_args_are_applied(self):
++        response = HttpResponse(status=500)
++        with self.assertLogs("django.request", level="ERROR") as cm:
++            log_response(
++                "Something went wrong: %s (%d)",
++                "DB error",
++                42,
++                response=response,
++                request=self.request,
++            )
++        msg = "Something went wrong: DB error (42)"
++        self.assertResponseLogged(cm, msg, logging.ERROR, 500, self.request)
++
++    def test_logs_with_custom_logger(self):
++        handler = logging.StreamHandler(log_stream := StringIO())
++        handler.setFormatter(logging.Formatter("%(levelname)s:%(name)s:%(message)s"))
++
++        custom_logger = logging.getLogger("my.custom.logger")
++        custom_logger.setLevel(logging.DEBUG)
++        custom_logger.addHandler(handler)
++        self.addCleanup(custom_logger.removeHandler, handler)
++
++        response = HttpResponse(status=404)
++        log_response(
++            msg := "Handled by custom logger",
++            response=response,
++            request=self.request,
++            logger=custom_logger,
++        )
++
++        self.assertEqual(
++            f"WARNING:my.custom.logger:{msg}", log_stream.getvalue().strip()
++        )
meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-2.patch new file +225 -0

225 lines not on this page · raw message

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-3.patch new file +165 -0

165 lines not on this page · raw message

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-4.patch new file +193 -0

193 lines not on this page · raw message

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-5.patch new file +76 -0

76 lines not on this page · raw message

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-48432-6.patch new file +167 -0

167 lines not on this page · raw message

meta-python/recipes-devtools/python/python3-django_4.2.20.bb +6 -0
index 39451dd07e..ae99758543 100644
@@ -4,6 +4,12 @@ inherit setuptools3
 SRC_URI += " \
     file://fix-regression-introduced-when-fixing-CVE-2025-26699.patch \
     file://CVE-2025-32873.patch \
+    file://CVE-2025-48432-1.patch \
+    file://CVE-2025-48432-2.patch \
+    file://CVE-2025-48432-3.patch \
+    file://CVE-2025-48432-4.patch \
+    file://CVE-2025-48432-5.patch \
+    file://CVE-2025-48432-6.patch \
 "
 
 SRC_URI[sha256sum] = "92bac5b4432a64532abb73b2ac27203f485e40225d2640a7fbef2b62b876e789"
#5 lore raw

PATCH v2 5/8 python3-django: patch CVE-2025-57833

In reply to Ankur Tyagi

Details https://nvd.nist.gov/vuln/detail/CVE-2025-57833

---
 .../CVE-2025-57833.patch                      | 83 +++++++++++++++++++
 .../python/python3-django_4.2.20.bb           |  1 +
 2 files changed, 84 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-57833.patch
meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-57833.patch new file +83 -0
new file mode 100644
index 0000000000..d04589a149
@@ -0,0 +1,83 @@
+From 5826d1b59363e0208ebbd4a59d3b3ef39cfe14d5 Mon Sep 17 00:00:00 2001
+From: Jake Howard <[email protected]>
+Date: Wed, 13 Aug 2025 14:13:42 +0200
+Subject: [PATCH] [4.2.x] Fixed CVE-2025-57833 -- Protected FilteredRelation
+ against SQL injection in column aliases.
+
+Thanks Eyal Gabay (EyalSec) for the report.
+
+Backport of 51711717098d3f469f795dfa6bc3758b24f69ef7 from main.
+CVE: CVE-2025-57833
+Upstream-Status: Backport [https://github.com/django/django/commit/31334e6965ad136a5e369993b01721499c5d1a92]
+(cherry picked from commit 31334e6965ad136a5e369993b01721499c5d1a92)
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ django/db/models/sql/query.py |  1 +
+ tests/annotations/tests.py    | 24 ++++++++++++++++++++++++
+ 2 files changed, 25 insertions(+)
+
+diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
+index e68fd9efb7..5a1b68507b 100644
+--- a/django/db/models/sql/query.py
++++ b/django/db/models/sql/query.py
+@@ -1620,6 +1620,7 @@ class Query(BaseExpression):
+         return target_clause
+ 
+     def add_filtered_relation(self, filtered_relation, alias):
++        self.check_alias(alias)
+         filtered_relation.alias = alias
+         lookups = dict(get_children_from_q(filtered_relation.condition))
+         relation_lookup_parts, relation_field_parts, _ = self.solve_lookup_type(
+diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
+index e0cdbf1e0b..a8474abc77 100644
+--- a/tests/annotations/tests.py
++++ b/tests/annotations/tests.py
+@@ -12,6 +12,7 @@ from django.db.models import (
+     Exists,
+     ExpressionWrapper,
+     F,
++    FilteredRelation,
+     FloatField,
+     Func,
+     IntegerField,
+@@ -1121,6 +1122,15 @@ class NonAggregateAnnotationTestCase(TestCase):
+         with self.assertRaisesMessage(ValueError, msg):
+             Book.objects.annotate(**{crafted_alias: Value(1)})
+ 
++    def test_alias_filtered_relation_sql_injection(self):
++        crafted_alias = """injected_name" from "annotations_book"; --"""
++        msg = (
++            "Column aliases cannot contain whitespace characters, quotation marks, "
++            "semicolons, or SQL comments."
++        )
++        with self.assertRaisesMessage(ValueError, msg):
++            Book.objects.annotate(**{crafted_alias: FilteredRelation("author")})
++
+     def test_alias_forbidden_chars(self):
+         tests = [
+             'al"ias',
+@@ -1146,6 +1156,11 @@ class NonAggregateAnnotationTestCase(TestCase):
+                 with self.assertRaisesMessage(ValueError, msg):
+                     Book.objects.annotate(**{crafted_alias: Value(1)})
+ 
++                with self.assertRaisesMessage(ValueError, msg):
++                    Book.objects.annotate(
++                        **{crafted_alias: FilteredRelation("authors")}
++                    )
++
+ 
+ class AliasTests(TestCase):
+     @classmethod
+@@ -1418,3 +1433,12 @@ class AliasTests(TestCase):
+         )
+         with self.assertRaisesMessage(ValueError, msg):
+             Book.objects.alias(**{crafted_alias: Value(1)})
++
++    def test_alias_filtered_relation_sql_injection(self):
++        crafted_alias = """injected_name" from "annotations_book"; --"""
++        msg = (
++            "Column aliases cannot contain whitespace characters, quotation marks, "
++            "semicolons, or SQL comments."
++        )
++        with self.assertRaisesMessage(ValueError, msg):
++            Book.objects.alias(**{crafted_alias: FilteredRelation("authors")})
meta-python/recipes-devtools/python/python3-django_4.2.20.bb +1 -0
index ae99758543..caebfe0e46 100644
@@ -10,6 +10,7 @@ SRC_URI += " \
     file://CVE-2025-48432-4.patch \
     file://CVE-2025-48432-5.patch \
     file://CVE-2025-48432-6.patch \
+    file://CVE-2025-57833.patch \
 "
 
 SRC_URI[sha256sum] = "92bac5b4432a64532abb73b2ac27203f485e40225d2640a7fbef2b62b876e789"
#6 lore raw

PATCH v2 6/8 python3-django: patch CVE-2025-59681

In reply to Ankur Tyagi

Details https://nvd.nist.gov/vuln/detail/CVE-2025-59681

---
 .../CVE-2025-59681.patch                      | 174 ++++++++++++++++++
 .../python/python3-django_4.2.20.bb           |   1 +
 2 files changed, 175 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-59681.patch
meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-59681.patch new file +174 -0
new file mode 100644
index 0000000000..681638ac4f
@@ -0,0 +1,174 @@
+From af61d1752df85a1ba1c320282128f2fccdad0107 Mon Sep 17 00:00:00 2001
+From: Mariusz Felisiak <[email protected]>
+Date: Wed, 10 Sep 2025 09:53:52 +0200
+Subject: [PATCH] [4.2.x] Fixed CVE-2025-59681 -- Protected
+ QuerySet.annotate(), alias(), aggregate(), and extra() against SQL injection
+ in column aliases on MySQL/MariaDB.
+
+Thanks sw0rd1ight for the report.
+
+Follow up to 93cae5cb2f9a4ef1514cf1a41f714fef08005200.
+
+Backport of 41b43c74bda19753c757036673ea9db74acf494a from main.
+
+CVE: CVE-2025-59681
+Upstream-Status: Backport [https://github.com/django/django/commit/38d9ef8c7b5cb6ef51b933e51a20e0e0063f33d5]
+(cherry picked from commit 38d9ef8c7b5cb6ef51b933e51a20e0e0063f33d5)
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ django/db/models/sql/query.py             |  8 ++++----
+ tests/aggregation/tests.py                |  4 ++--
+ tests/annotations/tests.py                | 23 ++++++++++++-----------
+ tests/expressions/test_queryset_values.py |  8 ++++----
+ tests/queries/tests.py                    |  4 ++--
+ 5 files changed, 24 insertions(+), 23 deletions(-)
+
+diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
+index 5a1b68507b..3b8071eab4 100644
+--- a/django/db/models/sql/query.py
++++ b/django/db/models/sql/query.py
+@@ -46,9 +46,9 @@ from django.utils.tree import Node
+ 
+ __all__ = ["Query", "RawQuery"]
+ 
+-# Quotation marks ('"`[]), whitespace characters, semicolons, or inline
++# Quotation marks ('"`[]), whitespace characters, semicolons, hashes, or inline
+ # SQL comments are forbidden in column aliases.
+-FORBIDDEN_ALIAS_PATTERN = _lazy_re_compile(r"['`\"\]\[;\s]|--|/\*|\*/")
++FORBIDDEN_ALIAS_PATTERN = _lazy_re_compile(r"['`\"\]\[;\s]|#|--|/\*|\*/")
+ 
+ # Inspired from
+ # https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
+@@ -1123,8 +1123,8 @@ class Query(BaseExpression):
+     def check_alias(self, alias):
+         if FORBIDDEN_ALIAS_PATTERN.search(alias):
+             raise ValueError(
+-                "Column aliases cannot contain whitespace characters, quotation marks, "
+-                "semicolons, or SQL comments."
++                "Column aliases cannot contain whitespace characters, hashes, "
++                "quotation marks, semicolons, or SQL comments."
+             )
+ 
+     def add_annotation(self, annotation, alias, select=True):
+diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
+index 48266d9774..277c0507f7 100644
+--- a/tests/aggregation/tests.py
++++ b/tests/aggregation/tests.py
+@@ -2090,8 +2090,8 @@ class AggregateTestCase(TestCase):
+     def test_alias_sql_injection(self):
+         crafted_alias = """injected_name" from "aggregation_author"; --"""
+         msg = (
+-            "Column aliases cannot contain whitespace characters, quotation marks, "
+-            "semicolons, or SQL comments."
++            "Column aliases cannot contain whitespace characters, hashes, quotation "
++            "marks, semicolons, or SQL comments."
+         )
+         with self.assertRaisesMessage(ValueError, msg):
+             Author.objects.aggregate(**{crafted_alias: Avg("age")})
+diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
+index a8474abc77..4879f19a78 100644
+--- a/tests/annotations/tests.py
++++ b/tests/annotations/tests.py
+@@ -1116,8 +1116,8 @@ class NonAggregateAnnotationTestCase(TestCase):
+     def test_alias_sql_injection(self):
+         crafted_alias = """injected_name" from "annotations_book"; --"""
+         msg = (
+-            "Column aliases cannot contain whitespace characters, quotation marks, "
+-            "semicolons, or SQL comments."
++            "Column aliases cannot contain whitespace characters, hashes, quotation "
++            "marks, semicolons, or SQL comments."
+         )
+         with self.assertRaisesMessage(ValueError, msg):
+             Book.objects.annotate(**{crafted_alias: Value(1)})
+@@ -1125,8 +1125,8 @@ class NonAggregateAnnotationTestCase(TestCase):
+     def test_alias_filtered_relation_sql_injection(self):
+         crafted_alias = """injected_name" from "annotations_book"; --"""
+         msg = (
+-            "Column aliases cannot contain whitespace characters, quotation marks, "
+-            "semicolons, or SQL comments."
++            "Column aliases cannot contain whitespace characters, hashes, quotation "
++            "marks, semicolons, or SQL comments."
+         )
+         with self.assertRaisesMessage(ValueError, msg):
+             Book.objects.annotate(**{crafted_alias: FilteredRelation("author")})
+@@ -1143,13 +1143,14 @@ class NonAggregateAnnotationTestCase(TestCase):
+             "ali/*as",
+             "alias*/",
+             "alias;",
+-            # [] are used by MSSQL.
++            # [] and # are used by MSSQL.
+             "alias[",
+             "alias]",
++            "ali#as",
+         ]
+         msg = (
+-            "Column aliases cannot contain whitespace characters, quotation marks, "
+-            "semicolons, or SQL comments."
++            "Column aliases cannot contain whitespace characters, hashes, quotation "
++            "marks, semicolons, or SQL comments."
+         )
+         for crafted_alias in tests:
+             with self.subTest(crafted_alias):
+@@ -1428,8 +1429,8 @@ class AliasTests(TestCase):
+     def test_alias_sql_injection(self):
+         crafted_alias = """injected_name" from "annotations_book"; --"""
+         msg = (
+-            "Column aliases cannot contain whitespace characters, quotation marks, "
+-            "semicolons, or SQL comments."
++            "Column aliases cannot contain whitespace characters, hashes, quotation "
++            "marks, semicolons, or SQL comments."
+         )
+         with self.assertRaisesMessage(ValueError, msg):
+             Book.objects.alias(**{crafted_alias: Value(1)})
+@@ -1437,8 +1438,8 @@ class AliasTests(TestCase):
+     def test_alias_filtered_relation_sql_injection(self):
+         crafted_alias = """injected_name" from "annotations_book"; --"""
+         msg = (
+-            "Column aliases cannot contain whitespace characters, quotation marks, "
+-            "semicolons, or SQL comments."
++            "Column aliases cannot contain whitespace characters, hashes, quotation "
++            "marks, semicolons, or SQL comments."
+         )
+         with self.assertRaisesMessage(ValueError, msg):
+             Book.objects.alias(**{crafted_alias: FilteredRelation("authors")})
+diff --git a/tests/expressions/test_queryset_values.py b/tests/expressions/test_queryset_values.py
+index 47bd1358de..080ee06183 100644
+--- a/tests/expressions/test_queryset_values.py
++++ b/tests/expressions/test_queryset_values.py
+@@ -37,8 +37,8 @@ class ValuesExpressionsTests(TestCase):
+     def test_values_expression_alias_sql_injection(self):
+         crafted_alias = """injected_name" from "expressions_company"; --"""
+         msg = (
+-            "Column aliases cannot contain whitespace characters, quotation marks, "
+-            "semicolons, or SQL comments."
++            "Column aliases cannot contain whitespace characters, hashes, quotation "
++            "marks, semicolons, or SQL comments."
+         )
+         with self.assertRaisesMessage(ValueError, msg):
+             Company.objects.values(**{crafted_alias: F("ceo__salary")})
+@@ -47,8 +47,8 @@ class ValuesExpressionsTests(TestCase):
+     def test_values_expression_alias_sql_injection_json_field(self):
+         crafted_alias = """injected_name" from "expressions_company"; --"""
+         msg = (
+-            "Column aliases cannot contain whitespace characters, quotation marks, "
+-            "semicolons, or SQL comments."
++            "Column aliases cannot contain whitespace characters, hashes, quotation "
++            "marks, semicolons, or SQL comments."
+         )
+         with self.assertRaisesMessage(ValueError, msg):
+             JSONFieldModel.objects.values(f"data__{crafted_alias}")
+diff --git a/tests/queries/tests.py b/tests/queries/tests.py
+index a6a2b252eb..b8488fef75 100644
+--- a/tests/queries/tests.py
++++ b/tests/queries/tests.py
+@@ -1943,8 +1943,8 @@ class Queries5Tests(TestCase):
+     def test_extra_select_alias_sql_injection(self):
+         crafted_alias = """injected_name" from "queries_note"; --"""
+         msg = (
+-            "Column aliases cannot contain whitespace characters, quotation marks, "
+-            "semicolons, or SQL comments."
++            "Column aliases cannot contain whitespace characters, hashes, quotation "
++            "marks, semicolons, or SQL comments."
+         )
+         with self.assertRaisesMessage(ValueError, msg):
+             Note.objects.extra(select={crafted_alias: "1"})
meta-python/recipes-devtools/python/python3-django_4.2.20.bb +1 -0
index caebfe0e46..443b4dbbfc 100644
@@ -11,6 +11,7 @@ SRC_URI += " \
     file://CVE-2025-48432-5.patch \
     file://CVE-2025-48432-6.patch \
     file://CVE-2025-57833.patch \
+    file://CVE-2025-59681.patch \
 "
 
 SRC_URI[sha256sum] = "92bac5b4432a64532abb73b2ac27203f485e40225d2640a7fbef2b62b876e789"
#7 lore raw

PATCH v2 7/8 python3-django: patch CVE-2025-59682

In reply to Ankur Tyagi

Details https://nvd.nist.gov/vuln/detail/CVE-2025-59682

---
 .../CVE-2025-59682.patch                      | 72 +++++++++++++++++++
 .../python/python3-django_4.2.20.bb           |  1 +
 2 files changed, 73 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-59682.patch
meta-python/recipes-devtools/python/python3-django-4.2.20/CVE-2025-59682.patch new file +72 -0
new file mode 100644
index 0000000000..72f566a0e1
@@ -0,0 +1,72 @@
+From c757b620cd8099d17e202c0f5582bbab5564056c Mon Sep 17 00:00:00 2001
+From: Sarah Boyce <[email protected]>
+Date: Tue, 16 Sep 2025 17:13:36 +0200
+Subject: [PATCH] [4.2.x] Fixed CVE-2025-59682 -- Fixed potential partial
+ directory-traversal via archive.extract().
+
+Thanks stackered for the report.
+
+Follow up to 05413afa8c18cdb978fcdf470e09f7a12b234a23.
+
+Backport of 924a0c092e65fa2d0953fd1855d2dc8786d94de2 from main.
+
+CVE: CVE-2025-59682
+Upstream-Status: Backport [https://github.com/django/django/commit/9504bbaa392c9fe37eee9291f5b4c29eb6037619]
+(cherry picked from commit 9504bbaa392c9fe37eee9291f5b4c29eb6037619)
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ django/utils/archive.py           |  6 +++++-
+ tests/utils_tests/test_archive.py | 19 +++++++++++++++++++
+ 2 files changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/django/utils/archive.py b/django/utils/archive.py
+index 71ec2d0015..e8af690e27 100644
+--- a/django/utils/archive.py
++++ b/django/utils/archive.py
+@@ -144,7 +144,11 @@ class BaseArchive:
+     def target_filename(self, to_path, name):
+         target_path = os.path.abspath(to_path)
+         filename = os.path.abspath(os.path.join(target_path, name))
+-        if not filename.startswith(target_path):
++        try:
++            if os.path.commonpath([target_path, filename]) != target_path:
++                raise SuspiciousOperation("Archive contains invalid path: '%s'" % name)
++        except ValueError:
++            # Different drives on Windows raises ValueError.
+             raise SuspiciousOperation("Archive contains invalid path: '%s'" % name)
+         return filename
+ 
+diff --git a/tests/utils_tests/test_archive.py b/tests/utils_tests/test_archive.py
+index 8cd107063f..8063dafb65 100644
+--- a/tests/utils_tests/test_archive.py
++++ b/tests/utils_tests/test_archive.py
+@@ -3,6 +3,7 @@ import stat
+ import sys
+ import tempfile
+ import unittest
++import zipfile
+ 
+ from django.core.exceptions import SuspiciousOperation
+ from django.test import SimpleTestCase
+@@ -96,3 +97,21 @@ class TestArchiveInvalid(SimpleTestCase):
+             with self.subTest(entry), tempfile.TemporaryDirectory() as tmpdir:
+                 with self.assertRaisesMessage(SuspiciousOperation, msg % invalid_path):
+                     archive.extract(os.path.join(archives_dir, entry), tmpdir)
++
++    def test_extract_function_traversal_startswith(self):
++        with tempfile.TemporaryDirectory() as tmpdir:
++            base = os.path.abspath(tmpdir)
++            tarfile_handle = tempfile.NamedTemporaryFile(suffix=".zip", delete=False)
++            tar_path = tarfile_handle.name
++            tarfile_handle.close()
++            self.addCleanup(os.remove, tar_path)
++
++            malicious_member = os.path.join(base + "abc", "evil.txt")
++            with zipfile.ZipFile(tar_path, "w") as zf:
++                zf.writestr(malicious_member, "evil\n")
++                zf.writestr("test.txt", "data\n")
++
++            with self.assertRaisesMessage(
++                SuspiciousOperation, "Archive contains invalid path"
++            ):
++                archive.extract(tar_path, base)
meta-python/recipes-devtools/python/python3-django_4.2.20.bb +1 -0
index 443b4dbbfc..964b982fda 100644
@@ -12,6 +12,7 @@ SRC_URI += " \
     file://CVE-2025-48432-6.patch \
     file://CVE-2025-57833.patch \
     file://CVE-2025-59681.patch \
+    file://CVE-2025-59682.patch \
 "
 
 SRC_URI[sha256sum] = "92bac5b4432a64532abb73b2ac27203f485e40225d2640a7fbef2b62b876e789"
#8 lore raw

Re: [oe][meta-python][scarthgap][PATCH v2 7/8] python3-django: patch CVE-2025-59682

Can we update straight to 4.2.25 instead that only has all these CVE fixes and a few bug fixes?

Quoted 132 lines · Ankur Tyagi via lists.openembedded.org

Details https://nvd.nist.gov/vuln/detail/CVE-2025-59682

---
 .../CVE-2025-59682.patch                      | 72
+++++++++++++++++++
 .../python/python3-django_4.2.20.bb           |  1 +

 2 files changed, 73 insertions(+)

 create mode 100644 meta-python/recipes-devtools/python/python3- django-4.2.20/CVE-2025-59682.patch

(quoted diff) +0 -0

4.2.20/CVE-2025-59682.patch b/meta-python/recipes- devtools/python/python3-django-4.2.20/CVE-2025-59682.patch new file mode 100644
index 0000000000..72f566a0e1

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +0 -0

2025-59682.patch

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +1 -0
@@ -0,0 +1,72 @@
+From c757b620cd8099d17e202c0f5582bbab5564056c Mon Sep 17 00:00:00

2001

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +3 -0
+From: Sarah Boyce <[email protected]>
+Date: Tue, 16 Sep 2025 17:13:36 +0200
+Subject: [PATCH] [4.2.x] Fixed CVE-2025-59682 -- Fixed potential

partial
+ directory-traversal via archive.extract().

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +9 -0
+
+Thanks stackered for the report.
+
+Follow up to 05413afa8c18cdb978fcdf470e09f7a12b234a23.
+
+Backport of 924a0c092e65fa2d0953fd1855d2dc8786d94de2 from main.
+
+CVE: CVE-2025-59682
+Upstream-Status: Backport

[https://github.com/django/django/commit/9504bbaa392c9fe37eee9291f5b4
c29eb6037619]

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +18 -0
+(cherry picked from commit 9504bbaa392c9fe37eee9291f5b4c29eb6037619)
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ django/utils/archive.py           |  6 +++++-
+ tests/utils_tests/test_archive.py | 19 +++++++++++++++++++
+ 2 files changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/django/utils/archive.py b/django/utils/archive.py
+index 71ec2d0015..e8af690e27 100644
+--- a/django/utils/archive.py
++++ b/django/utils/archive.py
+@@ -144,7 +144,11 @@ class BaseArchive:
+     def target_filename(self, to_path, name):
+         target_path = os.path.abspath(to_path)
+         filename = os.path.abspath(os.path.join(target_path, name))
+-        if not filename.startswith(target_path):
++        try:
++            if os.path.commonpath([target_path, filename]) !=

target_path:
++                raise SuspiciousOperation("Archive contains invalid
path: '%s'" % name)
++        except ValueError:
++            # Different drives on Windows raises ValueError. +             raise SuspiciousOperation("Archive contains invalid
path: '%s'" % name)
+         return filename
+
+diff --git a/tests/utils_tests/test_archive.py b/tests/utils_tests/test_archive.py
+index 8cd107063f..8063dafb65 100644
+--- a/tests/utils_tests/test_archive.py
++++ b/tests/utils_tests/test_archive.py
+@@ -3,6 +3,7 @@ import stat
+ import sys
+ import tempfile
+ import unittest
++import zipfile
+
+ from django.core.exceptions import SuspiciousOperation
+ from django.test import SimpleTestCase
+@@ -96,3 +97,21 @@ class TestArchiveInvalid(SimpleTestCase):
+             with self.subTest(entry), tempfile.TemporaryDirectory() as tmpdir:
+                 with self.assertRaisesMessage(SuspiciousOperation, msg % invalid_path):
+                     archive.extract(os.path.join(archives_dir, entry), tmpdir)
++
++    def test_extract_function_traversal_startswith(self):
++        with tempfile.TemporaryDirectory() as tmpdir:
++            base = os.path.abspath(tmpdir)
++            tarfile_handle = tempfile.NamedTemporaryFile(suffix=".zip", delete=False) ++            tar_path = tarfile_handle.name
++            tarfile_handle.close()
++            self.addCleanup(os.remove, tar_path)
++
++            malicious_member = os.path.join(base + "abc", "evil.txt")
++            with zipfile.ZipFile(tar_path, "w") as zf:
++                zf.writestr(malicious_member, "evil\n") ++                zf.writestr("test.txt", "data\n")
++
++            with self.assertRaisesMessage(
++                SuspiciousOperation, "Archive contains invalid path"
++            ):
++                archive.extract(tar_path, base)

(quoted diff) +0 -0

django_4.2.20.bb b/meta-python/recipes-devtools/python/python3- django_4.2.20.bb
index 443b4dbbfc..964b982fda 100644

meta-python/recipes-devtools/python/python3-django_4.2.20.bb +1 -0
@@ -12,6 +12,7 @@ SRC_URI += " \
      file://CVE-2025-48432-6.patch \
      file://CVE-2025-57833.patch \
      file://CVE-2025-59681.patch \
+    file://CVE-2025-59682.patch \

 "

 SRC_URI[sha256sum] = "92bac5b4432a64532abb73b2ac27203f485e40225d2640a7fbef2b62b876e789"

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#120908):
https://lists.openembedded.org/g/openembedded-devel/message/120908
Mute This Topic: https://lists.openembedded.org/mt/115902367/3616702
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-devel/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#9 lore raw

Re: [oe][meta-python][scarthgap][PATCH v2 7/8] python3-django: patch CVE-2025-59682

Quoted 3 lines · Anuj Mittal via lists.openembedded.org

Can we update straight to 4.2.25 instead that only has all these CVE fixes and a few bug fixes?

Agree, please drop following patches for v4.x and I'll submit upgrade to 4.2.25 separately
https://lists.openembedded.org/g/openembedded-devel/message/120902
https://lists.openembedded.org/g/openembedded-devel/message/120903
https://lists.openembedded.org/g/openembedded-devel/message/120904
https://lists.openembedded.org/g/openembedded-devel/message/120905
https://lists.openembedded.org/g/openembedded-devel/message/120906
https://lists.openembedded.org/g/openembedded-devel/message/120907
https://lists.openembedded.org/g/openembedded-devel/message/120908

Quoted 135 lines
Quoted 120 lines · Ankur Tyagi via lists.openembedded.org

Details https://nvd.nist.gov/vuln/detail/CVE-2025-59682

---
 .../CVE-2025-59682.patch                      | 72
+++++++++++++++++++
 .../python/python3-django_4.2.20.bb           |  1 +
 2 files changed, 73 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-

django-4.2.20/CVE-2025-59682.patch

(quoted diff) +0 -0

4.2.20/CVE-2025-59682.patch b/meta-python/recipes- devtools/python/python3-django-4.2.20/CVE-2025-59682.patch new file mode 100644
index 0000000000..72f566a0e1

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +0 -0

2025-59682.patch

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +1 -0
@@ -0,0 +1,72 @@
+From c757b620cd8099d17e202c0f5582bbab5564056c Mon Sep 17 00:00:00

2001

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +3 -0
+From: Sarah Boyce <[email protected]>
+Date: Tue, 16 Sep 2025 17:13:36 +0200
+Subject: [PATCH] [4.2.x] Fixed CVE-2025-59682 -- Fixed potential

partial
+ directory-traversal via archive.extract().

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +9 -0
+
+Thanks stackered for the report.
+
+Follow up to 05413afa8c18cdb978fcdf470e09f7a12b234a23.
+
+Backport of 924a0c092e65fa2d0953fd1855d2dc8786d94de2 from main.
+
+CVE: CVE-2025-59682
+Upstream-Status: Backport

[https://github.com/django/django/commit/9504bbaa392c9fe37eee9291f5b4
c29eb6037619]

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +18 -0
+(cherry picked from commit 9504bbaa392c9fe37eee9291f5b4c29eb6037619)
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ django/utils/archive.py           |  6 +++++-
+ tests/utils_tests/test_archive.py | 19 +++++++++++++++++++
+ 2 files changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/django/utils/archive.py b/django/utils/archive.py
+index 71ec2d0015..e8af690e27 100644
+--- a/django/utils/archive.py
++++ b/django/utils/archive.py
+@@ -144,7 +144,11 @@ class BaseArchive:
+     def target_filename(self, to_path, name):
+         target_path = os.path.abspath(to_path)
+         filename = os.path.abspath(os.path.join(target_path, name))
+-        if not filename.startswith(target_path):
++        try:
++            if os.path.commonpath([target_path, filename]) !=

target_path:
++ raise SuspiciousOperation("Archive contains invalid
path: '%s'" % name)
++ except ValueError:
++ # Different drives on Windows raises ValueError.
+ raise SuspiciousOperation("Archive contains invalid
path: '%s'" % name)

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +3 -0
+         return filename
+
+diff --git a/tests/utils_tests/test_archive.py

b/tests/utils_tests/test_archive.py

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +13 -0
+index 8cd107063f..8063dafb65 100644
+--- a/tests/utils_tests/test_archive.py
++++ b/tests/utils_tests/test_archive.py
+@@ -3,6 +3,7 @@ import stat
+ import sys
+ import tempfile
+ import unittest
++import zipfile
+
+ from django.core.exceptions import SuspiciousOperation
+ from django.test import SimpleTestCase
+@@ -96,3 +97,21 @@ class TestArchiveInvalid(SimpleTestCase):
+             with self.subTest(entry), tempfile.TemporaryDirectory()

as tmpdir:
+ with self.assertRaisesMessage(SuspiciousOperation,
msg % invalid_path):
+ archive.extract(os.path.join(archives_dir,
entry), tmpdir)
++
++ def test_extract_function_traversal_startswith(self):
++ with tempfile.TemporaryDirectory() as tmpdir:
++ base = os.path.abspath(tmpdir)
++ tarfile_handle =
tempfile.NamedTemporaryFile(suffix=".zip", delete=False)

++            tar_path = tarfile_handle.name
++            tarfile_handle.close()
++            self.addCleanup(os.remove, tar_path)

++
++ malicious_member = os.path.join(base + "abc",
"evil.txt")
++ with zipfile.ZipFile(tar_path, "w") as zf:
++ zf.writestr(malicious_member, "evil\n")
++ zf.writestr("test.txt", "data\n")
++
++ with self.assertRaisesMessage(
++ SuspiciousOperation, "Archive contains invalid
path"
++ ):
++ archive.extract(tar_path, base)

(quoted diff) +0 -0

django_4.2.20.bb b/meta-python/recipes-devtools/python/python3- django_4.2.20.bb
index 443b4dbbfc..964b982fda 100644

meta-python/recipes-devtools/python/python3-django_4.2.20.bb +1 -0
@@ -12,6 +12,7 @@ SRC_URI += " \
     file://CVE-2025-48432-6.patch \
     file://CVE-2025-57833.patch \
     file://CVE-2025-59681.patch \
+    file://CVE-2025-59682.patch \
 "
 
 SRC_URI[sha256sum] =
Quoted 3 lines

"92bac5b4432a64532abb73b2ac27203f485e40225d2640a7fbef2b62b876e789"

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#121198): https://lists.openembedded.org/g/openembedded-devel/message/121198
Mute This Topic: https://lists.openembedded.org/mt/115902367/3619737
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

A message that is not in the archive (sent off-list or not yet received): [email protected]

#11 lore raw

Re: [oe][meta-python][scarthgap][PATCH v2 7/8] python3-django: patch CVE-2025-59682

Quoted 7 lines · Ankur Tyagi via lists.openembedded.org
Quoted 3 lines · Anuj Mittal via lists.openembedded.org

Can we update straight to 4.2.25 instead that only has all these CVE fixes and a few bug fixes?

Quoted 10 lines

Agree, please drop following patches for v4.x and I'll submit upgrade to 4.2.25 separately
https://lists.openembedded.org/g/openembedded-devel/message/120902
https://lists.openembedded.org/g/openembedded-devel/message/120903
https://lists.openembedded.org/g/openembedded-devel/message/120904
https://lists.openembedded.org/g/openembedded-devel/message/120905
https://lists.openembedded.org/g/openembedded-devel/message/120906
https://lists.openembedded.org/g/openembedded-devel/message/120907
https://lists.openembedded.org/g/openembedded-devel/message/120908

Starting with v4.2.21 [1], setuptools configuration migrated from setup.py/setup.cfg to pyproject.toml
And [2] updated setuptools version causing following build error:

ERROR Missing dependencies:

    setuptools>=75.8.1; python_version >= "3.9"

[1] https://github.com/django/django/commit/afe52d89c4f42870622a4bb161ab5f4d4913aac5
[2] https://github.com/django/django/commit/3456eee4a3a00dc14e72d4f7d6eecc15ed9571e7

Any ideas to try?

Quoted 138 lines
Quoted 122 lines
Quoted 119 lines · Ankur Tyagi via lists.openembedded.org

Details https://nvd.nist.gov/vuln/detail/CVE-2025-59682

---
 .../CVE-2025-59682.patch                      | 72
+++++++++++++++++++
 .../python/python3-django_4.2.20.bb           |  1 +
 2 files changed, 73 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-

django-4.2.20/CVE-2025-59682.patch

(quoted diff) +0 -0

4.2.20/CVE-2025-59682.patch b/meta-python/recipes- devtools/python/python3-django-4.2.20/CVE-2025-59682.patch new file mode 100644
index 0000000000..72f566a0e1

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +0 -0

2025-59682.patch

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +1 -0
@@ -0,0 +1,72 @@
+From c757b620cd8099d17e202c0f5582bbab5564056c Mon Sep 17 00:00:00

2001

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +3 -0
+From: Sarah Boyce <[email protected]>
+Date: Tue, 16 Sep 2025 17:13:36 +0200
+Subject: [PATCH] [4.2.x] Fixed CVE-2025-59682 -- Fixed potential

partial
+ directory-traversal via archive.extract().

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +9 -0
+
+Thanks stackered for the report.
+
+Follow up to 05413afa8c18cdb978fcdf470e09f7a12b234a23.
+
+Backport of 924a0c092e65fa2d0953fd1855d2dc8786d94de2 from main.
+
+CVE: CVE-2025-59682
+Upstream-Status: Backport

[https://github.com/django/django/commit/9504bbaa392c9fe37eee9291f5b4
c29eb6037619]

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +18 -0
+(cherry picked from commit 9504bbaa392c9fe37eee9291f5b4c29eb6037619)
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ django/utils/archive.py           |  6 +++++-
+ tests/utils_tests/test_archive.py | 19 +++++++++++++++++++
+ 2 files changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/django/utils/archive.py b/django/utils/archive.py
+index 71ec2d0015..e8af690e27 100644
+--- a/django/utils/archive.py
++++ b/django/utils/archive.py
+@@ -144,7 +144,11 @@ class BaseArchive:
+     def target_filename(self, to_path, name):
+         target_path = os.path.abspath(to_path)
+         filename = os.path.abspath(os.path.join(target_path, name))
+-        if not filename.startswith(target_path):
++        try:
++            if os.path.commonpath([target_path, filename]) !=

target_path:
++ raise SuspiciousOperation("Archive contains invalid
path: '%s'" % name)
++ except ValueError:
++ # Different drives on Windows raises ValueError.
+ raise SuspiciousOperation("Archive contains invalid
path: '%s'" % name)

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +3 -0
+         return filename
+
+diff --git a/tests/utils_tests/test_archive.py

b/tests/utils_tests/test_archive.py

meta-python/recipes-devtools/python/python3-django-4.2.20/CVE- new file +13 -0
+index 8cd107063f..8063dafb65 100644
+--- a/tests/utils_tests/test_archive.py
++++ b/tests/utils_tests/test_archive.py
+@@ -3,6 +3,7 @@ import stat
+ import sys
+ import tempfile
+ import unittest
++import zipfile
+
+ from django.core.exceptions import SuspiciousOperation
+ from django.test import SimpleTestCase
+@@ -96,3 +97,21 @@ class TestArchiveInvalid(SimpleTestCase):
+             with self.subTest(entry), tempfile.TemporaryDirectory()

as tmpdir:
+ with self.assertRaisesMessage(SuspiciousOperation,
msg % invalid_path):
+ archive.extract(os.path.join(archives_dir,
entry), tmpdir)
++
++ def test_extract_function_traversal_startswith(self):
++ with tempfile.TemporaryDirectory() as tmpdir:
++ base = os.path.abspath(tmpdir)
++ tarfile_handle =
tempfile.NamedTemporaryFile(suffix=".zip", delete=False)

++            tar_path = tarfile_handle.name
++            tarfile_handle.close()
++            self.addCleanup(os.remove, tar_path)

++
++ malicious_member = os.path.join(base + "abc",
"evil.txt")
++ with zipfile.ZipFile(tar_path, "w") as zf:
++ zf.writestr(malicious_member, "evil\n")
++ zf.writestr("test.txt", "data\n")
++
++ with self.assertRaisesMessage(
++ SuspiciousOperation, "Archive contains invalid
path"
++ ):
++ archive.extract(tar_path, base)

(quoted diff) +0 -0

django_4.2.20.bb b/meta-python/recipes-devtools/python/python3- django_4.2.20.bb
index 443b4dbbfc..964b982fda 100644

meta-python/recipes-devtools/python/python3-django_4.2.20.bb +1 -0
@@ -12,6 +12,7 @@ SRC_URI += " \
     file://CVE-2025-48432-6.patch \
     file://CVE-2025-57833.patch \
     file://CVE-2025-59681.patch \
+    file://CVE-2025-59682.patch \
 "
 
Quoted 7 lines
Quoted 4 lines
meta-python/recipes-devtools/python/python3-django_4.2.20.bb +0 -0
 SRC_URI[sha256sum] =

"92bac5b4432a64532abb73b2ac27203f485e40225d2640a7fbef2b62b876e789"

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#121203): https://lists.openembedded.org/g/openembedded-devel/message/121203
Mute This Topic: https://lists.openembedded.org/mt/115902367/3619737
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#12 lore raw

PATCH v2 8/8 python3-django: upgrade 5.0.11 -> 5.0.14

In reply to Ankur Tyagi

Includes fix for CVE-2025-26699 and CVE-2025-27556

Release notes:
https://docs.djangoproject.com/en/dev/releases/5.0.12/
https://docs.djangoproject.com/en/dev/releases/5.0.13/
https://docs.djangoproject.com/en/dev/releases/5.0.14/

---
 .../{python3-django_5.0.11.bb => python3-django_5.0.14.bb}      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename meta-python/recipes-devtools/python/{python3-django_5.0.11.bb => python3-django_5.0.14.bb} (56%)
meta-python/recipes-devtools/python/python3-django_5.0.14.bb renamed from meta-python/recipes-devtools/python/python3-django_5.0.11.bb +1 -1
similarity index 56%
rename from meta-python/recipes-devtools/python/python3-django_5.0.11.bb
rename to meta-python/recipes-devtools/python/python3-django_5.0.14.bb
index 5060f3c9ad..b95a5067fb 100644
@@ -1,7 +1,7 @@
 require python-django.inc
 inherit setuptools3
 
-SRC_URI[sha256sum] = "e7d98fa05ce09cb3e8d5ad6472fb602322acd1740bfdadc29c8404182d664f65"
+SRC_URI[sha256sum] = "29019a5763dbd48da1720d687c3522ef40d1c61be6fb2fad27ed79e9f655bc11"
 
 RDEPENDS:${PN} += "\
     python3-sqlparse \