!12 [sync] PR-9: Fix CVE-2022-40899
From: @openeuler-sync-bot Reviewed-by: @caodongxia Signed-off-by: @caodongxia
This commit is contained in:
commit
b3717346bb
52
CVE-2022-40899.patch
Normal file
52
CVE-2022-40899.patch
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
From c91d70b34ef0402aef3e9d04364ba98509dca76f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Will Shanks <wshaos@posteo.net>
|
||||||
|
Date: Fri, 23 Dec 2022 13:38:26 -0500
|
||||||
|
Subject: [PATCH] Backport fix for bpo-38804
|
||||||
|
|
||||||
|
The regex http.cookiejar.LOOSE_HTTP_DATE_RE was vulnerable to regular
|
||||||
|
expression denial of service (REDoS). The regex contained multiple
|
||||||
|
overlapping \s* capture groups. A long sequence of spaces can trigger
|
||||||
|
bad performance.
|
||||||
|
|
||||||
|
See https://github.com/python/cpython/pull/17157 and https://pyup.io/posts/pyup-discovers-redos-vulnerabilities-in-top-python-packages/
|
||||||
|
---
|
||||||
|
src/future/backports/http/cookiejar.py | 18 ++++++++++++------
|
||||||
|
1 file changed, 12 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/future/backports/http/cookiejar.py b/src/future/backports/http/cookiejar.py
|
||||||
|
index af3ef415..0ad80a02 100644
|
||||||
|
--- a/src/future/backports/http/cookiejar.py
|
||||||
|
+++ b/src/future/backports/http/cookiejar.py
|
||||||
|
@@ -225,10 +225,14 @@ def _str2time(day, mon, yr, hr, min, sec, tz):
|
||||||
|
(?::(\d\d))? # optional seconds
|
||||||
|
)? # optional clock
|
||||||
|
\s*
|
||||||
|
- ([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+)? # timezone
|
||||||
|
+ (?:
|
||||||
|
+ ([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+) # timezone
|
||||||
|
+ \s*
|
||||||
|
+ )?
|
||||||
|
+ (?:
|
||||||
|
+ \(\w+\) # ASCII representation of timezone in parens.
|
||||||
|
\s*
|
||||||
|
- (?:\(\w+\))? # ASCII representation of timezone in parens.
|
||||||
|
- \s*$""", re.X | re.ASCII)
|
||||||
|
+ )?$""", re.X | re.ASCII)
|
||||||
|
def http2time(text):
|
||||||
|
"""Returns time in seconds since epoch of time represented by a string.
|
||||||
|
|
||||||
|
@@ -298,9 +302,11 @@ def http2time(text):
|
||||||
|
(?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional)
|
||||||
|
)? # optional clock
|
||||||
|
\s*
|
||||||
|
- ([-+]?\d\d?:?(:?\d\d)?
|
||||||
|
- |Z|z)? # timezone (Z is "zero meridian", i.e. GMT)
|
||||||
|
- \s*$""", re.X | re. ASCII)
|
||||||
|
+ (?:
|
||||||
|
+ ([-+]?\d\d?:?(:?\d\d)?
|
||||||
|
+ |Z|z) # timezone (Z is "zero meridian", i.e. GMT)
|
||||||
|
+ \s*
|
||||||
|
+ )?$""", re.X | re. ASCII)
|
||||||
|
def iso2time(text):
|
||||||
|
"""
|
||||||
|
As for http2time, but parses the ISO 8601 formats:
|
||||||
@ -10,11 +10,12 @@ you can convert you Python code to support both version.
|
|||||||
|
|
||||||
Name: future
|
Name: future
|
||||||
Version: 0.18.2
|
Version: 0.18.2
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Missing compatibility layer on Python 3
|
Summary: Missing compatibility layer on Python 3
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: http://python-future.org/
|
URL: http://python-future.org/
|
||||||
Source0: https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz
|
Source0: https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz
|
||||||
|
Patch0: CVE-2022-40899.patch
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -29,7 +30,7 @@ BuildRequires: python3-devel python3-setuptools python3-numpy python3-requests
|
|||||||
%{desc}
|
%{desc}
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup
|
%autosetup -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
CFLAGS="%{optflags}" %{__python3} setup.py build --executable="%{__python3} -s"
|
CFLAGS="%{optflags}" %{__python3} setup.py build --executable="%{__python3} -s"
|
||||||
@ -68,6 +69,9 @@ PYTHONPATH=$PWD/build/lib py.test-3 -v
|
|||||||
%{python3_sitelib}/*
|
%{python3_sitelib}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Mar 10 2023 yaoxin <yaoxin30@h-partners.com> - 0.18.2-2
|
||||||
|
- Fix CVE-2022-40899
|
||||||
|
|
||||||
* Wed Jul 14 2021 liksh <liks11@chinaunicom.cn> - 0.18.2-1
|
* Wed Jul 14 2021 liksh <liks11@chinaunicom.cn> - 0.18.2-1
|
||||||
- update package from 0.16.0 to 0.18.2
|
- update package from 0.16.0 to 0.18.2
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user