From f9093913b239901b84e5631147b61d7935d71a65 Mon Sep 17 00:00:00 2001 From: Tobias Brick <39196763+tobiasb-ms@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:10:51 -0800 Subject: [PATCH] python-jinja2: add patch for CVE-2024-22195 (#7426) --- SPECS/python-jinja2/CVE-2024-22195.patch | 92 +++++++++++++++++++ SPECS/python-jinja2/python-jinja2.spec | 10 +- .../manifests/package/toolchain_aarch64.txt | 2 +- .../manifests/package/toolchain_x86_64.txt | 2 +- 4 files changed, 101 insertions(+), 5 deletions(-) create mode 100644 SPECS/python-jinja2/CVE-2024-22195.patch diff --git a/SPECS/python-jinja2/CVE-2024-22195.patch b/SPECS/python-jinja2/CVE-2024-22195.patch new file mode 100644 index 0000000000..e634d8bb4a --- /dev/null +++ b/SPECS/python-jinja2/CVE-2024-22195.patch @@ -0,0 +1,92 @@ +From 58cbcf78ba645b9f0ac33257a526a5b874bfd7c1 Mon Sep 17 00:00:00 2001 +From: Tobias Brick +Date: Tue, 23 Jan 2024 22:29:04 +0000 +Subject: [PATCH] Backport upstream change + https://github.com/pallets/jinja/commit/716795349a41d4983a9a4771f7d883c96ea17be7 + into 3.0.3. + +Backport was very straightforward -- basically line numbers and a small amount of context. + +Based on: + +From 7dd3680e6eea0d77fde024763657aa4d884ddb23 Mon Sep 17 00:00:00 2001 +From: Calum Hutton +Date: Thu, 26 Oct 2023 12:08:53 +0100 +Subject: [PATCH] xmlattr filter disallows keys with spaces +--- + src/jinja2/filters.py | 26 +++++++++++++++++++++----- + tests/test_filters.py | 6 ++++++ + 2 files changed, 27 insertions(+), 5 deletions(-) + +diff --git a/src/jinja2/filters.py b/src/jinja2/filters.py +index ffb98bf..4f90bfe 100644 +--- a/src/jinja2/filters.py ++++ b/src/jinja2/filters.py +@@ -271,6 +271,9 @@ def do_lower(s: str) -> str: + return soft_str(s).lower() + + ++_space_re = re.compile(r"\s", flags=re.ASCII) ++ ++ + @pass_eval_context + def do_xmlattr( + eval_ctx: "EvalContext", d: t.Mapping[str, t.Any], autospace: bool = True +@@ -279,6 +282,9 @@ def do_xmlattr( + All values that are neither `none` nor `undefined` are automatically + escaped: + ++ If any key contains a space, this fails with a ``ValueError``. Values that ++ are neither ``none`` nor ``undefined`` are automatically escaped. ++ + .. sourcecode:: html+jinja + + = 2.0 BuildRequires: python3-setuptools BuildRequires: python3-xml -%if %{with_check} +%if 0%{?with_check} BuildRequires: python3-pip %endif Requires: python3 @@ -33,7 +34,7 @@ inspired non-XML syntax but supports inline expressions and an optional sandboxed environment. %prep -%autosetup -n Jinja2-%{version} +%autosetup -p1 -n Jinja2-%{version} sed -i 's/\r$//' LICENSE.rst # Fix wrong EOL encoding %build @@ -53,6 +54,9 @@ tox -e py%{python3_version_nodots} %{python3_sitelib}/Jinja2-%{version}-py%{python3_version}.egg-info %changelog +* Wed Jan 24 2024 Tobias Brick - 3.0.3-3 +- Backport CVE-2024-22195 from upstream + * Tue Mar 15 2022 Muhammad Falak - 3.0.3-2 - Use `py%{python3_version_nodots}` instead of harcoding `py39` diff --git a/toolkit/resources/manifests/package/toolchain_aarch64.txt b/toolkit/resources/manifests/package/toolchain_aarch64.txt index d09c6f5f00..08df1fbf6f 100644 --- a/toolkit/resources/manifests/package/toolchain_aarch64.txt +++ b/toolkit/resources/manifests/package/toolchain_aarch64.txt @@ -518,7 +518,7 @@ python3-Cython-0.29.33-1.cm2.aarch64.rpm python3-debuginfo-3.9.14-8.cm2.aarch64.rpm python3-devel-3.9.14-8.cm2.aarch64.rpm python3-gpg-1.16.0-2.cm2.aarch64.rpm -python3-jinja2-3.0.3-2.cm2.noarch.rpm +python3-jinja2-3.0.3-3.cm2.noarch.rpm python3-libcap-ng-0.8.2-2.cm2.aarch64.rpm python3-libs-3.9.14-8.cm2.aarch64.rpm python3-libxml2-2.10.4-2.cm2.aarch64.rpm diff --git a/toolkit/resources/manifests/package/toolchain_x86_64.txt b/toolkit/resources/manifests/package/toolchain_x86_64.txt index fc307301c7..92021a3395 100644 --- a/toolkit/resources/manifests/package/toolchain_x86_64.txt +++ b/toolkit/resources/manifests/package/toolchain_x86_64.txt @@ -521,7 +521,7 @@ python3-Cython-0.29.33-1.cm2.x86_64.rpm python3-debuginfo-3.9.14-8.cm2.x86_64.rpm python3-devel-3.9.14-8.cm2.x86_64.rpm python3-gpg-1.16.0-2.cm2.x86_64.rpm -python3-jinja2-3.0.3-2.cm2.noarch.rpm +python3-jinja2-3.0.3-3.cm2.noarch.rpm python3-libcap-ng-0.8.2-2.cm2.x86_64.rpm python3-libs-3.9.14-8.cm2.x86_64.rpm python3-libxml2-2.10.4-2.cm2.x86_64.rpm