diff --git a/backport-CVE-2020-27783-1.patch b/backport-CVE-2020-27783-1.patch new file mode 100644 index 0000000000000000000000000000000000000000..3ae5153c258d3acf9317c4f8118ab612c20fd624 --- /dev/null +++ b/backport-CVE-2020-27783-1.patch @@ -0,0 +1,49 @@ +From 89e7aad6e7ff9ecd88678ff25f885988b184b26e Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Sun, 18 Oct 2020 10:06:46 +0200 +Subject: [PATCH] Prevent combinations of through into the output. ++ html = '', ++ lxml.html.tostring(clean_html(s))) ++ + + def test_suite(): + suite = unittest.TestSuite() +-- +1.8.3.1 + diff --git a/backport-CVE-2020-27783-2.patch b/backport-CVE-2020-27783-2.patch new file mode 100644 index 0000000000000000000000000000000000000000..69a30707daa757d059618b448c4f6cefa6c2bfe9 --- /dev/null +++ b/backport-CVE-2020-27783-2.patch @@ -0,0 +1,136 @@ +From a105ab8dc262ec6735977c25c13f0bdfcdec72a7 Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Thu, 26 Nov 2020 09:20:52 +0100 +Subject: [PATCH] Prevent combinations of and ' ++ return True + return False + + def clean_html(self, html): +diff --git a/src/lxml/html/tests/test_clean.py b/src/lxml/html/tests/test_clean.py +index 3c8ee25..0e669f9 100644 +--- a/src/lxml/html/tests/test_clean.py ++++ b/src/lxml/html/tests/test_clean.py +@@ -113,6 +113,16 @@ class CleanerTest(unittest.TestCase): + b'', + lxml.html.tostring(clean_html(s))) + ++ def test_sneaky_js_in_math_style(self): ++ # This gets parsed as -> ++ # thus passing any tag/script/whatever content through into the output. ++ html = '' ++ s = lxml.html.fragment_fromstring(html) ++ ++ self.assertEqual( ++ b'', ++ lxml.html.tostring(clean_html(s))) ++ + + def test_suite(): + suite = unittest.TestSuite() +diff --git a/src/lxml/html/tests/test_clean.txt b/src/lxml/html/tests/test_clean.txt +index 275be07..18e6c7e 100644 +--- a/src/lxml/html/tests/test_clean.txt ++++ b/src/lxml/html/tests/test_clean.txt +@@ -104,7 +104,11 @@ + >>> print(Cleaner(page_structure=False, comments=False).clean_html(doc)) + + +- ++ + + + +@@ -126,7 +130,11 @@ + >>> print(Cleaner(page_structure=False, safe_attrs_only=False).clean_html(doc)) + + +- ++ + + + a link +@@ -190,7 +198,11 @@ + + + +- ++ + + + a link +-- +1.8.3.1 + diff --git a/python-lxml.spec b/python-lxml.spec index c6b1b59f20bccec9d2a1e49e688a30d03c1a4d93..5e9b6c499ce033a4d35509109845546e3871c5cd 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -7,12 +7,15 @@ The latest release works with all CPython versions from 2.7 to 3.7. Name: python-%{modname} Version: 4.5.2 -Release: 1 +Release: 2 Summary: XML processing library combining libxml2/libxslt with the ElementTree API License: BSD URL: http://lxml.de Source0: http://lxml.de/files/%{modname}-%{version}.tgz +Patch6000: backport-CVE-2020-27783-1.patch +Patch6001: backport-CVE-2020-27783-2.patch + BuildRequires: gcc libxml2-devel libxslt-devel %description %{_description} @@ -34,7 +37,7 @@ BuildRequires: python3-devel python3-setuptools python3-Cython %package_help %prep -%autosetup -n %{modname}-%{version} +%autosetup -n %{modname}-%{version} -p1 %build export WITH_CYTHON=true @@ -63,6 +66,9 @@ export WITH_CYTHON=true %doc README.rst src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt %changelog +* Fri Feb 05 2021 shixuantong - 4.5.2-2 +- fix CVE-2020-27783 + * Fri Aug 21 2020 SimpleUpdate Robot - 4.5.2-1 - Upgrade to version 4.5.2