Skip to content

Commit 9bb5c4f

Browse files
[MIniconda] - Cryptography - Patch security vulnerability - GHSA-3ww4-gg4f-jr7f (#965)
* [MIniconda] - Cryptography - Patch security vulnerability - GHSA-3ww4-gg4f-jr7f * changes according to comments * install pyopenssl v24.0.0 * Added tests to show that pip works correctly
1 parent af4be44 commit 9bb5c4f

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

src/miniconda/.devcontainer/Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ FROM continuumio/miniconda3 as upstream
77
# <package_name> = <version>
88

99
RUN conda install \
10-
# https://github.com/advisories/GHSA-jfhm-5ghh-2f97
11-
cryptography==41.0.7
10+
# https://github.com/advisories/GHSA-3ww4-gg4f-jr7f
11+
cryptography==42.0.2
12+
13+
RUN python3 -m pip install --upgrade \
14+
# installed for compatibility with cryptography v42.0.2
15+
pyopenssl==24.0.0
1216

1317
# Reset and copy updated files with updated privs to keep image size down
1418
FROM mcr.microsoft.com/devcontainers/base:1-bullseye

src/miniconda/test-project/test-utils.sh

+26
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,29 @@ checkCondaPackageVersion()
180180
current_version=$(conda list "${PACKAGE}" | grep -E "^${PACKAGE}\s" | awk '{print $2}')
181181
check-version-ge "conda-${PACKAGE}-requirement" "${current_version}" "${REQUIRED_VERSION}"
182182
}
183+
184+
# Function to check if a package is installed
185+
checkPackageInstalled() {
186+
if python -c "import $1" &>/dev/null; then
187+
echo -e "\n✅ Passed! \n$1 is installed"
188+
else
189+
echo -e "$1 is NOT installed\n"
190+
echoStderr "❌ check failed."
191+
fi
192+
}
193+
194+
# Function to install a package using pip
195+
installPackage() {
196+
python3 -m pip install "$1"
197+
}
198+
199+
checkPipWorkingCorrectly() {
200+
# List of packages to install via pip
201+
packages=("numpy" "requests" "matplotlib")
202+
# Install packages and check if installation was successful
203+
for package in "${packages[@]}"; do
204+
echo -e "\n🧪 Testing pip install $package\n"
205+
installPackage "$package"
206+
checkPackageInstalled "$package"
207+
done
208+
}

src/miniconda/test-project/test.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ check "gitconfig-contains-name" sh -c "cat /etc/gitconfig | grep 'name = devcont
1818

1919
check "usr-local-etc-config-does-not-exist" test ! -f "/usr/local/etc/gitconfig"
2020

21-
checkPythonPackageVersion "cryptography" "41.0.7"
21+
checkPythonPackageVersion "cryptography" "42.0.2"
2222
checkPythonPackageVersion "setuptools" "65.5.1"
2323
checkPythonPackageVersion "wheel" "0.38.1"
2424

25-
checkCondaPackageVersion "cryptography" "41.0.7"
26-
checkCondaPackageVersion "pyopenssl" "23.2.0"
25+
checkCondaPackageVersion "cryptography" "42.0.2"
26+
checkCondaPackageVersion "pyopenssl" "24.0.0"
2727
checkCondaPackageVersion "setuptools" "65.5.1"
2828
checkCondaPackageVersion "wheel" "0.38.1"
2929
checkCondaPackageVersion "requests" "2.31.0"
@@ -33,5 +33,7 @@ check "conda-update-conda" bash -c "conda update -y conda"
3333
check "conda-install-tensorflow" bash -c "conda create --name test-env -c conda-forge --yes tensorflow"
3434
check "conda-install-pytorch" bash -c "conda create --name test-env -c conda-forge --yes pytorch"
3535

36+
checkPipWorkingCorrectly
37+
3638
# Report result
3739
reportResults

0 commit comments

Comments
 (0)