diff options
| author | Haixiao Yan <haixiao.yan.cn@windriver.com> | 2026-04-10 15:04:59 +0800 |
|---|---|---|
| committer | Anuj Mittal <anuj.mittal@oss.qualcomm.com> | 2026-04-15 14:10:33 +0530 |
| commit | 151e634ed297eec8d9b269c2b08001fd76f4cc62 (patch) | |
| tree | 2cc93ce861031d31ac3dcbf6e28df3d01b3bf02e /meta-python/recipes-devtools/python/python3-django-5.0.14/CVE-2025-64459-2.patch | |
| parent | c14dcffcd77b7b9d0d1f3473f98d51ffe2b166e9 (diff) | |
| download | meta-openembedded-151e634ed297eec8d9b269c2b08001fd76f4cc62.tar.gz | |
python3-django: fix CVE-2025-64459
The methods QuerySet.filter(), QuerySet.exclude(), and QuerySet.get(), and the
class Q() were subject to SQL injection when using a suitably crafted
dictionary, with dictionary expansion, as the _connector argument.
Reference:
https://nvd.nist.gov/vuln/detail/CVE-2025-64459
https://shivasurya.me/security/django/2025/11/07/django-sql-injection-CVE-2025-64459.html
Upstream-patch:
https://github.com/django/django/commit/72d2c87431f2ae0431d65d0ec792047f078c8241
https://github.com/django/django/commit/4624ed769c0f7caea0d48ac824a75fa6b6f17671
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/python3-django-5.0.14/CVE-2025-64459-2.patch')
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-django-5.0.14/CVE-2025-64459-2.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-django-5.0.14/CVE-2025-64459-2.patch b/meta-python/recipes-devtools/python/python3-django-5.0.14/CVE-2025-64459-2.patch new file mode 100644 index 0000000000..5a207f8f11 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-django-5.0.14/CVE-2025-64459-2.patch | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | From 415912be531179e90e69f0be2e8bca301de53765 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jacob Walls <jacobtylerwalls@gmail.com> | ||
| 3 | Date: Wed, 24 Sep 2025 15:56:03 -0400 | ||
| 4 | Subject: [PATCH] [5.1.x] Refs CVE-2025-64459 -- Avoided propagating | ||
| 5 | invalid arguments to Q on dictionary expansion. | ||
| 6 | |||
| 7 | Backport of 3c3f46357718166069948625354b8315a8505262 from main. | ||
| 8 | |||
| 9 | CVE: CVE-2025-64459 | ||
| 10 | |||
| 11 | Upstream-Status: Backport [https://github.com/django/django/commit/4624ed769c0f7caea0d48ac824a75fa6b6f17671] | ||
| 12 | |||
| 13 | Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com> | ||
| 14 | --- | ||
| 15 | django/db/models/query.py | 5 +++++ | ||
| 16 | tests/queries/tests.py | 8 ++++++++ | ||
| 17 | 2 files changed, 13 insertions(+) | ||
| 18 | |||
| 19 | diff --git a/django/db/models/query.py b/django/db/models/query.py | ||
| 20 | index 153fb1193ebf..3308cd48db00 100644 | ||
| 21 | --- a/django/db/models/query.py | ||
| 22 | +++ b/django/db/models/query.py | ||
| 23 | @@ -42,6 +42,8 @@ MAX_GET_RESULTS = 21 | ||
| 24 | # The maximum number of items to display in a QuerySet.__repr__ | ||
| 25 | REPR_OUTPUT_SIZE = 20 | ||
| 26 | |||
| 27 | +PROHIBITED_FILTER_KWARGS = frozenset(["_connector", "_negated"]) | ||
| 28 | + | ||
| 29 | |||
| 30 | class BaseIterable: | ||
| 31 | def __init__( | ||
| 32 | @@ -1495,6 +1497,9 @@ class QuerySet(AltersData): | ||
| 33 | return clone | ||
| 34 | |||
| 35 | def _filter_or_exclude_inplace(self, negate, args, kwargs): | ||
| 36 | + if invalid_kwargs := PROHIBITED_FILTER_KWARGS.intersection(kwargs): | ||
| 37 | + invalid_kwargs_str = ", ".join(f"'{k}'" for k in sorted(invalid_kwargs)) | ||
| 38 | + raise TypeError(f"The following kwargs are invalid: {invalid_kwargs_str}") | ||
| 39 | if negate: | ||
| 40 | self._query.add_q(~Q(*args, **kwargs)) | ||
| 41 | else: | ||
| 42 | diff --git a/tests/queries/tests.py b/tests/queries/tests.py | ||
| 43 | index 20665ab2cda3..5df231949194 100644 | ||
| 44 | --- a/tests/queries/tests.py | ||
| 45 | +++ b/tests/queries/tests.py | ||
| 46 | @@ -4481,6 +4481,14 @@ class TestInvalidValuesRelation(SimpleTestCase): | ||
| 47 | Annotation.objects.filter(tag__in=[123, "abc"]) | ||
| 48 | |||
| 49 | |||
| 50 | +class TestInvalidFilterArguments(TestCase): | ||
| 51 | + def test_filter_rejects_invalid_arguments(self): | ||
| 52 | + school = School.objects.create() | ||
| 53 | + msg = "The following kwargs are invalid: '_connector', '_negated'" | ||
| 54 | + with self.assertRaisesMessage(TypeError, msg): | ||
| 55 | + School.objects.filter(pk=school.pk, _negated=True, _connector="evil") | ||
| 56 | + | ||
| 57 | + | ||
| 58 | class TestTicket24605(TestCase): | ||
| 59 | def test_ticket_24605(self): | ||
| 60 | """ | ||
| 61 | -- | ||
| 62 | 2.34.1 | ||
| 63 | |||
