summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python/python3-django-3.2.25
diff options
context:
space:
mode:
authorSaravanan <saravanan.kadambathursubramaniyam@windriver.com>2025-11-30 17:18:59 +0530
committerGyorgy Sarvari <skandigraun@gmail.com>2025-11-30 15:16:32 +0100
commit21d389c8f9c82be11f50560668591d5f7ae80690 (patch)
treed8fbbee63f20e600a81937238ffece013bd566ed /meta-python/recipes-devtools/python/python3-django-3.2.25
parent0b554678b68189e14293a8a6a07bb6998ce345c4 (diff)
downloadmeta-openembedded-21d389c8f9c82be11f50560668591d5f7ae80690.tar.gz
python3-django: fix CVE-2025-57833
Reference: https://nvd.nist.gov/vuln/detail/CVE-2025-57833 Upstream-patch: https://github.com/django/django/commit/31334e6965ad136a5e369993b01721499c5d1a92 Signed-off-by: Saravanan <saravanan.kadambathursubramaniyam@windriver.com> Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-django-3.2.25')
-rw-r--r--meta-python/recipes-devtools/python/python3-django-3.2.25/CVE-2025-57833.patch110
1 files changed, 110 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-django-3.2.25/CVE-2025-57833.patch b/meta-python/recipes-devtools/python/python3-django-3.2.25/CVE-2025-57833.patch
new file mode 100644
index 0000000000..f5252329b6
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-django-3.2.25/CVE-2025-57833.patch
@@ -0,0 +1,110 @@
1From 31334e6965ad136a5e369993b01721499c5d1a92 Mon Sep 17 00:00:00 2001
2From: Jake Howard <git@theorangeone.net>
3Date: Wed, 13 Aug 2025 14:13:42 +0200
4Subject: [PATCH] Fixed CVE-2025-57833 -- Protected FilteredRelation against
5 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
14https://github.com/django/django/commit/31334e6965ad136a5e369993b01721499c5d1a92
15
16Signed-off-by: Jake Howard <git@theorangeone.net>
17Signed-off-by: Saravanan <saravanan.kadambathursubramaniyam@windriver.com>
18---
19 django/db/models/sql/query.py | 1 +
20 docs/releases/3.2.25.txt | 7 +++++++
21 tests/annotations/tests.py | 25 ++++++++++++++++++++++++-
22 3 files changed, 32 insertions(+), 1 deletion(-)
23
24diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
25index 230b6fa..e56ff81 100644
26--- a/django/db/models/sql/query.py
27+++ b/django/db/models/sql/query.py
28@@ -1466,6 +1466,7 @@ class Query(BaseExpression):
29 return target_clause
30
31 def add_filtered_relation(self, filtered_relation, alias):
32+ self.check_alias(alias)
33 filtered_relation.alias = alias
34 lookups = dict(get_children_from_q(filtered_relation.condition))
35 relation_lookup_parts, relation_field_parts, _ = self.solve_lookup_type(filtered_relation.relation_name)
36diff --git a/docs/releases/3.2.25.txt b/docs/releases/3.2.25.txt
37index 93ab341..a2a58b5 100644
38--- a/docs/releases/3.2.25.txt
39+++ b/docs/releases/3.2.25.txt
40@@ -33,6 +33,13 @@ which has now been updated to define a ``max_length`` of 39 characters.
41 The :class:`django.db.models.GenericIPAddressField` model field was not
42 affected.
43
44+CVE-2025-57833: Potential SQL injection in ``FilteredRelation`` column aliases
45+==============================================================================
46+
47+:class:`.FilteredRelation` was subject to SQL injection in column aliases,
48+using a suitably crafted dictionary, with dictionary expansion, as the
49+``**kwargs`` passed to :meth:`.QuerySet.annotate` or :meth:`.QuerySet.alias`.
50+
51 Bugfixes
52 ========
53
54diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
55index 8082c7a..00d4ee6 100644
56--- a/tests/annotations/tests.py
57+++ b/tests/annotations/tests.py
58@@ -4,7 +4,7 @@ from decimal import Decimal
59 from django.core.exceptions import FieldDoesNotExist, FieldError
60 from django.db.models import (
61 BooleanField, Case, CharField, Count, DateTimeField, DecimalField, Exists,
62- ExpressionWrapper, F, FloatField, Func, IntegerField, Max,
63+ ExpressionWrapper, F, FilteredRelation, FloatField, Func, IntegerField, Max,
64 NullBooleanField, OuterRef, Q, Subquery, Sum, Value, When,
65 )
66 from django.db.models.expressions import RawSQL
67@@ -775,6 +775,15 @@ class NonAggregateAnnotationTestCase(TestCase):
68 with self.assertRaisesMessage(ValueError, msg):
69 Book.objects.annotate(**{crafted_alias: Value(1)})
70
71+ def test_alias_filtered_relation_sql_injection(self):
72+ crafted_alias = """injected_name" from "annotations_book"; --"""
73+ msg = (
74+ "Column aliases cannot contain whitespace characters, quotation marks, "
75+ "semicolons, or SQL comments."
76+ )
77+ with self.assertRaisesMessage(ValueError, msg):
78+ Book.objects.annotate(**{crafted_alias: FilteredRelation("author")})
79+
80 def test_alias_forbidden_chars(self):
81 tests = [
82 'al"ias',
83@@ -800,6 +809,11 @@ class NonAggregateAnnotationTestCase(TestCase):
84 with self.assertRaisesMessage(ValueError, msg):
85 Book.objects.annotate(**{crafted_alias: Value(1)})
86
87+ with self.assertRaisesMessage(ValueError, msg):
88+ Book.objects.annotate(
89+ **{crafted_alias: FilteredRelation("authors")}
90+ )
91+
92
93 class AliasTests(TestCase):
94 @classmethod
95@@ -1039,3 +1053,12 @@ class AliasTests(TestCase):
96 )
97 with self.assertRaisesMessage(ValueError, msg):
98 Book.objects.alias(**{crafted_alias: Value(1)})
99+
100+ def test_alias_filtered_relation_sql_injection(self):
101+ crafted_alias = """injected_name" from "annotations_book"; --"""
102+ msg = (
103+ "Column aliases cannot contain whitespace characters, quotation marks, "
104+ "semicolons, or SQL comments."
105+ )
106+ with self.assertRaisesMessage(ValueError, msg):
107+ Book.objects.alias(**{crafted_alias: FilteredRelation("authors")})
108--
1092.40.0
110