From 1459344095e4f19e0394695f87ba21779637a1d8 Mon Sep 17 00:00:00 2001 From: Gaurav Saini <147703805+gauravsaini04@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:02:18 +0530 Subject: [PATCH] [anaconda]-auto install vuln pkgs from conda / pip (#1079) * [anaconda]-auto install vuln pkgs from conda / pip * Misc change * for test runs fails * misc change * changes requested * minor change * MSG CHANGE * changes suggested * changes acc. to review comments.. * [anaconda] - changes as requested --- src/anaconda/.devcontainer/Dockerfile | 32 +---------- .../.devcontainer/apply_security_patches.sh | 55 +++++++++++++++++++ 2 files changed, 58 insertions(+), 29 deletions(-) create mode 100644 src/anaconda/.devcontainer/apply_security_patches.sh diff --git a/src/anaconda/.devcontainer/Dockerfile b/src/anaconda/.devcontainer/Dockerfile index 126bfc669..b3dc56f55 100644 --- a/src/anaconda/.devcontainer/Dockerfile +++ b/src/anaconda/.devcontainer/Dockerfile @@ -5,35 +5,9 @@ RUN . /etc/os-release && if [ "${VERSION_CODENAME}" != "bullseye" ]; then exit 1 # Temporary: Upgrade python packages due to mentioned CVEs # They are installed by the base image (continuumio/anaconda3) which does not have the patch. -RUN conda install \ - # https://github.com/advisories/GHSA-mr82-8j83-vxmv - pydantic==2.5.3 - -RUN python3 -m pip install --upgrade \ - # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-21797 - joblib==1.3.1 \ - # https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-34749 - mistune==3.0.1 \ - # https://github.com/advisories/GHSA-2g68-c3qc-8985 - werkzeug==3.0.3 \ - # https://github.com/advisories/GHSA-v68g-wm8c-6x7j - transformers==4.36.0 \ - # https://github.com/advisories/GHSA-44wm-f244-xhp3 - pillow==10.3.0 \ - # https://github.com/advisories/GHSA-5h86-8mv2-jq9f - aiohttp==3.9.4 \ - # https://github.com/advisories/GHSA-6vqw-3v5j-54x4 - cryptography==42.0.4 \ - # https://github.com/advisories/GHSA-2mqj-m65w-jghx - gitpython==3.1.41 \ - # https://github.com/advisories/GHSA-4qhp-652w-c22x - jupyter-lsp==2.2.2 \ - # https://github.com/advisories/GHSA-jjg7-2v4v-x38h - idna==3.7 \ - # https://github.com/advisories/GHSA-h75v-3vvj-5mfj - jinja2==3.1.4 \ - # https://github.com/advisories/GHSA-4qqq-9vqf-3h3f - scrapy==2.11.2 +COPY ./apply_security_patches.sh /tmp/apply_security_patches.sh +RUN chmod +x /tmp/apply_security_patches.sh +RUN /tmp/apply_security_patches.sh # Reset and copy updated files with updated privs to keep image size down FROM mcr.microsoft.com/devcontainers/base:1-bullseye diff --git a/src/anaconda/.devcontainer/apply_security_patches.sh b/src/anaconda/.devcontainer/apply_security_patches.sh new file mode 100644 index 000000000..87d6ecb4a --- /dev/null +++ b/src/anaconda/.devcontainer/apply_security_patches.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +vulnerable_packages=( "pydantic=2.5.3" "joblib=1.3.1" "mistune=3.0.1" "werkzeug=3.0.3" "transformers=4.36.0" "pillow=10.3.0" "aiohttp=3.9.4" \ + "cryptography=42.0.4" "gitpython=3.1.41" "jupyter-lsp=2.2.2" "idna=3.7" "jinja2=3.1.4" "scrapy=2.11.2" ) + +# Define the number of rows (based on the length of vulnerable_packages) +rows=${#vulnerable_packages[@]} + +# Define the number of columns +cols=2 + +# Define the 2D array +declare -A packages_array + +# Fill the 2D array +for ((i=0; i