Skip to content

Commit f60dd55

Browse files
[universal] Update npm due to GHSA-c2qf-rxjj-qqgw (#700)
* Lock `dotnet` version to resolve issue with Oryx * Update `patch-python` feature - Remove `setuptools` patch for Python 3.10 since not required anymore; - Lock versions for packages; * Add patch for GHSA-c2qf-rxjj-qqgw * Fix tests * Update manifest.json * Update tests * Resolve review comment: Lock `setuptools` package version for Python 3.10 * Reworked patch * Test: Update PIP for Python 3.10 * Revert "Test: Update PIP for Python 3.10" This reverts commit 6ddb26b. * Test: Update Python * Revert "Test: Update Python" This reverts commit eb2d238. * Restart checks * test: Add trace commands * Revert "test: Add trace commands" This reverts commit 9447967. * Explicitly set `useOryxIfAvailable` to `false`
1 parent 6aee5de commit f60dd55

File tree

6 files changed

+30
-7
lines changed

6 files changed

+30
-7
lines changed

src/universal/.devcontainer/devcontainer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"userGid": "1000"
1111
},
1212
"ghcr.io/devcontainers/features/dotnet:1": {
13-
"version": "7",
13+
"version": "7.0.306",
1414
"installUsingApt": "false",
1515
"additionalVersions": "6"
1616
},
@@ -26,7 +26,8 @@
2626
"version": "3.10.8",
2727
"additionalVersions": "3.9.16",
2828
"installJupyterlab": "true",
29-
"configureJupyterlabAllowOrigin": "*"
29+
"configureJupyterlabAllowOrigin": "*",
30+
"useOryxIfAvailable": "false",
3031
},
3132
"./local-features/machine-learning-packages": "latest",
3233
"ghcr.io/devcontainers/features/php:1": {

src/universal/.devcontainer/local-features/patch-python/install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ update_package() {
4141
# They are installed by the base image (python) which does not have the patch.
4242

4343
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-40897
44-
update_package /usr/local/python/3.9.*/bin/python setuptools
45-
update_package /usr/local/python/3.10.*/bin/python setuptools
44+
update_package /usr/local/python/3.9.*/bin/python setuptools==65.5.1
45+
update_package /usr/local/python/3.10.*/bin/python setuptools==68.0.0
4646

4747
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-32681
48-
update_package /usr/local/python/3.10.*/bin/python requests
48+
update_package /usr/local/python/3.10.*/bin/python requests==2.31.0

src/universal/.devcontainer/local-features/setup-user/install.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,9 @@ find "${OPT_DIR}" -type d | xargs -n 1 chmod g+s
9797

9898
echo "Defaults secure_path=\"${DOTNET_PATH}:${NODE_PATH}/bin:${PHP_PATH}/bin:${PYTHON_PATH}/bin:${JAVA_PATH}/bin:${RUBY_PATH}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/usr/local/share:/home/${USERNAME}/.local/bin:${PATH}\"" >> /etc/sudoers.d/$USERNAME
9999

100+
# Temporary: Due to GHSA-c2qf-rxjj-qqgw
101+
bash -c ". /usr/local/share/nvm/nvm.sh && nvm use 18"
102+
bash -c "npm -g install -g npm@9.8.1"
103+
bash -c ". /usr/local/share/nvm/nvm.sh && nvm use stable"
104+
100105
echo "Done!"

src/universal/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"torch",
118118
"requests",
119119
"plotly",
120-
"jupyterlab-git",
120+
"jupyterlab_git",
121121
"certifi",
122122
"setuptools",
123123
"wheel"

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,18 @@ checkCondaPackageVersion()
235235
current_version=$(conda list "${PACKAGE}" | grep -E "^${PACKAGE}\s" | awk '{print $2}')
236236
check-version-ge "conda-${PACKAGE}-requirement" "${current_version}" "${REQUIRED_VERSION}"
237237
}
238+
239+
checkBundledNpmVersion()
240+
{
241+
NODE_VERSION=$1
242+
REQUIRED_NPM_VERSION=$2
243+
bash -c ". /usr/local/share/nvm/nvm.sh && nvm use ${NODE_VERSION}"
244+
245+
current_npm_version=$(npm --version)
246+
247+
if [[ "$NODE_VERSION" != "default" ]]; then
248+
bash -c ". /usr/local/share/nvm/nvm.sh && nvm use default"
249+
fi
250+
251+
check-version-ge "node-${NODE_VERSION}-requirement" "${current_npm_version}" "${REQUIRED_NPM_VERSION}"
252+
}

src/universal/test-project/test.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ check "seaborn" python -c "import seaborn; print(seaborn.__version__)"
5353
check "scikit-learn" python -c "import sklearn; print(sklearn.__version__)"
5454
check "torch" python -c "import torch; print(torch.__version__)"
5555
check "requests" python -c "import requests; print(requests.__version__)"
56-
check "jupyterlab-git" bash -c "python3 -m pip list | grep jupyterlab-git"
56+
check "jupyterlab-git" python -c "import jupyterlab_git; print(jupyterlab_git.__version__)"
5757

5858
# Check JupyterLab
5959
check "jupyter-lab" jupyter-lab --version
@@ -95,6 +95,8 @@ count=$(ls /usr/local/share/nvm/versions/node | wc -l)
9595
expectedCount=2
9696
checkVersionCount "two versions of node are present" $count $expectedCount
9797
echo $(echo "node versions" && ls -a /usr/local/share/nvm/versions/node)
98+
checkBundledNpmVersion "default" "9.8.0"
99+
checkBundledNpmVersion "18" "9.8.1"
98100

99101
# PHP
100102
check "php" php --version

0 commit comments

Comments
 (0)