Skip to content

Commit bf5bd6a

Browse files
[anaconda] Update Conda packages due to GHSA-j8r2-6x86-q33q and GHSA-5cpq-8wj7-hf2v (#679)
* Address GHSA-j8r2-6x86-q33q and GHSA-5cpq-8wj7-hf2v * Add tests * Restart checks * Test: Lock upstream version
1 parent 0f0973a commit bf5bd6a

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

src/anaconda/.devcontainer/Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM continuumio/anaconda3 as upstream
1+
FROM continuumio/anaconda3:2023.03-1 as upstream
22

33
# Verify OS version is expected one
44
RUN . /etc/os-release && if [ "${VERSION_CODENAME}" != "bullseye" ]; then exit 1; fi
@@ -58,9 +58,7 @@ RUN python3 -m pip install \
5858
werkzeug \
5959
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32862
6060
nbconvert \
61-
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-32681
62-
requests \
63-
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28370
61+
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28370
6462
tornado
6563

6664
# Copy environment.yml (if found) to a temp location so we can update the environment. Also
@@ -74,6 +72,15 @@ RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bi
7472
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
7573
# && apt-get -y install --no-install-recommends <your-package-list-here>
7674

75+
# Temporary: Upgrade python packages due to mentioned CVEs
76+
# They are installed by the base image (continuumio/anaconda3) which does not have the patch.
77+
RUN conda install \
78+
# https://github.com/advisories/GHSA-5cpq-8wj7-hf2v
79+
pyopenssl=23.2.0 \
80+
cryptography=41.0.2 \
81+
# https://github.com/advisories/GHSA-j8r2-6x86-q33q
82+
requests=2.31.0
83+
7784
# Create conda group, update conda directory permissions,
7885
# add user to conda group
7986
# Note: We need to execute these commands after pip install / conda update

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,11 @@ checkPythonPackageVersion()
171171
current_version=$(python -c "import ${PACKAGE}; print(${PACKAGE}.__version__)")
172172
check-version-ge "${PACKAGE}-requirement" "${current_version}" "${REQUIRED_VERSION}"
173173
}
174+
175+
checkCondaPackageVersion()
176+
{
177+
PACKAGE=$1
178+
REQUIRED_VERSION=$2
179+
current_version=$(conda list "${PACKAGE}" | grep -E "^${PACKAGE}\s" | awk '{print $2}')
180+
check-version-ge "conda-${PACKAGE}-requirement" "${current_version}" "${REQUIRED_VERSION}"
181+
}

src/anaconda/test-project/test.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,19 @@ checkPythonPackageVersion "nbconvert" "6.5.1"
4141
checkPythonPackageVersion "werkzeug" "2.2.3"
4242
checkPythonPackageVersion "certifi" "2022.12.07"
4343
checkPythonPackageVersion "requests" "2.31.0"
44+
checkPythonPackageVersion "cryptography" "41.0.2"
4445

4546
# The `tornado` package doesn't have the `__version__` attribute so we can use the `version` attribute.
4647
tornado_version=$(python -c "import tornado; print(tornado.version)")
4748
check-version-ge "tornado-requirement" "${tornado_version}" "6.3.2"
4849

50+
checkCondaPackageVersion "pyopenssl" "23.2.0"
51+
checkCondaPackageVersion "cryptography" "41.0.2"
52+
checkCondaPackageVersion "requests" "2.31.0"
53+
4954
check "conda-update-conda" bash -c "conda update -y conda"
50-
check "conda-install" bash -c "conda install -c conda-forge --yes tensorflow"
51-
check "conda-install" bash -c "conda install -c conda-forge --yes pytorch"
55+
check "conda-install-tensorflow" bash -c "conda install -c conda-forge --yes tensorflow"
56+
check "conda-install-pytorch" bash -c "conda install -c conda-forge --yes pytorch"
5257

5358
# Report result
5459
reportResults

0 commit comments

Comments
 (0)