Skip to contentSkip to conversation

python3-django: upgrade 6.0.7 -> 6.0.8

PATCH New [email protected] 1 participant 10 messages Sep 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/10 python3-django: upgrade 6.0.7 -> 6.0.8

From: Ankur Tyagi <[email protected]>

Also revert bump in the minimum setuptools version.

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

---
 ...ped-minimum-setuptools-version-to-83.patch | 42 +++++++++++++++++++
 ...jango_6.0.7.bb => python3-django_6.0.8.bb} |  3 +-
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-django/0001-Revert-Bumped-minimum-setuptools-version-to-83.patch
 rename meta-python/recipes-devtools/python/{python3-django_6.0.7.bb => python3-django_6.0.8.bb} (62%)
meta-python/recipes-devtools/python/python3-django/0001-Revert-Bumped-minimum-setuptools-version-to-83.patch new file +42 -0
new file mode 100644
index 0000000000..5913287038
@@ -0,0 +1,42 @@
+From 2c7d43e13909886bbb0b6b5dcd5e718c67818031 Mon Sep 17 00:00:00 2001
+From: Ankur Tyagi <[email protected]>
+Date: Mon, 14 Sep 2026 11:37:53 +1200
+Subject: [PATCH] Revert "Bumped minimum setuptools version to 83."
+
+This reverts commit 8362cdc7efc9c881fdba48ce19e89b9194de7c46.
+
+Upstream precautionarily bumped minimum setuptools version[1]
+Revert the change to allow building new versions of Django.
+
+[1]https://github.com/django/django/pull/21691
+
+Upstream-Status: Inappropriate [oe-specific]
+---
+ docs/intro/reusable-apps.txt | 2 +-
+ pyproject.toml               | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/docs/intro/reusable-apps.txt b/docs/intro/reusable-apps.txt
+index 41122dff9a..bb33dc0197 100644
+--- a/docs/intro/reusable-apps.txt
++++ b/docs/intro/reusable-apps.txt
+@@ -211,7 +211,7 @@ this. For a small app like polls, this process isn't too difficult.
+        :caption: ``django-polls/pyproject.toml``
+ 
+        [build-system]
+-       requires = ["setuptools>83"]
++       requires = ["setuptools>=77.0.3"]
+        build-backend = "setuptools.build_meta"
+ 
+        [project]
+diff --git a/pyproject.toml b/pyproject.toml
+index 1c5f5fbbe0..2b8ddbf314 100644
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -1,5 +1,5 @@
+ [build-system]
+-requires = ["setuptools>=83"]
++requires = ["setuptools>=77.0.3"]
+ build-backend = "setuptools.build_meta"
+ 
+ [project]
meta-python/recipes-devtools/python/python3-django_6.0.8.bb renamed from meta-python/recipes-devtools/python/python3-django_6.0.7.bb +2 -1
similarity index 62%
rename from meta-python/recipes-devtools/python/python3-django_6.0.7.bb
rename to meta-python/recipes-devtools/python/python3-django_6.0.8.bb
index 4542485154..f8a5d6962c 100644
@@ -1,7 +1,8 @@
 require python3-django.inc
 inherit python_setuptools_build_meta
 
-SRC_URI[sha256sum] = "2998503fc083124fb58037084bfa00de323c7c743f05f1b4284e77bff0ab8890"
+SRC_URI[sha256sum] = "cb0bd962d27fc866f3c514b20aae6a7df56ec80b488f9899da46d675cd051526"
+SRC_URI += "file://0001-Revert-Bumped-minimum-setuptools-version-to-83.patch"
 
 # Set DEFAULT_PREFERENCE so that the LTS version of django is built by
 # default. To build the 6.x branch,
#1 lore raw

PATCH 2/10 python3-django: upgrade 5.2.16 -> 5.2.17

From: Ankur Tyagi <[email protected]>

Also revert bump in the minimum setuptools version.

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

---
 .../recipes-devtools/python/python3-django_5.2.16.bb       | 5 -----
 .../recipes-devtools/python/python3-django_5.2.17.bb       | 7 +++++++
 2 files changed, 7 insertions(+), 5 deletions(-)
 delete mode 100644 meta-python/recipes-devtools/python/python3-django_5.2.16.bb
 create mode 100644 meta-python/recipes-devtools/python/python3-django_5.2.17.bb
meta-python/recipes-devtools/python/python3-django_5.2.16.bb deleted +0 -5
deleted file mode 100644
index 2629ff3714..0000000000
@@ -1,5 +0,0 @@
-require python3-django.inc
-inherit python_setuptools_build_meta
-
-SRC_URI += "file://0001-fix-test_msgfmt_error_including_non_ascii-test.patch"
-SRC_URI[sha256sum] = "59ea02020c3136fce14bef0bbece21a10a4febef5eed1c51c22ae468efa22200"
meta-python/recipes-devtools/python/python3-django_5.2.17.bb new file +7 -0
new file mode 100644
index 0000000000..3f49bfcaea
@@ -0,0 +1,7 @@
+require python3-django.inc
+inherit python_setuptools_build_meta
+
+SRC_URI += "file://0001-fix-test_msgfmt_error_including_non_ascii-test.patch \
+            file://0001-Revert-Bumped-minimum-setuptools-version-to-83.patch \
+"
+SRC_URI[sha256sum] = "9d4d93be539a18ab80d058eb515900e10951e04c537c5a6b394fc49528d3251f"
#2 lore raw

PATCH 3/10 python3-eventlet: mark CVE-2023-29483 fixed

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Fix[1] for the CVE is part of the upstream version.

Details:
https://nvd.nist.gov/vuln/detail/cve-2023-29483

[1]https://github.com/eventlet/eventlet/commit/51e3c4928d4938beb576eff34f3bf97e6e64e6b4

---
 meta-python/recipes-devtools/python/python3-eventlet_0.41.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-python/recipes-devtools/python/python3-eventlet_0.41.0.bb +2 -0
index 3c27caf968..0b8cd676d9 100644
@@ -18,3 +18,5 @@ RDEPENDS:${PN} += " \
 	python3-six \
 	python3-greenlet \
 "
+
+CVE_STATUS[CVE-2023-29483] = "fixed-version: fixed since v0.35.2"
#3 lore raw

PATCH 4/10 python3-h11: mark CVE-2025-43859 fixed

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2025-43859

---
 meta-python/recipes-devtools/python/python3-h11_0.16.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-python/recipes-devtools/python/python3-h11_0.16.0.bb +2 -0
index ed1702ff54..0bc1cd5c41 100644
@@ -10,3 +10,5 @@ SRC_URI[sha256sum] = "4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208
 CVE_PRODUCT = "python-hyper:h11"
 
 RDEPENDS:${PN} += "python3-profile"
+
+CVE_STATUS[CVE-2025-43859] = "fixed-version: fixed in v0.16.0"
#4 lore raw

PATCH 5/10 python3-marshmallow: mark CVE-2025-68480 fixed

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2025-68480

---
 .../recipes-devtools/python/python3-marshmallow_4.3.0.bb        | 2 ++
 1 file changed, 2 insertions(+)
meta-python/recipes-devtools/python/python3-marshmallow_4.3.0.bb +2 -0
index 169726e527..402cedf459 100644
@@ -32,3 +32,5 @@ RDEPENDS:${PN} += " \
         python3-pprint \
         python3-packaging \
 "
+
+CVE_STATUS[CVE-2025-68480] = "fixed-version: fixed since v4.1.2"
#5 lore raw

PATCH 6/10 python3-sqlparse: patch CVE-2026-54284

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Detais:
https://nvd.nist.gov/vuln/detail/cve-2026-54284

---
 .../python3-sqlparse/CVE-2026-54284-1.patch   |  37 +++++
 .../python3-sqlparse/CVE-2026-54284-2.patch   | 144 ++++++++++++++++++
 .../python/python3-sqlparse_0.5.5.bb          |   4 +
 3 files changed, 185 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-sqlparse/CVE-2026-54284-1.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-sqlparse/CVE-2026-54284-2.patch
meta-python/recipes-devtools/python/python3-sqlparse/CVE-2026-54284-1.patch new file +37 -0
new file mode 100644
index 0000000000..90769436aa
@@ -0,0 +1,37 @@
+From 1a0f6530c8f506f953d1b4ffdfa84ae7ad72f7df Mon Sep 17 00:00:00 2001
+From: alhudz <[email protected]>
+Date: Mon, 1 Jun 2026 19:05:57 +0530
+Subject: [PATCH] set group value from child tokens to avoid quadratic grouping
+
+(cherry picked from commit 939b129e24c0ad5d51368b1aa72fffcaca76f06f)
+
+CVE: CVE-2026-54284
+Upstream-Status: Backport [https://github.com/andialbrecht/sqlparse/commit/939b129e24c0ad5d51368b1aa72fffcaca76f06f]
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ sqlparse/sql.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sqlparse/sql.py b/sqlparse/sql.py
+index 831dfb9..0163ff1 100644
+--- a/sqlparse/sql.py
++++ b/sqlparse/sql.py
+@@ -159,7 +159,7 @@ class TokenList(Token):
+     def __init__(self, tokens=None):
+         self.tokens = tokens or []
+         [setattr(token, 'parent', self) for token in self.tokens]
+-        super().__init__(None, str(self))
++        super().__init__(None, ''.join(token.value for token in self.tokens))
+         self.is_group = True
+ 
+     def __str__(self):
+@@ -322,7 +322,7 @@ class TokenList(Token):
+             grp = start
+             grp.tokens.extend(subtokens)
+             del self.tokens[start_idx + 1:end_idx]
+-            grp.value = str(start)
++            grp.value += ''.join(token.value for token in subtokens)
+         else:
+             subtokens = self.tokens[start_idx:end_idx]
+             grp = grp_cls(subtokens)
meta-python/recipes-devtools/python/python3-sqlparse/CVE-2026-54284-2.patch new file +144 -0

144 lines not on this page · raw message

meta-python/recipes-devtools/python/python3-sqlparse_0.5.5.bb +4 -0
index 03c032c49e..021ccfa349 100644
@@ -6,6 +6,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=2b136f573f5386001ea3b7b9016222fc"
 
 SRC_URI[sha256sum] = "e20d4a9b0b8585fdf63b10d30066c7c94c5d7a7ec47c889a2d83a3caa93ff28e"
 
+SRC_URI += "file://CVE-2026-54284-1.patch \
+            file://CVE-2026-54284-2.patch \
+"
+
 CVE_PRODUCT = "sqlparse"
 
 export BUILD_SYS
#6 lore raw

PATCH 7/10 python3-sqlparse: patch CVE-2026-59893

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-59893

---
 .../python3-sqlparse/CVE-2026-59893.patch     | 293 ++++++++++++++++++
 .../python/python3-sqlparse_0.5.5.bb          |   1 +
 2 files changed, 294 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-sqlparse/CVE-2026-59893.patch
meta-python/recipes-devtools/python/python3-sqlparse/CVE-2026-59893.patch new file +293 -0
new file mode 100644
index 0000000000..39dd978266
@@ -0,0 +1,293 @@
+From 3cca1f008a24b9817137d020eeed87efa5ed68d3 Mon Sep 17 00:00:00 2001
+From: Andi Albrecht <[email protected]>
+Date: Wed, 1 Jul 2026 08:38:53 +0200
+Subject: [PATCH] Fix uncontrolled CPU consumption (ReDoS) in the lexer's
+ handling of dollar-quoted literals and multiline comments.
+
+(cherry picked from commit d1d80602741f77ec78e5a04ce4719244cf32352e)
+
+CVE: CVE-2026-59893
+Upstream-Status: Backport [https://github.com/andialbrecht/sqlparse/commit/d1d80602741f77ec78e5a04ce4719244cf32352e]
+
+Dropped changes to the CHANGELOG file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ benchmarks/bench_dollar_quote_redos.py | 90 ++++++++++++++++++++++++++
+ sqlparse/keywords.py                   | 60 ++++++++++++++++-
+ sqlparse/lexer.py                      |  8 +++
+ sqlparse/utils.py                      | 46 ++++++++++++-
+ 4 files changed, 200 insertions(+), 4 deletions(-)
+ create mode 100644 benchmarks/bench_dollar_quote_redos.py
+
+diff --git a/benchmarks/bench_dollar_quote_redos.py b/benchmarks/bench_dollar_quote_redos.py
+new file mode 100644
+index 0000000..234d9c4
+--- /dev/null
++++ b/benchmarks/bench_dollar_quote_redos.py
+@@ -0,0 +1,90 @@
++"""Delimited-literal lexer benchmark (GHSA-prg7-hcfm-mfcr).
++
++Measures parse time for SQL text containing many unique, unmatched
++opening delimiters for the two lexer constructs that used a lazy dot-all
++regex (`[\\s\\S]*?`) terminated by a backreference or a literal closing
++sequence:
++
++- Dollar-quoted literals, e.g. `$a0$x $a1$x ... $aN$x` (backreference).
++- Multiline comments, e.g. `/* unique0 ... /* unique1 ...` (literal `*/`).
++
++When no closing delimiter is present, a lazy dot-all quantifier applied at
++every text position must scan to the end of the remaining input for every
++opener, which is O(n^2) total work as the number of openers grows.
++
++This benchmark does not assert a pass/fail threshold, since absolute timings
++and scaling ratios depend on the host machine. It exists to make the
++runtime characteristics of these code paths observable and to let it be
++re-run (e.g. after a fix) to confirm that scaling has improved.
++
++Run with:  python benchmarks/bench_dollar_quote_redos.py
++"""
++
++import signal
++import time
++
++import sqlparse
++from sqlparse.engine import grouping
++
++# Disable the grouping-stage DoS guards. They fire only after lexing
++# completes and do not bound regex CPU time, so they would otherwise mask
++# the lexer's true (unbounded) timing behind a SQLParseError at larger n.
++grouping.MAX_GROUPING_DEPTH = None
++grouping.MAX_GROUPING_TOKENS = None
++
++
++def _alarm_handler(signum, frame):
++    raise TimeoutError()
++
++
++signal.signal(signal.SIGALRM, _alarm_handler)
++
++
++def measure(label, sql, fn):
++    signal.alarm(30)
++    t0 = time.perf_counter()
++    status = 'OK'
++    try:
++        fn(sql)
++    except sqlparse.exceptions.SQLParseError:
++        status = 'CAP'
++    except TimeoutError:
++        status = 'TIMEOUT'
++    finally:
++        signal.alarm(0)
++    dt = (time.perf_counter() - t0) * 1000
++    print(f'  {status:8} {dt:8.1f} ms  {label}  ({len(sql)} B)')
++    return dt
++
++
++def make_dollar_quote_payload(n):
++    # N unique, never-closed dollar-quote openers. Each is unique so the
++    # backreference regex cannot short-circuit on an earlier match.
++    return ' '.join(f'$a{i}$x' for i in range(n))
++
++
++def make_comment_payload(n):
++    # N unique, never-closed multiline comment openers. No '*/' appears
++    # anywhere, so the closing literal can never short-circuit the scan.
++    return ' '.join(f'/* unique{i} comment never closed' for i in range(n))
++
++
++def run_scaling(label, make_payload, sizes=(250, 500, 1000, 2000, 4000, 8000)):
++    print(f'{label}:')
++    timings = {}
++    for n in sizes:
++        sql = make_payload(n)
++        timings[n] = measure(f'{label} n={n}', sql, sqlparse.parse)
++
++    print()
++    print('Scaling ratios (O(n^2) implies ~4x time per 2x input):')
++    for prev, curr in zip(sizes, sizes[1:]):
++        if timings[prev] > 0:
++            ratio = timings[curr] / timings[prev]
++            print(f'  n={prev} -> n={curr} (input x{curr / prev:.1f}): '
++                  f'time ratio = {ratio:.2f}x')
++    print()
++
++
++run_scaling('Unmatched dollar-quote openers', make_dollar_quote_payload)
++run_scaling('Unclosed multiline comments', make_comment_payload)
+diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py
+index 874431f..243f389 100644
+--- a/sqlparse/keywords.py
++++ b/sqlparse/keywords.py
+@@ -5,7 +5,10 @@
+ # This module is part of python-sqlparse and is released under
+ # the BSD License: https://opensource.org/licenses/BSD-3-Clause
+ 
++import re
++
+ from sqlparse import tokens
++from sqlparse.utils import _DelimiterOccurrence, resolve_paired_delimiters
+ 
+ # object() only supports "is" and is useful as a marker
+ # use this marker to specify that the given regex in SQL_REGEX
+@@ -13,12 +16,64 @@ from sqlparse import tokens
+ PROCESS_AS_KEYWORD = object()
+ 
+ 
++# Dollar-quoted literals (`$tag$...$tag$`) and multiline comments
++# (`/*...*/`, `/*+...*/`) used to be matched with per-position regexes
++# using a lazy dot-all quantifier (`[\s\S]*?`) terminated by a
++# backreference or a literal delimiter. Applied at every text position by
++# the lexer loop below, that shape is O(n^2) on adversarial input with
++# many unclosed openers, since each failed attempt re-scans to the end of
++# the remaining text (GHSA-prg7-hcfm-mfcr). They are resolved instead in
++# a single linear pass by find_delimited_spans().
++_DOLLAR_QUOTE_DELIM = re.compile(r'\$(?:[_A-ZÀ-Ü]\w*)?\$', re.IGNORECASE | re.UNICODE)
++_DOLLAR_QUOTE_OPENER_OK = re.compile(r'(?<![\w"$])', re.UNICODE)
++_COMMENT_HINT_OPEN = re.compile(r'/\*\+')
++_COMMENT_OPEN = re.compile(r'/\*(?!\+)')
++_COMMENT_CLOSE = re.compile(r'\*/')
++
++
++def find_delimited_spans(text):
++    """Locate dollar-quoted literals and multiline comments in `text`.
++
++    Returns a dict mapping each span's start offset to
++    (end offset, token type).
++    """
++    has_dollar = '$' in text
++    # A comment can only ever open on "/*"; without it "*/" alone can
++    # never pair with anything, so gating on "/*" alone is sufficient to
++    # skip all three comment-related regex passes below.
++    has_comment_open = '/*' in text
++    if not has_dollar and not has_comment_open:
++        return {}
++
++    occurrences = []
++    if has_dollar:
++        for m in _DOLLAR_QUOTE_DELIM.finditer(text):
++            tag = m.group()
++            can_open = _DOLLAR_QUOTE_OPENER_OK.match(text, m.start()) is not None
++            occurrences.append(
++                _DelimiterOccurrence(m.start(), m.end(), tag, can_open, True, tokens.Literal))
++    if has_comment_open:
++        for m in _COMMENT_HINT_OPEN.finditer(text):
++            occurrences.append(_DelimiterOccurrence(
++                m.start(), m.end(), 'C', True, False,
++                tokens.Comment.Multiline.Hint))
++        for m in _COMMENT_OPEN.finditer(text):
++            occurrences.append(_DelimiterOccurrence(
++                m.start(), m.end(), 'C', True, False,
++                tokens.Comment.Multiline))
++        for m in _COMMENT_CLOSE.finditer(text):
++            occurrences.append(
++                _DelimiterOccurrence(m.start(), m.end(), 'C', False, True, None))
++    occurrences.sort(key=lambda occ: occ.start)
++
++    spans = resolve_paired_delimiters(occurrences)
++    return {start: (end, ttype) for start, end, ttype in spans}
++
++
+ SQL_REGEX = [
+     (r'(--|# )\+.*?(\r\n|\r|\n|$)', tokens.Comment.Single.Hint),
+-    (r'/\*\+[\s\S]*?\*/', tokens.Comment.Multiline.Hint),
+ 
+     (r'(--|# ).*?(\r\n|\r|\n|$)', tokens.Comment.Single),
+-    (r'/\*[\s\S]*?\*/', tokens.Comment.Multiline),
+ 
+     (r'(\r\n|\r|\n)', tokens.Newline),
+     (r'\s+?', tokens.Whitespace),
+@@ -30,7 +85,6 @@ SQL_REGEX = [
+ 
+     (r"`(``|[^`])*`", tokens.Name),
+     (r"´(´´|[^´])*´", tokens.Name),
+-    (r'((?<![\w\"\$])\$(?:[_A-ZÀ-Ü]\w*)?\$)[\s\S]*?\1', tokens.Literal),
+ 
+     (r'\?', tokens.Name.Placeholder),
+     (r'%(\(\w+\))?s', tokens.Name.Placeholder),
+diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py
+index 8f88d17..71fd261 100644
+--- a/sqlparse/lexer.py
++++ b/sqlparse/lexer.py
+@@ -134,8 +134,16 @@ class Lexer:
+             raise TypeError("Expected text or file-like object, got {!r}".
+                             format(type(text)))
+ 
++        delimited_spans = keywords.find_delimited_spans(text)
++
+         iterable = enumerate(text)
+         for pos, char in iterable:
++            if pos in delimited_spans:
++                end, ttype = delimited_spans[pos]
++                yield ttype, text[pos:end]
++                consume(iterable, end - pos - 1)
++                continue
++
+             for rexmatch, action in self._SQL_REGEX:
+                 m = rexmatch(text, pos)
+ 
+diff --git a/sqlparse/utils.py b/sqlparse/utils.py
+index 58c0245..ed83734 100644
+--- a/sqlparse/utils.py
++++ b/sqlparse/utils.py
+@@ -7,7 +7,7 @@
+ 
+ import itertools
+ import re
+-from collections import deque
++from collections import defaultdict, deque, namedtuple
+ from contextlib import contextmanager
+ 
+ # This regular expression replaces the home-cooked parser that was here before.
+@@ -110,6 +110,50 @@ def consume(iterator, n):
+     deque(itertools.islice(iterator, n), maxlen=0)
+ 
+ 
++_DelimiterOccurrence = namedtuple(
++    '_DelimiterOccurrence', 'start end tag can_open can_close payload')
++
++
++def resolve_paired_delimiters(occurrences):
++    """Pair delimiter occurrences (quote/comment open & close markers) in
++    one left-to-right pass, instead of re-scanning the remaining text for
++    every unmatched opener -- which is what a backreference- or literal-
++    terminated lazy-dot-all regex applied at every text position ends up
++    doing, and is O(n^2) on adversarial input (GHSA-prg7-hcfm-mfcr).
++
++    `occurrences` must be sorted by `start`. Each occurrence with
++    `can_open` is paired with the nearest later occurrence sharing its
++    `tag` that has `can_close`; anything in between (including other
++    openers) is left as literal content. Unpaired openers are dropped,
++    exactly as a regex that never finds its closing delimiter fails to
++    match at all.
++
++    Returns a list of (start, end, payload) for each resolved span.
++    """
++    occurrences = list(occurrences)
++    closers = defaultdict(deque)
++    for idx, occ in enumerate(occurrences):
++        if occ.can_close:
++            closers[occ.tag].append(idx)
++
++    spans = []
++    consumed_until = 0
++    for i, occ in enumerate(occurrences):
++        if occ.can_close:
++            queue = closers[occ.tag]
++            if queue and queue[0] == i:
++                queue.popleft()
++        if occ.start < consumed_until or not occ.can_open:
++            continue
++        queue = closers[occ.tag]
++        if queue:
++            close_idx = queue.popleft()
++            close_end = occurrences[close_idx].end
++            spans.append((occ.start, close_end, occ.payload))
++            consumed_until = close_end
++    return spans
++
++
+ @contextmanager
+ def offset(filter_, n=0):
+     filter_.offset += n
meta-python/recipes-devtools/python/python3-sqlparse_0.5.5.bb +1 -0
index 021ccfa349..a1dc52db49 100644
@@ -8,6 +8,7 @@ SRC_URI[sha256sum] = "e20d4a9b0b8585fdf63b10d30066c7c94c5d7a7ec47c889a2d83a3caa9
 
 SRC_URI += "file://CVE-2026-54284-1.patch \
             file://CVE-2026-54284-2.patch \
+            file://CVE-2026-59893.patch \
 "
 
 CVE_PRODUCT = "sqlparse"
#7 lore raw

PATCH 8/10 python3-sqlparse: patch CVE-2026-59894

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Backport commit associated with GitHub advisory.

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-59894

---
 .../python3-sqlparse/CVE-2026-59894.patch     | 79 +++++++++++++++++++
 .../python/python3-sqlparse_0.5.5.bb          |  1 +
 2 files changed, 80 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-sqlparse/CVE-2026-59894.patch
meta-python/recipes-devtools/python/python3-sqlparse/CVE-2026-59894.patch new file +79 -0
new file mode 100644
index 0000000000..0bd7bbc967
@@ -0,0 +1,79 @@
+From a1ce7931eda6262f0fe94a0b2cb25854f12d6be5 Mon Sep 17 00:00:00 2001
+From: Andi Albrecht <[email protected]>
+Date: Mon, 29 Jun 2026 08:29:32 +0200
+Subject: [PATCH] Escape backslashes in output formatters.
+
+(cherry picked from commit 53ff44b53e27cff78259acc1af015506fea60f63)
+
+CVE: CVE-2026-59894
+Upstream-Status: Backport [https://github.com/andialbrecht/sqlparse/commit/53ff44b53e27cff78259acc1af015506fea60f63]
+
+Dropped changes to the CHANGELOG file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ sqlparse/filters/output.py | 16 ++++++++++------
+ tests/test_format.py       | 16 ++++++++++++++++
+ 2 files changed, 26 insertions(+), 6 deletions(-)
+
+diff --git a/sqlparse/filters/output.py b/sqlparse/filters/output.py
+index 253537e..697ebc3 100644
+--- a/sqlparse/filters/output.py
++++ b/sqlparse/filters/output.py
+@@ -61,9 +61,11 @@ class OutputPythonFilter(OutputFilter):
+                     yield sql.Token(T.Whitespace, after_lb)
+                 continue
+ 
+-            # Token has escape chars
+-            elif "'" in token.value:
+-                token.value = token.value.replace("'", "\\'")
++            # Escape backslashes before quotes so a backslash preceding a
++            # quote cannot break out of the generated string literal
++            # (GHSA-3496-9g83-7v6x).
++            else:
++                token.value = token.value.replace('\\', '\\\\').replace("'", "\\'")
+ 
+             # Put the token
+             yield sql.Token(T.Text, token.value)
+@@ -110,9 +112,11 @@ class OutputPHPFilter(OutputFilter):
+                     yield sql.Token(T.Whitespace, after_lb)
+                 continue
+ 
+-            # Token has escape chars
+-            elif '"' in token.value:
+-                token.value = token.value.replace('"', '\\"')
++            # Escape backslashes before quotes so a backslash preceding a
++            # quote cannot break out of the generated string literal
++            # (GHSA-3496-9g83-7v6x).
++            else:
++                token.value = token.value.replace('\\', '\\\\').replace('"', '\\"')
+ 
+             # Put the token
+             yield sql.Token(T.Text, token.value)
+diff --git a/tests/test_format.py b/tests/test_format.py
+index 0cdbcf8..9349506 100644
+--- a/tests/test_format.py
++++ b/tests/test_format.py
+@@ -689,6 +689,22 @@ class TestOutputFormat:
+             '$sql  = "select * ";',
+             '$sql .= "from foo;";'])
+ 
++    def test_python_escapes_backslashes(self):
++        # GHSA-3496-9g83-7v6x: backslashes must be escaped before quotes so
++        # crafted SQL cannot break out of the generated Python string literal.
++        # SQL  select '\foo\'  -> each \ doubled, each ' escaped.
++        sql = "select '\\foo\\'"
++        f = lambda sql: sqlparse.format(sql, output_format='python')
++        assert f(sql) == "sql = 'select \\'\\\\foo\\\\\\''"
++
++    def test_php_escapes_backslashes(self):
++        # GHSA-3496-9g83-7v6x: PHP double-quoted output must escape backslashes
++        # before quotes; a backslash before a quote otherwise closes the string.
++        # SQL  select '\foo\'  -> each \ doubled (single quotes need no escaping).
++        sql = "select '\\foo\\'"
++        f = lambda sql: sqlparse.format(sql, output_format='php')
++        assert f(sql) == '$sql = "select \'\\\\foo\\\\\'";'
++
+     def test_sql(self):
+         # "sql" is an allowed option but has no effect
+         sql = 'select * from foo;'
meta-python/recipes-devtools/python/python3-sqlparse_0.5.5.bb +1 -0
index a1dc52db49..a23f5ec0e2 100644
@@ -9,6 +9,7 @@ SRC_URI[sha256sum] = "e20d4a9b0b8585fdf63b10d30066c7c94c5d7a7ec47c889a2d83a3caa9
 SRC_URI += "file://CVE-2026-54284-1.patch \
             file://CVE-2026-54284-2.patch \
             file://CVE-2026-59893.patch \
+            file://CVE-2026-59894.patch \
 "
 
 CVE_PRODUCT = "sqlparse"
#8 lore raw

PATCH 9/10 python3-sqlparse: patch CVE-2026-71491

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-71491

---
 .../python3-sqlparse/CVE-2026-71491.patch     | 147 ++++++++++++++++++
 .../python/python3-sqlparse_0.5.5.bb          |   1 +
 2 files changed, 148 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-sqlparse/CVE-2026-71491.patch
meta-python/recipes-devtools/python/python3-sqlparse/CVE-2026-71491.patch new file +147 -0
new file mode 100644
index 0000000000..e0136cc4aa
@@ -0,0 +1,147 @@
+From ca01c323483883f205ee7bb44581c674fcfe6e49 Mon Sep 17 00:00:00 2001
+From: Andi Albrecht <[email protected]>
+Date: Mon, 10 Aug 2026 07:35:42 +0200
+Subject: [PATCH] Fix quadratic DoS in group_comments (GHSA-f2ff-p2ww-7p4p)
+
+A comment-only statement ('-- c\n' repeated) made group_comments rescan
+the whole remaining token tail once per comment token, costing O(n^2).
+Because group_comments runs before the MAX_GROUPING_TOKENS guard, the
+cost was paid even on oversized input.
+
+Stop as soon as token_not_matching finds no terminator in the remaining
+tokens: from that point on nothing can group, so re-scanning the tail is
+wasted work. This makes the pass O(n) while preserving grouping output.
+
+Add benchmarks/validate_group_comments_dos.py to check the scaling.
+
+Reported by sanktjodel.
+
+Co-Authored-By: Claude Opus 4.8 <[email protected]>
+
+(cherry picked from commit ef2012a5eeb491e604dea2b00d516904a3830c87)
+
+CVE: CVE-2026-71491
+Upstream-Status: Backport [https://github.com/andialbrecht/sqlparse/commit/ef2012a5eeb491e604dea2b00d516904a3830c87]
+
+Dropped changes to the CHANGELOG file.
+
+Signed-off-by: Ankur Tyagi <[email protected]>
+---
+ benchmarks/validate_group_comments_dos.py | 85 +++++++++++++++++++++++
+ sqlparse/engine/grouping.py               | 11 ++-
+ 2 files changed, 93 insertions(+), 3 deletions(-)
+ create mode 100644 benchmarks/validate_group_comments_dos.py
+
+diff --git a/benchmarks/validate_group_comments_dos.py b/benchmarks/validate_group_comments_dos.py
+new file mode 100644
+index 0000000..58b3e01
+--- /dev/null
++++ b/benchmarks/validate_group_comments_dos.py
+@@ -0,0 +1,85 @@
++"""Validate that ``group_comments`` scales linearly on comment-only input.
++
++Regression check for the quadratic O(n^2) DoS in ``group_comments``
++(sqlparse/engine/grouping.py), reported as GHSA-f2ff-p2ww-7p4p.
++
++A statement made only of single-line comments (``'-- c\\n'`` repeated n times)
++lexes in O(n) but ``group_comments`` rescans the O(n) remaining tokens for every
++comment token, giving O(n^2) total work. ``group_comments`` runs first in
++``group()``, before the ``MAX_GROUPING_TOKENS`` guard, so the token cap does not
++protect this vector. The path is reachable via ``sqlparse.parse()`` and
++``sqlparse.format(sql, strip_comments=True)``.
++
++This script measures the scaling of the vulnerable path and reports whether the
++observed growth is quadratic (vulnerable) or roughly linear (patched).
++
++Run with:  python benchmarks/validate_group_comments_dos.py
++
++Exit code 0 => behaviour looks linear (advisory mitigated).
++Exit code 1 => behaviour looks quadratic (advisory reproduced).
++"""
++
++import sys
++import time
++
++import sqlparse
++
++
++def payload(n):
++    """A comment-only statement of n single-line comments."""
++    return '-- c\n' * n
++
++
++def measure(fn, sql):
++    t0 = time.perf_counter()
++    fn(sql)
++    return (time.perf_counter() - t0) * 1000
++
++
++def run(label, fn):
++    print(f'{label}:')
++    sizes = (1000, 2000, 4000, 8000)
++    timings = []
++    for n in sizes:
++        dt = measure(fn, payload(n))
++        timings.append(dt)
++        print(f'  n={n:5d}  {dt:8.1f} ms  ({len(payload(n))} B)')
++
++    # For each doubling of the input, quadratic growth ~4x, linear ~2x.
++    ratios = [b / a for a, b in zip(timings, timings[1:]) if a > 0]
++    print(f'  doubling ratios: {", ".join(f"{r:.2f}x" for r in ratios)}')
++    return ratios
++
++
++def classify(ratios):
++    """Quadratic if the average per-doubling ratio is closer to 4x than 2x."""
++    if not ratios:
++        return 'inconclusive', 0.0
++    avg = sum(ratios) / len(ratios)
++    # Midpoint between linear (2x) and quadratic (4x) is 3x.
++    return ('quadratic' if avg >= 3.0 else 'linear'), avg
++
++
++def main():
++    print('GHSA-f2ff-p2ww-7p4p: quadratic DoS in group_comments\n')
++
++    all_ratios = []
++    all_ratios += run('sqlparse.parse', sqlparse.parse)
++    print()
++    all_ratios += run(
++        'sqlparse.format(strip_comments=True)',
++        lambda s: sqlparse.format(s, strip_comments=True),
++    )
++    print()
++
++    verdict, avg = classify(all_ratios)
++    print(f'Average doubling ratio: {avg:.2f}x  =>  {verdict}')
++    if verdict == 'quadratic':
++        print('VULNERABLE: growth is quadratic, advisory reproduced.')
++        return 1
++    print('OK: growth is roughly linear, advisory mitigated.')
++    return 0
++
++
++if __name__ == '__main__':
++    sys.exit(main())
+diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
+index 43ca5b5..7a3ca1a 100644
+--- a/sqlparse/engine/grouping.py
++++ b/sqlparse/engine/grouping.py
+@@ -339,9 +339,14 @@ def group_comments(tlist):
+     while token:
+         eidx, end = tlist.token_not_matching(
+             lambda tk: imt(tk, t=T.Comment) or tk.is_newline, idx=tidx)
+-        if end is not None:
+-            eidx, end = tlist.token_prev(eidx, skip_ws=False)
+-            tlist.group_tokens(sql.Comment, tidx, eidx)
++        if end is None:
++            # From tidx onward everything is comment/newline: there is no
++            # terminator to group against, and every later start would hit
++            # the same dead end. Stop instead of re-scanning the tail once
++            # per remaining comment token (which is O(n**2)).
++            break
++        eidx, end = tlist.token_prev(eidx, skip_ws=False)
++        tlist.group_tokens(sql.Comment, tidx, eidx)
+ 
+         tidx, token = tlist.token_next_by(t=T.Comment, idx=tidx)
+ 
meta-python/recipes-devtools/python/python3-sqlparse_0.5.5.bb +1 -0
index a23f5ec0e2..61fe759ede 100644
@@ -10,6 +10,7 @@ SRC_URI += "file://CVE-2026-54284-1.patch \
             file://CVE-2026-54284-2.patch \
             file://CVE-2026-59893.patch \
             file://CVE-2026-59894.patch \
+            file://CVE-2026-71491.patch \
 "
 
 CVE_PRODUCT = "sqlparse"
#9 lore raw

PATCH 10/10 python3-tornado: mark CVEs fixed

In reply to [email protected]

From: Ankur Tyagi <[email protected]>

Details:
https://nvd.nist.gov/vuln/detail/cve-2026-49853
https://nvd.nist.gov/vuln/detail/cve-2026-49854
https://nvd.nist.gov/vuln/detail/cve-2026-49855

---
 meta-python/recipes-devtools/python/python3-tornado_6.5.7.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta-python/recipes-devtools/python/python3-tornado_6.5.7.bb +4 -0
index 4dda1541b8..114822fb6c 100644
@@ -41,3 +41,7 @@ FILES:${PN}-test = " \
 CVE_PRODUCT = "tornadoweb:tornado"
 
 BBCLASSEXTEND  += "native nativesdk"
+
+CVE_STATUS[CVE-2026-49853] = "fixed-version: fixed since v6.5.6"
+CVE_STATUS[CVE-2026-49854] = "fixed-version: fixed since v6.5.6"
+CVE_STATUS[CVE-2026-49855] = "fixed-version: fixed since v6.5.6"