Skip to content

Commit 5f5cfbc

Browse files
[anaconda] Address GHSA-47fc-vmwq-366v, GHSA-282v-666c-3fvg, GHSA-mrwq-x4v8-fh7p vulnerabilities (#690)
* Address GHSA-47fc-vmwq-366v, GHSA-282v-666c-3fvg, GHSA-mrwq-x4v8-fh7p * Add tests * Update manifest * Bump `pygments` version * Test: Remove `conda` group * Restart checks * Test: Reorg Dockerfile * Revert "Test: Reorg Dockerfile" This reverts commit 2cc4085. * Revert "Test: Remove `conda` group" This reverts commit 4401785. * Use latest version of `continuumio/anaconda3` image - Remove version lock for `continuumio/anaconda3` image; - Remove patches for `torch` and `pygments` * Update tests * Update patch - Lock packages versions; - Clean up `manifest.json`; * Update README.md * Update src/anaconda/README.md Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com> * Revert changes for manifest --------- Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
1 parent 0502949 commit 5f5cfbc

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

src/anaconda/.devcontainer/Dockerfile

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

33
# Verify OS version is expected one
44
RUN . /etc/os-release && if [ "${VERSION_CODENAME}" != "bullseye" ]; then exit 1; fi
55

66
# Temporary: Upgrade python packages due to mentioned CVEs
77
# They are installed by the base image (continuumio/anaconda3) which does not have the patch.
8-
RUN python3 -m pip install \
8+
RUN python3 -m pip install --upgrade \
99
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21797
10-
--upgrade joblib \
10+
joblib==1.3.1 \
1111
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24065
12-
cookiecutter \
12+
cookiecutter==2.2.3 \
1313
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-34749
14-
mistune \
14+
mistune==3.0.1 \
1515
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34141
16-
numpy \
16+
numpy==1.25.2 \
1717
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-25577
18-
werkzeug \
18+
werkzeug==2.3.6 \
1919
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32862
20-
nbconvert \
21-
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28370
22-
tornado
20+
nbconvert==7.7.3 \
21+
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-28370
22+
tornado==6.3.2 \
23+
# https://github.com/advisories/GHSA-282v-666c-3fvg
24+
transformers==4.30.0
2325

2426
RUN conda install \
2527
# https://github.com/advisories/GHSA-5cpq-8wj7-hf2v

src/anaconda/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ See [history](history) for information on the contents of each version and [here
3737
Alternatively, you can use the contents of `Dockerfile` to fully customize your container's contents or to build it for a container host architecture not supported by the image.
3838

3939
### Using Conda
40+
4041
This dev container and its associated image includes [the `conda` package manager](https://aka.ms/vscode-remote/conda/about). Additional packages installed using Conda will be downloaded from Anaconda or another repository if you configure one. To reconfigure Conda in this container to access an alternative repository, please see information on [configuring Conda channels here](https://aka.ms/vscode-remote/conda/channel-setup).
4142

4243
Access to the Anaconda repository is covered by the [Anaconda Terms of Service](https://aka.ms/vscode-remote/conda/terms), which may require some organizations to obtain a commercial license from Anaconda. **However**, when this dev container or its associated image is used with GitHub Codespaces or GitHub Actions, **all users are permitted** to use the Anaconda Repository through the service, including organizations normally required by Anaconda to obtain a paid license for commercial activities. Note that third-party packages may be licensed by their publishers in ways that impact your intellectual property, and are used at your own risk.
@@ -51,7 +52,6 @@ By default, frameworks like Flask only listens to localhost inside the container
5152

5253
The `appPort` property [publishes](https://docs.docker.com/config/containers/container-networking/#published-ports) rather than forwards the port, so applications need to listen to `*` or `0.0.0.0` for the application to be accessible externally. This conflicts with the defaults of some Python frameworks, but fortunately the `forwardPorts` property does not have this limitation.
5354

54-
5555
#### Installing Node.js
5656

5757
Given JavaScript front-end web client code written for use in conjunction with a Python back-end often requires the use of Node.js-based utilities to build, you can use a [Node feature](https://github.com/devcontainers/features/tree/main/src/node) to install any version of Node by adding the following to `devcontainer.json`:
@@ -66,6 +66,14 @@ Given JavaScript front-end web client code written for use in conjunction with a
6666
}
6767
```
6868

69+
#### Using different Conda channels
70+
71+
This image is based on the `ContinuumIO/anaconda3` docker image, which has all the `anaconda3` packages from defaults installed into the base conda's environment. It is recommended not to install packages from different channels in one environment since it could cause conflicts. When installing a package from a different channel (e.g., `conda-forge`) is required, the better approach is to create a new conda environment.
72+
73+
```bash
74+
conda create --name <env_name> -c <channel> --yes <package_name>
75+
```
76+
6977
#### Installing a different version of Python
7078

7179
As covered in the [user FAQ](https://docs.anaconda.com/anaconda/user-guide/faq) for Anaconda, you can install different versions of Python than the one in this image by running the following from a terminal:

src/anaconda/manifest.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@
3636
"nbconvert",
3737
"py",
3838
"pyOpenssl",
39-
"werkzeug",
39+
"Werkzeug",
4040
"requests",
41-
"tornado"
41+
"tornado",
42+
"transformers"
4243
],
4344
"other": {
4445
"git": {},

src/anaconda/test-project/test.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ checkPythonPackageVersion "werkzeug" "2.2.3"
4242
checkPythonPackageVersion "certifi" "2022.12.07"
4343
checkPythonPackageVersion "requests" "2.31.0"
4444
checkPythonPackageVersion "cryptography" "41.0.2"
45+
checkPythonPackageVersion "torch" "1.13.1"
46+
checkPythonPackageVersion "transformers" "4.30.0"
4547

4648
# The `tornado` package doesn't have the `__version__` attribute so we can use the `version` attribute.
4749
tornado_version=$(python -c "import tornado; print(tornado.version)")
@@ -50,10 +52,11 @@ check-version-ge "tornado-requirement" "${tornado_version}" "6.3.2"
5052
checkCondaPackageVersion "pyopenssl" "23.2.0"
5153
checkCondaPackageVersion "cryptography" "41.0.2"
5254
checkCondaPackageVersion "requests" "2.31.0"
55+
checkCondaPackageVersion "pygments" "2.15.1"
5356

5457
check "conda-update-conda" bash -c "conda update -y conda"
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"
58+
check "conda-install-tensorflow" bash -c "conda create --name test-env -c conda-forge --yes tensorflow"
59+
check "conda-install-pytorch" bash -c "conda create --name test-env -c conda-forge --yes pytorch"
5760

5861
# Report result
5962
reportResults

0 commit comments

Comments
 (0)