summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python
diff options
context:
space:
mode:
authorHaixiao Yan <haixiao.yan.cn@windriver.com>2026-04-10 15:05:06 +0800
committerAnuj Mittal <anuj.mittal@oss.qualcomm.com>2026-04-15 14:12:18 +0530
commit838ca228086821cf82b3de83fb78412c6d2784c8 (patch)
tree29cfa39730376a6ddf4b81849b1bcb8a2e2c64b2 /meta-python/recipes-devtools/python
parent6f240eceb0fe8ae357a4e5560bb7fb6dcae0e197 (diff)
downloadmeta-openembedded-838ca228086821cf82b3de83fb78412c6d2784c8.tar.gz
python3-django: fix CVE-2025-57833
FilteredRelation was subject to SQL injection in column aliases, using a suitably crafted dictionary, with dictionary expansion, as the **kwargs passed QuerySet.annotate() or QuerySet.alias(). Reference: https://nvd.nist.gov/vuln/detail/CVE-2025-57833 Upstream-patch: https://github.com/django/django/commit/31334e6965ad136a5e369993b01721499c5d1a92 Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com> Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com> Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
Diffstat (limited to 'meta-python/recipes-devtools/python')
-rw-r--r--meta-python/recipes-devtools/python/python3-django-5.0.14/CVE-2025-57833.patch88
-rw-r--r--meta-python/recipes-devtools/python/python3-django_5.0.14.bb1
2 files changed, 89 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-django-5.0.14/CVE-2025-57833.patch b/meta-python/recipes-devtools/python/python3-django-5.0.14/CVE-2025-57833.patch
new file mode 100644
index 0000000000..cef0b30a59
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-django-5.0.14/CVE-2025-57833.patch
@@ -0,0 +1,88 @@
1From 61b7449dc4ed51ce1fecd7b5a22b52fbc961c5bf Mon Sep 17 00:00:00 2001
2From: Jake Howard <git@theorangeone.net>
3Date: Wed, 13 Aug 2025 14:13:42 +0200
4Subject: [PATCH 1/2] [4.2.x] Fixed CVE-2025-57833 -- Protected
5 FilteredRelation against SQL injection in column aliases.
6
7Thanks Eyal Gabay (EyalSec) for the report.
8
9Backport of 51711717098d3f469f795dfa6bc3758b24f69ef7 from main.
10
11CVE: CVE-2025-57833
12
13Upstream-Status: Backport [https://github.com/django/django/commit/31334e6965ad136a5e369993b01721499c5d1a92]
14
15Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com>
16---
17 django/db/models/sql/query.py | 1 +
18 tests/annotations/tests.py | 24 ++++++++++++++++++++++++
19 2 files changed, 25 insertions(+)
20
21diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
22index fe6baca607a9..6a86a184d8b4 100644
23--- a/django/db/models/sql/query.py
24+++ b/django/db/models/sql/query.py
25@@ -1663,6 +1663,7 @@ class Query(BaseExpression):
26 return target_clause, needed_inner
27
28 def add_filtered_relation(self, filtered_relation, alias):
29+ self.check_alias(alias)
30 filtered_relation.alias = alias
31 relation_lookup_parts, relation_field_parts, _ = self.solve_lookup_type(
32 filtered_relation.relation_name
33diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
34index f1260b41926b..01fa6958db7b 100644
35--- a/tests/annotations/tests.py
36+++ b/tests/annotations/tests.py
37@@ -12,6 +12,7 @@ from django.db.models import (
38 Exists,
39 ExpressionWrapper,
40 F,
41+ FilteredRelation,
42 FloatField,
43 Func,
44 IntegerField,
45@@ -1132,6 +1133,15 @@ class NonAggregateAnnotationTestCase(TestCase):
46 with self.assertRaisesMessage(ValueError, msg):
47 Book.objects.annotate(**{crafted_alias: Value(1)})
48
49+ def test_alias_filtered_relation_sql_injection(self):
50+ crafted_alias = """injected_name" from "annotations_book"; --"""
51+ msg = (
52+ "Column aliases cannot contain whitespace characters, quotation marks, "
53+ "semicolons, or SQL comments."
54+ )
55+ with self.assertRaisesMessage(ValueError, msg):
56+ Book.objects.annotate(**{crafted_alias: FilteredRelation("author")})
57+
58 def test_alias_forbidden_chars(self):
59 tests = [
60 'al"ias',
61@@ -1157,6 +1167,11 @@ class NonAggregateAnnotationTestCase(TestCase):
62 with self.assertRaisesMessage(ValueError, msg):
63 Book.objects.annotate(**{crafted_alias: Value(1)})
64
65+ with self.assertRaisesMessage(ValueError, msg):
66+ Book.objects.annotate(
67+ **{crafted_alias: FilteredRelation("authors")}
68+ )
69+
70
71 class AliasTests(TestCase):
72 @classmethod
73@@ -1429,3 +1444,12 @@ class AliasTests(TestCase):
74 )
75 with self.assertRaisesMessage(ValueError, msg):
76 Book.objects.alias(**{crafted_alias: Value(1)})
77+
78+ def test_alias_filtered_relation_sql_injection(self):
79+ crafted_alias = """injected_name" from "annotations_book"; --"""
80+ msg = (
81+ "Column aliases cannot contain whitespace characters, quotation marks, "
82+ "semicolons, or SQL comments."
83+ )
84+ with self.assertRaisesMessage(ValueError, msg):
85+ Book.objects.alias(**{crafted_alias: FilteredRelation("authors")})
86--
872.34.1
88
diff --git a/meta-python/recipes-devtools/python/python3-django_5.0.14.bb b/meta-python/recipes-devtools/python/python3-django_5.0.14.bb
index 84dd9dd5f4..0f6a55a0b3 100644
--- a/meta-python/recipes-devtools/python/python3-django_5.0.14.bb
+++ b/meta-python/recipes-devtools/python/python3-django_5.0.14.bb
@@ -7,6 +7,7 @@ CVE_STATUS[CVE-2025-27556] = "not-applicable-platform: Issue only applies on Win
7SRC_URI += "file://CVE-2025-64460.patch \ 7SRC_URI += "file://CVE-2025-64460.patch \
8 file://CVE-2025-64459-1.patch \ 8 file://CVE-2025-64459-1.patch \
9 file://CVE-2025-64459-2.patch \ 9 file://CVE-2025-64459-2.patch \
10 file://CVE-2025-57833.patch \
10 " 11 "
11SRC_URI[sha256sum] = "29019a5763dbd48da1720d687c3522ef40d1c61be6fb2fad27ed79e9f655bc11" 12SRC_URI[sha256sum] = "29019a5763dbd48da1720d687c3522ef40d1c61be6fb2fad27ed79e9f655bc11"
12 13