diff options
author | Rahul Janani Pandi <RahulJanani.Pandi@windriver.com> | 2024-04-16 10:40:54 +0000 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2024-04-28 13:10:23 -0400 |
commit | ac06a6540499c2492c6f4eb87481ba4df83a21cb (patch) | |
tree | 0a1ee908001f0cc49019738b0b1f992d24a82d9d /meta-python/recipes-devtools/python/python3-django | |
parent | bd7b2ebf21b4b9e382d05b685aba18a08b224249 (diff) | |
download | meta-openembedded-ac06a6540499c2492c6f4eb87481ba4df83a21cb.tar.gz |
python3-django: fix CVE-2024-24680
An issue was discovered in Django 3.2 before 3.2.24, 4.2 before 4.2.10,
and Django 5.0 before 5.0.2. The intcomma template filter was subject
to a potential denial-of-service attack when used with very long strings.
Since, there is no ptest available for python3-django so have not
tested the patch changes at runtime.
References:
https://security-tracker.debian.org/tracker/CVE-2024-24680
https://docs.djangoproject.com/en/dev/releases/4.2.10/
Signed-off-by: Rahul Janani Pandi <RahulJanani.Pandi@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-django')
-rw-r--r-- | meta-python/recipes-devtools/python/python3-django/CVE-2024-24680.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-django/CVE-2024-24680.patch b/meta-python/recipes-devtools/python/python3-django/CVE-2024-24680.patch new file mode 100644 index 0000000000..aec67453ae --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-django/CVE-2024-24680.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From 572ea07e84b38ea8de0551f4b4eda685d91d09d2 | ||
2 | From: Adam Johnson <me@adamj.eu> | ||
3 | Date: Mon Jan 22 13:21:13 2024 +0000 | ||
4 | Subject: [PATCH] Fixed CVE-2024-24680 -- Mitigated potential DoS in intcomma | ||
5 | template filter | ||
6 | |||
7 | Thanks Seokchan Yoon for the report. | ||
8 | |||
9 | Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> | ||
10 | Co-authored-by: Natalia <124304+nessita@users.noreply.github.com> | ||
11 | Co-authored-by: Shai Berger <shai@platonix.com> | ||
12 | |||
13 | CVE: CVE-2024-24680 | ||
14 | |||
15 | Upstream-Status: Backport [https://github.com/django/django/commit/572ea07e84b38ea8de0551f4b4eda685d91d09d2] | ||
16 | |||
17 | Signed-off-by: Rahul Janani Pandi <RahulJanani.Pandi@windriver.com> | ||
18 | --- | ||
19 | django/contrib/humanize/templatetags/humanize.py | 13 +++++++------ | ||
20 | 1 file changed, 7 insertions(+), 6 deletions(-) | ||
21 | |||
22 | diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py | ||
23 | index 194c7e8..ee22a45 100644 | ||
24 | --- a/django/contrib/humanize/templatetags/humanize.py | ||
25 | +++ b/django/contrib/humanize/templatetags/humanize.py | ||
26 | @@ -71,13 +71,14 @@ def intcomma(value, use_l10n=True): | ||
27 | return intcomma(value, False) | ||
28 | else: | ||
29 | return number_format(value, force_grouping=True) | ||
30 | - orig = str(value) | ||
31 | - new = re.sub(r"^(-?\d+)(\d{3})", r'\g<1>,\g<2>', orig) | ||
32 | - if orig == new: | ||
33 | - return new | ||
34 | - else: | ||
35 | - return intcomma(new, use_l10n) | ||
36 | |||
37 | + result = str(value) | ||
38 | + match = re.match(r"-?\d+", result) | ||
39 | + if match: | ||
40 | + prefix = match[0] | ||
41 | + prefix_with_commas = re.sub(r"\d{3}", r"\g<0>,", prefix[::-1])[::-1] | ||
42 | + result = prefix_with_commas + result[len(prefix) :] | ||
43 | + return result | ||
44 | |||
45 | # A tuple of standard large number to their converters | ||
46 | intword_converters = ( | ||
47 | -- | ||
48 | 2.40.0 | ||