python-tqdm: patch CVE-2024-34062 (#9089)
This commit is contained in:
Родитель
4a467cb5ae
Коммит
0dae270f9e
|
@ -0,0 +1,60 @@
|
|||
From b53348c73080b4edeb30b4823d1fa0d8d2c06721 Mon Sep 17 00:00:00 2001
|
||||
From: Casper da Costa-Luis <tqdm@cdcl.ml>
|
||||
Date: Wed, 1 May 2024 14:56:01 +0100
|
||||
Subject: [PATCH] cli: eval safety
|
||||
|
||||
- fixes GHSA-g7vv-2v7x-gj9p
|
||||
---
|
||||
tqdm/cli.py | 33 ++++++++++++++++++++++-----------
|
||||
1 file changed, 22 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/tqdm/cli.py b/tqdm/cli.py
|
||||
index 1223d4977..7284f28d5 100644
|
||||
--- a/tqdm/cli.py
|
||||
+++ b/tqdm/cli.py
|
||||
@@ -21,23 +21,34 @@ def cast(val, typ):
|
||||
return cast(val, t)
|
||||
except TqdmTypeError:
|
||||
pass
|
||||
- raise TqdmTypeError(val + ' : ' + typ)
|
||||
+ raise TqdmTypeError(f"{val} : {typ}")
|
||||
|
||||
# sys.stderr.write('\ndebug | `val:type`: `' + val + ':' + typ + '`.\n')
|
||||
if typ == 'bool':
|
||||
if (val == 'True') or (val == ''):
|
||||
return True
|
||||
- elif val == 'False':
|
||||
+ if val == 'False':
|
||||
return False
|
||||
- else:
|
||||
- raise TqdmTypeError(val + ' : ' + typ)
|
||||
- try:
|
||||
- return eval(typ + '("' + val + '")')
|
||||
- except Exception:
|
||||
- if typ == 'chr':
|
||||
- return chr(ord(eval('"' + val + '"'))).encode()
|
||||
- else:
|
||||
- raise TqdmTypeError(val + ' : ' + typ)
|
||||
+ raise TqdmTypeError(val + ' : ' + typ)
|
||||
+ if typ == 'chr':
|
||||
+ if len(val) == 1:
|
||||
+ return val.encode()
|
||||
+ if re.match(r"^\\\w+$", val):
|
||||
+ return eval(f'"{val}"').encode()
|
||||
+ raise TqdmTypeError(f"{val} : {typ}")
|
||||
+ if typ == 'str':
|
||||
+ return val
|
||||
+ if typ == 'int':
|
||||
+ try:
|
||||
+ return int(val)
|
||||
+ except ValueError as exc:
|
||||
+ raise TqdmTypeError(f"{val} : {typ}") from exc
|
||||
+ if typ == 'float':
|
||||
+ try:
|
||||
+ return float(val)
|
||||
+ except ValueError as exc:
|
||||
+ raise TqdmTypeError(f"{val} : {typ}") from exc
|
||||
+ raise TqdmTypeError(f"{val} : {typ}")
|
||||
|
||||
|
||||
def posix_pipe(fin, fout, delim=b'\\n', buf_size=256,
|
|
@ -7,12 +7,13 @@ with "tqdm(iterable)", and you are done!
|
|||
Summary: Fast, Extensible Progress Meter
|
||||
Name: python-%{srcname}
|
||||
Version: 4.63.1
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
License: MPLv2.0 AND MIT
|
||||
Vendor: Microsoft Corporation
|
||||
Distribution: Mariner
|
||||
URL: https://github.com/tqdm/tqdm
|
||||
Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{srcname}-%{version}.tar.gz
|
||||
Patch0: CVE-2024-34062.patch
|
||||
BuildArch: noarch
|
||||
|
||||
%description %{_description}
|
||||
|
@ -30,7 +31,7 @@ BuildRequires: python3-wheel
|
|||
Python 3 version.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{srcname}-%{version}
|
||||
%autosetup -n %{srcname}-%{version} -p1
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
|
@ -55,6 +56,9 @@ tox -e setup.py
|
|||
|
||||
|
||||
%changelog
|
||||
* Mon May 13 2024 Jonathan Behrens <jbehrens@microsoft.com> - 4.63.1-3
|
||||
- Patch CVE-2024-34062
|
||||
|
||||
* Fri Dec 16 2022 Sam Meluch <sammeluch@microsoft.com> - 4.63.1-2
|
||||
- Update version of tox used for package tests
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче