Skip to content

Commit ed10399

Browse files
Anaconda: Update 'joblib' python package due to CVE-2022-21797 (#237)
* Anaconda: Patch * update utils
1 parent c1d6d9c commit ed10399

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

src/anaconda/.devcontainer/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5252
&& usermod -aG conda ${USERNAME} \
5353
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/add-notice.sh
5454

55+
# Temporary: Upgrade 'joblib' due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21797
56+
# 'joblib' is installed by the base image (continuumio/anaconda3) which does not have the patch.
57+
RUN python3 -m pip install --upgrade joblib
58+
5559
# Copy environment.yml (if found) to a temp locaition so we update the environment. Also
5660
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
5761
# COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/

src/anaconda/manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"git": {
2424
"Oh My Zsh!": "/home/vscode/.oh-my-zsh"
2525
},
26+
"pip": [
27+
"joblib"
28+
],
2629
"other": {
2730
"conda": {
2831
"cgIgnore": true,

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@ check() {
2727
fi
2828
}
2929

30+
check-version-ge() {
31+
LABEL=$1
32+
CURRENT_VERSION=$2
33+
REQUIRED_VERSION=$3
34+
shift
35+
echo -e "\n🧪 Testing $LABEL: '$CURRENT_VERSION' is >= '$REQUIRED_VERSION'"
36+
local GREATER_VERSION=$((echo ${CURRENT_VERSION}; echo ${REQUIRED_VERSION}) | sort -V | tail -1)
37+
if [ "${CURRENT_VERSION}" == "${GREATER_VERSION}" ]; then
38+
echo "✅ Passed!"
39+
return 0
40+
else
41+
echoStderr "❌ $LABEL check failed."
42+
FAILED+=("$LABEL")
43+
return 1
44+
fi
45+
}
46+
3047
checkMultiple() {
3148
PASSED=0
3249
LABEL="$1"

src/anaconda/test-project/test.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ check "yapf" yapf --version
1616
check "pydocstyle" pydocstyle --version
1717
check "pycodestyle" pycodestyle --version
1818
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm --version"
19-
check "git" git --version
2019

21-
git_version_satisfied=false
22-
if (echo a version 2.38.1; git --version) | sort -Vk3 | tail -1 | grep -q git; then
23-
git_version_satisfied=true
24-
fi
20+
git_version=$(git --version)
21+
check "git" bash -c "echo ${git_version}"
22+
check-version-ge "git-requirement" "${git_version}" "git version 2.38.1"
2523

26-
check "git version satisfies requirement" echo $git_version_satisfied | grep "true"
24+
joblib_version=$(python -c "import joblib; print(joblib.__version__)")
25+
check "joblib" bash -c "echo ${joblib_version}"
26+
check-version-ge "joblib-requirement" "${joblib_version}" "1.2.0"
2727

2828
# Report result
2929
reportResults

0 commit comments

Comments
 (0)