Skip to content

Commit c063ec2

Browse files
authored
OpenSSL 2023.09 updates. (#175)
* Updated brink.conf from server repo. * Updated OpenSSL sources to version 1.1.1w. * Updated OpenSSL 1.1.1 version to build. * Patched OpenSSL 1.0.2 sources for CVE-2023-0286. * OpenSSL version string fixes. * Exclude safety checks for cryptography's OpenSSL and requests. * Exclude one more safety check for certifi. * Updated macOS label to use. * Try specifying the full path to the choco binary. * Try fixing the Python build on macOS 11. * Exclude one more safety check for pywin32. * Try reverting to brink.conf from master. * Revert "Try reverting to brink.conf from master." This reverts commit 12b1845. * Try the py2-support branch of compat. * Try fixing more issues on macOS 11. * Patch cryptography for CVE-2023-23931 when built w/o pip. * Try fixing `cryptography` 3.3.2 too for CVE-2023-23931. * Try updating psutil to 5.9.5 on all platforms. * Updated SQLite sources to version 3.43.1. * Updated SQLite Windows DLLs to version 3.43.1. * Updated SQLite version to build to latest: 3.43.1. * Updated zlib sources to version 1.3. * Updated SQLite version to build to latest: 1.3. * Updated external deps sheets. * Updated external deps sheets (bis). * Changes after own review. * Updated external deps sheets after own review. * Try building the ARM64 package on Amazon 2 running on Laja. * Try fixing the ARM64 build. * Try fixing the ARM64 build, take two. * Try fixing the ARM64 build, take three. * Try fixing CVE-2021-3177 for Python. * Try fixing CVE-2023-24329 for Python. * CVE-2021-3177 is not fixable on Windows. * Fix the patch for CVE-2023-24329. * Updated external deps stuff. * Updated comments for safety's ignored opts. * Try sleeping 10s before hacking GHA's macOS Homebrew setup. * Changes after own review.
1 parent 52fb2f5 commit c063ec2

5,702 files changed

Lines changed: 21581 additions & 12645 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/bare.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
strategy:
3030
fail-fast: false
3131
matrix:
32-
# ARM64 is currently our virtualized Ubuntu 16.04 image.
33-
runs-on: [ ubuntu-20.04, ubuntu-18.04, ARM64 ]
32+
# The ARM64 build actually runs on an Amazon Docker container on Laja.
33+
runs-on: [ ubuntu-20.04, ubuntu-18.04, amzn-2-arm64 ]
3434
timeout-minutes: 120
3535
steps:
3636
- name: Prepare OS
@@ -96,13 +96,14 @@ jobs:
9696
strategy:
9797
fail-fast: false
9898
matrix:
99-
runs-on: [ macos-10.15 ]
99+
runs-on: [ macos-11 ]
100100
timeout-minutes: 60
101101
steps:
102102
# Avoid linking to Homebrew's libintl during build.
103103
# Needed tools are to be used from /usr/bin.
104104
- name: Hack Homebrew
105105
run: |
106+
sleep 10
106107
sudo find /usr/local -name 'libffi*' -exec chmod a-r {} +
107108
sudo find /usr/local -name 'libintl*' -exec chmod a-r {} +
108109
sudo rm -f /usr/local/bin/{wget,curl,git}
@@ -173,7 +174,7 @@ jobs:
173174
- name: Prepare OS
174175
shell: powershell
175176
run: |
176-
chocolatey install --yes --no-progress make nasm 7zip curl
177+
choco install --yes --no-progress make nasm 7zip curl
177178
# There's no vcpython27 choco pkg since Microsoft removed the installer.
178179
Start-BitsTransfer https://bin.chevah.com:20443/third-party-stuff/VCForPython27.msi
179180
msiexec /quiet /i VCForPython27.msi

brink.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
BASE_REQUIREMENTS='pip==20.3.4chevah chevah-brink==0.79.0 paver==1.2.4'
2-
PYTHON_CONFIGURATION='default@2.7.18.90dc4a6'
1+
BASE_REQUIREMENTS='pip==20.3.4chevah1 chevah-brink==0.79.0 paver==1.2.4'
2+
PYTHON_CONFIGURATION='default@2.7.18.52fb2f5'
33
# For production packages there are 2 options:
44
BINARY_DIST_URI='https://github.com/chevah/python-package/releases/download'
55
#BINARY_DIST_URI='https://bin.chevah.com:20443/production'

brink.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,14 +640,14 @@ check_glibc_version(){
640640

641641
# Supported minimum minor glibc 2.X versions for various arches.
642642
# For x64, we build on CentOS 5.11 (Final) with glibc 2.5.
643-
# For arm64, we build on Ubuntu 16.04 with glibc 2.23.
643+
# For arm64, we build on Amazon Linux 2 with glibc 2.26.
644644
# Beware we haven't normalized arch names yet.
645645
case "$ARCH" in
646646
"amd64"|"x86_64"|"x64")
647647
supported_glibc2_version=5
648648
;;
649649
"aarch64"|"arm64")
650-
supported_glibc2_version=23
650+
supported_glibc2_version=26
651651
;;
652652
*)
653653
(>&2 echo "$ARCH is an unsupported arch for generic Linux!")
@@ -658,7 +658,7 @@ check_glibc_version(){
658658
echo "No specific runtime for the current distribution / version / arch."
659659
echo "Minimum glibc version for this arch: 2.${supported_glibc2_version}."
660660

661-
# Tested with glibc 2.5/2.11.3/2.12/2.23/2.28-31 and eglibc 2.13/2.19.
661+
# Tested with glibc 2.5/2.11.3/2.12/2.23/2.26/2.28-31 and eglibc 2.13/2.19.
662662
glibc_version=$(head -n 1 $ldd_output_file | rev | cut -d\ -f1 | rev)
663663
rm $ldd_output_file
664664

chevah_build

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ set -o pipefail # don't ignore exit codes when piping output
1414

1515
PYTHON_BUILD_VERSION="2.7.18"
1616
LIBFFI_VERSION="3.4.4"
17-
ZLIB_VERSION="1.2.13"
17+
ZLIB_VERSION="1.3"
1818
BZIP2_VERSION="1.0.8"
1919
# We statically build the BSD libedit on selected platforms to get the
2020
# readline module available without linking to the GPL-only readline libs.
2121
LIBEDIT_VERSION="20170329-3.1"
22-
OPENSSL_VERSION="1.1.1t"
23-
SQLITE_VERSION="3.40.1"
22+
OPENSSL_VERSION="1.1.1w"
23+
SQLITE_VERSION="3.43.1"
2424

2525
# Python modules versions to be used everywhere possible.
2626
PYSQLITE_VERSION="2.8.3"
2727
CFFI_VERSION="1.15.1"
2828
SCANDIR_VERSION="1.10.0"
29-
PSUTIL_VERSION="5.9.3"
29+
PSUTIL_VERSION="5.9.5"
3030
SUBPROCESS32_VERSION="3.5.4"
3131

3232
# Versions no longer upgradable because of Python 2 deprecation.
@@ -35,14 +35,29 @@ PYOPENSSL_VERSION="21.0.0"
3535
# Backported fix for https://github.com/pypa/pip/issues/9827
3636
# at https://github.com/chevah/pip/tree/20.3.4chevah.
3737
PIP_VERSION="20.3.4chevah1"
38-
# For pip <21.1, click <8.0.0, dparse <0.5.2, wheel <0.38.0, safety <2.2.0,
39-
# setuptools <65.5.1, certifi <2022.12.07.
40-
SAFETY_IGNORED_OPTS="-i 40291 -i 47833 -i 50571 -i 51499 -i 51358 -i 52495 -i 52365"
38+
# For safety alerts, we need to ignore some vulnerabilities which are either:
39+
# * not present in the final tarball, e.g. for wheel, safety, etc.,
40+
# * not at all relevant, e.g. those for cryptography's bundled openssl,
41+
# * not actually relevant for these old versions, e.g. 53048 for cryptography,
42+
# * patched by us, e.g. 40291 for pip, 53048 for cryptography,
43+
# * not patched: 52495 for setuptools.
44+
# pip <21.1, click <8, dparse <0.5.2, wheel <0.38, safety <2.2, pywin32 <301.
45+
SAFETY_IGNORED_OPTS="-i 40291 -i 47833 -i 50571 -i 51499 -i 51358 -i 54687"
46+
# setuptools <65.5.1, requests <2.31.0, certifi <2023.07.22.
47+
SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 52495 -i 58755 -i 52365 -i 59956"
48+
# These are related to cryptography's bundled OpenSSL libs. We don't use those.
49+
SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 53306 -i 53298 -i 53305 -i 53301"
50+
SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 53307 -i 53304 -i 53302 -i 53299"
51+
SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 53303 -i 59062 -i 60225 -i 60223"
52+
SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 60224"
53+
# Other cryptography vulnerabilities, see a few lines above for more details.
54+
SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 53048 -i 59473"
4155
# setuptools 44.x is the last series to support Python 2.7.
4256
# More at https://github.com/pypa/setuptools/pull/1955.
4357
SETUPTOOLS_VERSION="44.1.1"
44-
# Version 3.2.1 is used with OpenSSL 1.0.2 libs.
45-
CRYPTOGRAPHY_VERSION="3.3.2"
58+
# Version 3.2.1 (with patches) from python-modules/ is used with OpenSSL 1.0.2.
59+
# Our patched versions fix CVE-2023-23931.
60+
CRYPTOGRAPHY_VERSION="3.3.2chevah"
4661
# bcrypt 3.2.0 requires at least Python 3.6.
4762
BCRYPT_VERSION="3.1.7"
4863
# setproctitle 1.2.x requires at least Python 3.6.
@@ -164,7 +179,7 @@ case $OS in
164179
# MSYS2's Perl is not good enough for building OpenSSL.
165180
export PATH="/c/Strawberry/perl/bin/:$PATH:/c/Program Files/NASM/"
166181
export BUILD_OPENSSL="yes"
167-
# Extra libraries are installed only using PIP.
182+
# Python modules are installed only using PIP.
168183
EXTRA_LIBRARIES=""
169184
PIP_LIBRARIES="$PIP_LIBRARIES \
170185
pywin32==${PYWIN32_VERSION} \
@@ -202,8 +217,8 @@ case $OS in
202217
export BUILD_LIBEDIT="no"
203218
# As of January 2021, OpenSSL 1.0.2u is the latest version from IBM.
204219
export BUILD_OPENSSL="yes"
205-
# 1.1.1 tests fail on AIX, use 1.0.2 with patches from Ubuntu 16.04 LTS.
206-
OPENSSL_VERSION="1.0.2v-chevah4"
220+
# 1.1.1 tests fail on AIX, use 1.0.2 with patches from CentOS 7.
221+
OPENSSL_VERSION="1.0.2v-chevah5"
207222
# Perl's Test::Simple and its deps are required for building OpenSSL.
208223
execute perl -MTest::Simple -e 1
209224
# cryptography 3.2.x, last version to support OpenSSL 1.0.2.
@@ -236,9 +251,13 @@ case $OS in
236251
export BUILD_LIBFFI="yes"
237252
# OpenSSL 1.0.2 has extended support: https://tinyurl.com/2ck2sm6s.
238253
export CRYPTOGRAPHY_ALLOW_OPENSSL_102="yes"
239-
# Put cryptography back, to build it against system OpenSSL.
254+
# Build cryptography against system OpenSSL with our patches.
240255
# cryptography 3.2.1, last version working with OpenSSL 1.0.2.
241-
PIP_LIBRARIES="cryptography==3.2.1 $PIP_LIBRARIES_OPENSSL_102"
256+
EXTRA_LIBRARIES="$EXTRA_LIBRARIES \
257+
python-modules/cryptography-3.2.1 \
258+
"
259+
# Use the appropriate PIP_LIBRARIES env var.
260+
PIP_LIBRARIES="$PIP_LIBRARIES_OPENSSL_102"
242261
add_ignored_safety_ids_for_cryptography32
243262
;;
244263
macos)
@@ -250,8 +269,12 @@ case $OS in
250269
# setup.py skips building readline by default, as it sets this to
251270
# "10.4", and then tries to avoid the broken readline in OS X 10.4.
252271
export MACOSX_DEPLOYMENT_TARGET=10.12
253-
# System includes bzip2 libs by default.
254-
export BUILD_BZIP2="no"
272+
# System included bzip2 libs by default up to and including macOS 10.15.
273+
export BUILD_BZIP2="yes"
274+
# Apparently, macOS 11 doesn't include zlib libraries either.
275+
export BUILD_ZLIB="yes"
276+
# Building readline fails on macOS 11, didn't look into it.
277+
export BUILD_LIBEDIT="no"
255278
# 10.13 and newer come with LibreSSL instead of the old OpenSSL libs.
256279
# But 10.13 has version 2.2.7, while cryptography 2.9 requires 2.7.
257280
# Therefore, we build OpenSSL for both stdlib and cryptography.
@@ -302,18 +325,6 @@ case $OS in
302325
export PATH="/usr/local/bin:$PATH"
303326
# In particular, Perl's Test::Simple and its deps are required.
304327
execute perl -MTest::Simple -e 1
305-
# Version 5.9.2-5.9.4 of psutil not working properly on CentOS 5.
306-
# More at https://github.com/giampaolo/psutil/issues/2164.
307-
# Should be fixed with the 5.9.5 release.
308-
PIP_LIBRARIES="\
309-
cryptography==${CRYPTOGRAPHY_VERSION} \
310-
pyOpenSSL==${PYOPENSSL_VERSION} \
311-
scandir==${SCANDIR_VERSION} \
312-
subprocess32==${SUBPROCESS32_VERSION} \
313-
bcrypt==${BCRYPT_VERSION} \
314-
psutil=="5.9.1" \
315-
setproctitle==${SETPROCTITLE_VERSION}
316-
"
317328
;;
318329
*)
319330
# Only supported Linux distributions should be left.
@@ -706,6 +717,10 @@ command_test() {
706717

707718
echo '##### Testing for outdated packages and security issues... #####'
708719
execute $PYTHON_BIN -m pip list --outdated --format=columns
720+
# Install wheel back for better collection of needed dependencies.
721+
execute $PYTHON_BIN -m pip install $PIP_ARGS wheel
722+
# Move include/ back for building some deps, like Cython on ARM64.
723+
execute mv $INSTALL_FOLDER/lib/include $INSTALL_FOLDER/
709724
# Safety needs PyYAML, which needs Cython, which needs to be built on AIX.
710725
aix_ld_hack init
711726
# This is the newest version that still works with Python 2.7.x.
@@ -742,8 +757,8 @@ command_test() {
742757
(>&2 echo -e "\tSkipping because of upstream issues.")
743758
;;
744759
lnx*)
745-
if [ x${CHEVAH_CONTAINER-} = x"yes" ]; then
746-
(>&2 echo -e "\tSkipping as it fails under Docker on CentOS 5.")
760+
if [ -f /.dockerenv ]; then
761+
(>&2 echo -e "\tSkipping as it fails under Docker.")
747762
else
748763
execute $PYTHON_BIN ${SCANDIR_FOLDER}/test/run_tests.py
749764
fi
@@ -771,7 +786,7 @@ command_compat() {
771786
execute pushd build
772787
echo '##### Running chevah.compat tests... #####'
773788
execute rm -rf compat
774-
execute git clone https://github.com/chevah/compat.git --depth=1 -b master
789+
execute git clone https://github.com/chevah/compat.git --depth=1 -b py2-support
775790
execute pushd compat
776791
# Copy over current brink stuff, as some changes might require it.
777792
execute cp ../../brink.{conf,sh} ./
@@ -784,8 +799,6 @@ command_compat() {
784799
execute cp -r ../$LOCAL_PYTHON_BINARY_DIST cache/
785800
# Make sure everything is done from scratch in the current dir.
786801
unset CHEVAH_CACHE CHEVAH_BUILD
787-
# Install wheel back for the compat tests.
788-
execute $PYTHON_BIN -m pip install $PIP_ARGS wheel
789802
# Some tests might fail due to causes which are not related to python.
790803
execute ./brink.sh deps
791804
if [ "${CHEVAH_CONTAINER:-}" = "yes" ]; then

0 commit comments

Comments
 (0)