diff options
Diffstat (limited to 'system/python3')
-rw-r--r-- | system/python3/APKBUILD | 61 | ||||
-rw-r--r-- | system/python3/CVE-2019-16056.patch | 131 | ||||
-rw-r--r-- | system/python3/fix-xattrs-glibc.patch | 15 | ||||
-rw-r--r-- | system/python3/musl-find_library.patch | 4 | ||||
-rw-r--r-- | system/python3/musl-has-login_tty.patch | 11 |
5 files changed, 45 insertions, 177 deletions
diff --git a/system/python3/APKBUILD b/system/python3/APKBUILD index 4fefa4e22..64fd5ec98 100644 --- a/system/python3/APKBUILD +++ b/system/python3/APKBUILD @@ -1,16 +1,15 @@ -# Contributor: Kiyoshi Aman <kiyoshi.aman@gmail.com> +# Contributor: Síle Ekaterin Liszka <sheila@vulpine.house> # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=python3 -pkgver=3.6.9 +pkgver=3.11.5 _basever="${pkgver%.*}" -pkgrel=1 +pkgrel=0 pkgdesc="A high-level scripting language" url="https://www.python.org" arch="all" license="Python-2.0" provides="py3-pip" -subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-tests::noarch - $pkgname-wininst" +subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-tests::noarch" # If Python 3 is installed during the build, you get: # # Installing collected packages: setuptools, pip @@ -39,8 +38,7 @@ makedepends="expat-dev openssl-dev zlib-dev ncurses-dev bzip2-dev xz-dev sqlite-dev libffi-dev tcl-dev linux-headers !python3" source="https://www.python.org/ftp/python/$pkgver/Python-$pkgver.tar.xz musl-find_library.patch - fix-xattrs-glibc.patch - CVE-2019-16056.patch + musl-has-login_tty.patch " builddir="$srcdir/Python-$pkgver" @@ -60,13 +58,21 @@ builddir="$srcdir/Python-$pkgver" # - CVE-2019-9948 # 3.6.9-r1: # - CVE-2019-16056 +# 3.6.9-r2: +# - CVE-2019-16935 +# 3.6.10-r0: +# - CVE-2019-18348 +# 3.11.0-r0: +# - CVE-2020-10735 +# - CVE-2022-37454 +# - CVE-2022-42919 +# - CVE-2022-45061 prepare() { default_prepare # force system libs rm -r Modules/expat \ - Modules/zlib \ Modules/_ctypes/darwin* \ Modules/_ctypes/libffi* } @@ -89,12 +95,12 @@ build() { --with-computed-gotos \ --with-dbmliborder=ndbm \ --with-system-expat \ - --with-system-ffi \ - --with-threads + --with-system-ffi # set thread stack size to 1MB so we don't segfault before we hit # sys.getrecursionlimit() - make EXTRA_CFLAGS="$CFLAGS -DTHREAD_STACK_SIZE=0x100000" + stacksize=0x100000; + make EXTRA_CFLAGS="$CFLAGS -DTHREAD_STACK_SIZE=$stacksize" } check() { @@ -118,6 +124,7 @@ EOF # musl related fail="test__locale test_locale test_strptime test_re" # various musl locale deficiencies + fail="$fail test_c_locale_coercion" fail="$fail test_datetime" # hangs if 'tzdata' installed fail="$fail test_os" # fpathconf, ttyname errno values fail="$fail test_posix" # sched_[gs]etscheduler not impl @@ -139,30 +146,34 @@ EOF # dumb fail="$fail test_ssl" # tries to do SSLv2 which we have disabled in OpenSSL - # needs network but doesn't declare it - fail="$fail test_normalization" + # hangs when run with other tests - run separately + fail="$fail test_threading" - # defaults from Tools/scripts/run_tests.py, with -network added - use="all,-largefile,-audio,-gui,-network" + # defaults from Tools/scripts/run_tests.py + -network,-urlfetch + use="all,-largefile,-audio,-gui,-network,-urlfetch" make quicktest TESTOPTS="--use '$use' --exclude $fail" + make test TESTOPTS="test_threading" } package() { + export XDG_CACHE_HOME="$(mktemp -d)" make -j1 DESTDIR="$pkgdir" EXTRA_CFLAGS="$CFLAGS" install maninstall install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE # those are provided by python3-tkinter rm -r "$pkgdir"/usr/bin/idle* "$pkgdir"/usr/lib/python*/idlelib \ "$pkgdir"/usr/lib/python*/tkinter + + rm -rf "$XDG_CACHE_HOME" } dev() { default_dev # pyconfig.h is needed runtime so we move it back - mkdir -p "$pkgdir"/usr/include/python${_basever}m - mv "$subpkgdir"/usr/include/python${_basever}m/pyconfig.h \ - "$pkgdir"/usr/include/python${_basever}m/ + mkdir -p "$pkgdir"/usr/include/python${_basever} + mv "$subpkgdir"/usr/include/python${_basever}/pyconfig.h \ + "$pkgdir"/usr/include/python${_basever}/ } tests() { @@ -178,14 +189,6 @@ tests() { "$subpkgdir"/usr/lib/python$_basever/ } -wininst() { - pkgdesc="Python wininst files" - mkdir -p "$subpkgdir"/usr/lib/python$_basever/distutils/command - mv "$pkgdir"/usr/lib/python$_basever/distutils/command/*.exe \ - "$subpkgdir"/usr/lib/python$_basever/distutils/command -} - -sha512sums="05de9c6f44d96a52bfce10ede4312de892573edaf8bece65926d19973a3a800d65eed7a857af945f69efcfb25efa3788e7a54016b03d80b611eb51c3ea074819 Python-3.6.9.tar.xz -ab8eaa2858d5109049b1f9f553198d40e0ef8d78211ad6455f7b491af525bffb16738fed60fc84e960c4889568d25753b9e4a1494834fea48291b33f07000ec2 musl-find_library.patch -37b6ee5d0d5de43799316aa111423ba5a666c17dc7f81b04c330f59c1d1565540eac4c585abe2199bbed52ebe7426001edb1c53bd0a17486a2a8e052d0f494ad fix-xattrs-glibc.patch -1f1eb61355eb7832bef8e9c3915895cc3b2966a30c809371430b4416260452cd39c48ba593b2259574867bd1e8fea98efbc45c4b0bd95aeb0690c8514b380ea0 CVE-2019-16056.patch" +sha512sums="93fa640bedcea449060caac8aa691aa315a19f172fd9f0422183d17749c3512d4ecac60e7599f9ef14e3cdb3c8b4b060e484c9061b1e7ee8d958200d6041e408 Python-3.11.5.tar.xz +df1c7096a7744c94312ee6cacdd54345e384bcdf2a17148163f5f4c70f0cfa80301efbcbb2398306401ec53106e5c6922ba582a7df226e718cedb53396cc4786 musl-find_library.patch +75c60afecba2e57f11d58c20aadc611ebbb5c68e05b14415c5cf2f7aa75e103986764ca22f76e6a58b2c08e2ff3acffdbf6d85d2c8c4589743a0b949a4c90687 musl-has-login_tty.patch" diff --git a/system/python3/CVE-2019-16056.patch b/system/python3/CVE-2019-16056.patch deleted file mode 100644 index b2f5ce826..000000000 --- a/system/python3/CVE-2019-16056.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 13a19139b5e76175bc95294d54afc9425e4f36c9 Mon Sep 17 00:00:00 2001 -From: "Miss Islington (bot)" - <31488909+miss-islington@users.noreply.github.com> -Date: Fri, 9 Aug 2019 08:22:19 -0700 -Subject: [PATCH] bpo-34155: Dont parse domains containing @ (GH-13079) - (GH-14826) - -Before: - - >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses - (Address(display_name='', username='a', domain='malicious.org'),) - - >>> parseaddr('a@malicious.org@important.com') - ('', 'a@malicious.org') - - After: - - >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses - (Address(display_name='', username='', domain=''),) - - >>> parseaddr('a@malicious.org@important.com') - ('', 'a@') - -https://bugs.python.org/issue34155 -(cherry picked from commit 8cb65d1381b027f0b09ee36bfed7f35bb4dec9a9) - -Co-authored-by: jpic <jpic@users.noreply.github.com> ---- - Lib/email/_header_value_parser.py | 2 ++ - Lib/email/_parseaddr.py | 11 ++++++++++- - Lib/test/test_email/test__header_value_parser.py | 10 ++++++++++ - Lib/test/test_email/test_email.py | 14 ++++++++++++++ - .../2019-05-04-13-33-37.bpo-34155.MJll68.rst | 1 + - 5 files changed, 37 insertions(+), 1 deletion(-) - create mode 100644 Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst - -diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py -index 737951e4b1b1..bc9c9b6241d4 100644 ---- a/Lib/email/_header_value_parser.py -+++ b/Lib/email/_header_value_parser.py -@@ -1561,6 +1561,8 @@ def get_domain(value): - token, value = get_dot_atom(value) - except errors.HeaderParseError: - token, value = get_atom(value) -+ if value and value[0] == '@': -+ raise errors.HeaderParseError('Invalid Domain') - if leader is not None: - token[:0] = [leader] - domain.append(token) -diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py -index cdfa3729adc7..41ff6f8c000d 100644 ---- a/Lib/email/_parseaddr.py -+++ b/Lib/email/_parseaddr.py -@@ -379,7 +379,12 @@ def getaddrspec(self): - aslist.append('@') - self.pos += 1 - self.gotonext() -- return EMPTYSTRING.join(aslist) + self.getdomain() -+ domain = self.getdomain() -+ if not domain: -+ # Invalid domain, return an empty address instead of returning a -+ # local part to denote failed parsing. -+ return EMPTYSTRING -+ return EMPTYSTRING.join(aslist) + domain - - def getdomain(self): - """Get the complete domain name from an address.""" -@@ -394,6 +399,10 @@ def getdomain(self): - elif self.field[self.pos] == '.': - self.pos += 1 - sdlist.append('.') -+ elif self.field[self.pos] == '@': -+ # bpo-34155: Don't parse domains with two `@` like -+ # `a@malicious.org@important.com`. -+ return EMPTYSTRING - elif self.field[self.pos] in self.atomends: - break - else: -diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py -index a2c900fa7fd2..02ef3e1006c6 100644 ---- a/Lib/test/test_email/test__header_value_parser.py -+++ b/Lib/test/test_email/test__header_value_parser.py -@@ -1418,6 +1418,16 @@ def test_get_addr_spec_dot_atom(self): - self.assertEqual(addr_spec.domain, 'example.com') - self.assertEqual(addr_spec.addr_spec, 'star.a.star@example.com') - -+ def test_get_addr_spec_multiple_domains(self): -+ with self.assertRaises(errors.HeaderParseError): -+ parser.get_addr_spec('star@a.star@example.com') -+ -+ with self.assertRaises(errors.HeaderParseError): -+ parser.get_addr_spec('star@a@example.com') -+ -+ with self.assertRaises(errors.HeaderParseError): -+ parser.get_addr_spec('star@172.17.0.1@example.com') -+ - # get_obs_route - - def test_get_obs_route_simple(self): -diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py -index f97ccc6711cc..68d052279987 100644 ---- a/Lib/test/test_email/test_email.py -+++ b/Lib/test/test_email/test_email.py -@@ -3035,6 +3035,20 @@ def test_parseaddr_empty(self): - self.assertEqual(utils.parseaddr('<>'), ('', '')) - self.assertEqual(utils.formataddr(utils.parseaddr('<>')), '') - -+ def test_parseaddr_multiple_domains(self): -+ self.assertEqual( -+ utils.parseaddr('a@b@c'), -+ ('', '') -+ ) -+ self.assertEqual( -+ utils.parseaddr('a@b.c@c'), -+ ('', '') -+ ) -+ self.assertEqual( -+ utils.parseaddr('a@172.17.0.1@c'), -+ ('', '') -+ ) -+ - def test_noquote_dump(self): - self.assertEqual( - utils.formataddr(('A Silly Person', 'person@dom.ain')), -diff --git a/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst b/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst -new file mode 100644 -index 000000000000..50292e29ed1d ---- /dev/null -+++ b/Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst -@@ -0,0 +1 @@ -+Fix parsing of invalid email addresses with more than one ``@`` (e.g. a@b@c.com.) to not return the part before 2nd ``@`` as valid email address. Patch by maxking & jpic. diff --git a/system/python3/fix-xattrs-glibc.patch b/system/python3/fix-xattrs-glibc.patch deleted file mode 100644 index 57a8fb73a..000000000 --- a/system/python3/fix-xattrs-glibc.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c -index 8f8ba25..72b92da 100644 ---- a/Modules/posixmodule.c -+++ b/Modules/posixmodule.c -@@ -103,8 +103,9 @@ corresponding Unix manual entries for more information on calls."); - #undef HAVE_SCHED_SETAFFINITY - #endif - --#if defined(HAVE_SYS_XATTR_H) && defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__) -+#if defined(HAVE_SYS_XATTR_H) && defined(__linux__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__) - #define USE_XATTRS -+#include <linux/limits.h> - #endif - - #ifdef USE_XATTRS diff --git a/system/python3/musl-find_library.patch b/system/python3/musl-find_library.patch index 7899abb73..6181ede0a 100644 --- a/system/python3/musl-find_library.patch +++ b/system/python3/musl-find_library.patch @@ -1,13 +1,13 @@ diff -ru Python-2.7.12.orig/Lib/ctypes/util.py Python-2.7.12/Lib/ctypes/util.py --- Python-2.7.12.orig/Lib/ctypes/util.py 2016-06-26 00:49:30.000000000 +0300 +++ Python-2.7.12/Lib/ctypes/util.py 2016-11-03 16:05:46.954665040 +0200 -@@ -204,6 +204,41 @@ +@@ -265,6 +265,41 @@ def find_library(name, is64 = False): return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name)) + elif True: + -+ # Patched for Alpine Linux / musl - search manually system paths ++ # Patched for musl to search manually system paths + def _is_elf(filepath): + try: + with open(filepath, 'rb') as fh: diff --git a/system/python3/musl-has-login_tty.patch b/system/python3/musl-has-login_tty.patch new file mode 100644 index 000000000..2ed566ee1 --- /dev/null +++ b/system/python3/musl-has-login_tty.patch @@ -0,0 +1,11 @@ +--- a/Modules/posixmodule.h ++++ b/Modules/posixmodule.h +@@ -10,6 +10,8 @@ + #include <sys/types.h> + #endif + ++int login_tty(int); /* musl 4b2cb37770e56835b261660535cea77474154ba0 */ ++ + #ifndef Py_LIMITED_API + #ifndef MS_WINDOWS + PyAPI_FUNC(PyObject *) _PyLong_FromUid(uid_t); |