Skip to content

Commit d2da376

Browse files
authored
[feat]: week 19 vulnerabilities fixes - acft-image (#5018)
1 parent 7d16e90 commit d2da376

5 files changed

Lines changed: 75 additions & 18 deletions

File tree

  • assets/training/finetune_acft_image/environments

assets/training/finetune_acft_image/environments/acft_image_huggingface/context/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ RUN pip install -r requirements.txt --no-cache-dir
2121
# pip resolves to 3.1.46 which has GHSA-rpm5-65cw-6hj4, GHSA-x2qx-6953-8485; override to >=3.1.47
2222
# python-dotenv: transitive dep (mlflow → mlflow-skinny requires python-dotenv<2,>=0.19.0); loose floor,
2323
# pip resolves to 1.2.1 which has GHSA-mf9w-mj56-hr94; override to >=1.2.2
24-
RUN pip install --no-cache-dir --upgrade 'onnx>=1.21.0' pyasn1==0.6.3 'fastmcp>=3.2.0' Mako==1.3.11 'GitPython>=3.1.47' 'python-dotenv>=1.2.2'
24+
# pillow: comes from the base ACPT image (not a hard runtime dep of any requirements.txt package;
25+
# transformers/datasets/diffusers/optimum/huggingface-hub only require Pillow under extras_require
26+
# like [vision]/[dev]/[testing]); base image ships 12.1.1 which has GHSA-whj4-6x5x-4v2j;
27+
# no parent package to upgrade — explicit override required (>=12.2.0)
28+
# pytest: comes from the base ACPT image (not a hard runtime dep of any requirements.txt package;
29+
# azureml-acft-accelerator only pins pytest~=5.3.0 under extras_require [test]); base image ships
30+
# 7.4.3 which has GHSA-6w46-j5rx-g56g; no parent package to upgrade — explicit override required (>=9.0.3)
31+
RUN pip install --no-cache-dir --upgrade 'onnx>=1.21.0' pyasn1==0.6.3 'fastmcp>=3.2.0' Mako==1.3.11 'GitPython>=3.1.47' 'python-dotenv>=1.2.2' 'pillow>=12.2.0' 'pytest>=9.0.3'
2532
# python-dotenv in base conda env: transitive dep of uvicorn[standard] (>=0.13); loose floor,
2633
# base image has 1.2.1 which has GHSA-mf9w-mj56-hr94; override to >=1.2.2
2734
RUN conda run -n base python -m pip install --no-cache-dir --upgrade 'python-dotenv>=1.2.2'

assets/training/finetune_acft_image/environments/acft_image_medimageinsight_adapter_finetune/context/Dockerfile

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,24 @@ RUN apt-get -y install unzip
1010
COPY requirements.txt .
1111
RUN pip install -r requirements.txt --no-cache-dir
1212

13-
# Transitive dep overrides where pip may not resolve to the patched version:
14-
# pyasn1: mlflow → databricks-sdk → google-auth → pyasn1-modules → pyasn1;
15-
# parents use loose floors so pip may resolve to <0.6.3 (CVE-2026-30922)
16-
# Mako: mlflow → alembic → Mako; alembic uses unpinned Mako dep
17-
# python-dotenv: mlflow → mlflow-skinny → python-dotenv<2,>=0.19.0;
18-
# mlflow 3.11.1 (latest as of 2026-05-04) allows >=1.2.2 but pip may resolve older (GHSA-mf9w-mj56-hr94)
19-
RUN pip install --no-cache-dir --upgrade 'pyasn1>=0.6.3' 'Mako>=1.3.11' 'python-dotenv>=1.2.2'
20-
# python-dotenv in /opt/conda Python 3.13 also ships as vulnerable 1.2.1 in the base image.
21-
RUN /opt/conda/bin/python3.13 -m pip install --no-cache-dir --upgrade 'python-dotenv>=1.2.2'
13+
# Transitive dep overrides where pip may not resolve to the patched version.
14+
# The image has two conda envs: base (py3.13) and ptca (py3.10); the default
15+
# `pip` resolves to the ptca env, so base-env overrides need /opt/conda/bin/pip.
16+
#
17+
# ptca env (py3.10):
18+
# pyasn1: mlflow -> databricks-sdk -> google-auth -> pyasn1-modules -> pyasn1;
19+
# pyasn1-modules pins pyasn1 with no version floor so pip may resolve <0.6.3 (CVE-2026-30922)
20+
# Mako: mlflow -> alembic -> Mako; alembic 1.18.4 uses unpinned `Requires-Dist: Mako`
21+
# python-dotenv: mlflow -> mlflow-skinny -> python-dotenv<2,>=0.19.0;
22+
# mlflow 3.11.1 (latest as of 2026-05-08) keeps that wide range so pip may resolve <1.2.2 (GHSA-mf9w-mj56-hr94)
23+
#
24+
# base conda env (py3.13):
25+
# python-dotenv 1.2.1 is brought in by anaconda-auth 0.13.1 (`Requires-Dist: python-dotenv`,
26+
# no version pin) and pydantic-settings 2.12.0 (`python-dotenv>=0.21.0`); both are shipped
27+
# pre-installed in the base env from the upstream base image and neither parent ships a
28+
# tighter pin in its latest release as of 2026-05-08, so we patch python-dotenv directly
29+
# in the base env via /opt/conda/bin/pip.
30+
RUN pip install --no-cache-dir --upgrade 'pyasn1>=0.6.3' 'Mako>=1.3.11' 'python-dotenv>=1.2.2' \
31+
&& /opt/conda/bin/pip install --no-cache-dir --upgrade 'python-dotenv>=1.2.2'
2232

2333
RUN conda clean -a -y && rm -rf /opt/miniconda/pkgs/

assets/training/finetune_acft_image/environments/acft_image_medimageinsight_embedding/context/Dockerfile

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,40 @@ FROM mcr.microsoft.com/aifx/acpt/stable-ubuntu2204-cu126-py310-torch280:{{latest
33

44
USER root
55

6-
# Install unzip and upgrade OS packages to fix vulnerabilities
6+
# Install unzip and upgrade OS packages to fix vulnerabilities.
7+
# `apt-get -y upgrade` against the current ACPT base image (biweekly.202605.1) already pulls
8+
# openssh-client to 1:8.9p1-3ubuntu0.15 (USN-8222-1 fix) and keeps dotnet-{host,hostfxr,runtime}-8.0
9+
# at 8.0.26-0ubuntu1~22.04.1 (USN-8176-1 fix), so no explicit `apt-get install` overrides are
10+
# required. Verified via `apt-get install` returning "0 upgraded, 0 newly installed" for these
11+
# packages on top of the upgraded layer (build run ca42, 2026-05-08).
712
RUN apt-get -y update && apt-get -y upgrade && apt-get -y install unzip && apt-get clean && rm -rf /var/lib/apt/lists/*
813

914
# Install required packages from pypi
1015
COPY requirements.txt .
1116
RUN pip install -r requirements.txt --no-cache-dir
1217

13-
# mlflow 3.5.0 has CVEs (CVE-2025-14287, CVE-2026-2033, CVE-2026-2635); upgrade after requirements install
14-
# azureml-mlflow pins mlflow-skinny<=3.9.0, so mlflow must be upgraded separately to avoid resolution conflict
18+
# mlflow 3.5.0 has CVEs (CVE-2025-14287, CVE-2026-2033, CVE-2026-2635, GHSA-fh64-r2vc-xvhr);
19+
# upgrade after requirements install. azureml-mlflow 1.62.0.post2 pins mlflow-skinny<=3.9.0,
20+
# so mlflow must be upgraded separately (post-pip-install) to avoid resolver conflict.
1521
RUN pip install --no-cache-dir mlflow==3.11.1
1622
# fastmcp + mcp were installed as regular deps of mlflow 3.5.0 (fastmcp→mcp) but orphaned after
1723
# mlflow 3.11.1 (fastmcp moved to optional "mcp" extra); uninstall both to remove vulnerable packages
1824
RUN pip uninstall -y fastmcp mcp
1925

26+
# Override vulnerable transitive deps in the ptca env (Python 3.10) that pip won't auto-upgrade:
27+
# Mako: transitive dep (mlflow → alembic 1.18.4 → Mako); alembic 1.18.4 declares "Mako" with no
28+
# version pin at all, so pip resolves to 1.3.10 which has GHSA-v92g-xgxw-vvmm. No parent
29+
# release floors Mako >= 1.3.11, so explicit override is the only fix.
30+
# GitPython: transitive dep (mlflow → mlflow-skinny 3.11.1 requires gitpython<4,>=3.1.9); the
31+
# loose floor lets pip resolve 3.1.46 which has GHSA-x2qx-6953-8485, GHSA-rpm5-65cw-6hj4.
32+
# mlflow-skinny has no release that pins gitpython>=3.1.47, so explicit override is required.
33+
# pytest: shipped by the ACPT base image (NOT pulled in by any package in requirements.txt nor
34+
# any of their transitive deps; verified by inspecting requires_dist of mlflow, mlflow-skinny,
35+
# azureml-mlflow, transformers, etc.). No parent package to bump — the base image pre-installs
36+
# pytest 7.4.3 and the ACPT base hasn't been rebuilt with a fix yet, so explicit override
37+
# to >=9.0.3 is required (GHSA-6w46-j5rx-g56g).
38+
RUN pip install --no-cache-dir --upgrade 'Mako>=1.3.11' 'GitPython>=3.1.47' 'pytest>=9.0.3'
39+
2040
# Upgrade python-dotenv in the system Python(3.13)
2141
# python-dotenv: transitive dep via pydantic-settings (>=0.21.0 floor); parent uses loose floor so base resolves to
2242
# vulnerable 1.2.1 (GHSA-mf9w-mj56-hr94); override to >=1.2.2

assets/training/finetune_acft_image/environments/acft_image_medimageparse_finetune/context/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ sentencepiece==0.2.1
1616
peft==0.17.1
1717
ninja==1.11.1.1
1818
kornia==0.7.3
19+
# python-dotenv: CVE-2026-28684 / GHSA-mf9w-mj56-hr94 (fixed in 1.2.2).
20+
# Parent transitive dep chain: mlflow-skinny -> python-dotenv<2,>=0.19.0.
21+
# mlflow-skinny 3.11.1 (latest) still uses the loose floor >=0.19.0, so a
22+
# parent upgrade alone resolves to 1.2.1. Direct pin retained until mlflow
23+
# tightens the floor to >=1.2.2.
1924
python-dotenv==1.2.2
2025
einops==0.8.0
2126
mup==1.0.0

assets/training/finetune_acft_image/environments/acft_video_mmtracking/context/Dockerfile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@ RUN pip install -r requirements.txt --no-cache-dir
1717
# RUN mim install mmdet==2.28.2
1818

1919
# Override transformers to fix GHSA-69w3-r845-3855 (CVE-2026-1839, arbitrary code execution in Trainer)
20-
# Root cause: azureml-acft-image-components pins transformers==4.53.0; cannot upgrade parent
21-
# Using --no-deps to avoid pulling incompatible transitive deps for the older HF stack
20+
# Root cause (verified 2026-05 via importlib.metadata against the built image):
21+
# - requirements.txt line 8 directly pins `transformers==4.53.0` for compatibility with the
22+
# pinned HF stack (accelerate==0.25.0, optimum==1.23.3, diffusers==0.24.0, peft==0.15.2).
23+
# - azureml-acft-image-components==0.0.89 (current latest) only constrains transformers via
24+
# optional extras (hf/all -> ==4.33.0; mip/mip3d -> >=4.40); none of those extras are
25+
# activated in this image, so the parent does NOT block an upgrade.
26+
# - Bumping the explicit requirements.txt pin to 5.x is a major-version jump that risks
27+
# breaking the rest of the pinned HF stack and is out of scope for a CVE-only patch.
28+
# Using --no-deps to avoid pulling incompatible transitive deps for the older HF stack.
2229
RUN pip install --no-cache-dir --no-deps 'transformers==5.5.4'
2330

2431
# vulnerability fixes - this will be removed once we update to MMTracking's latest version
@@ -33,6 +40,14 @@ RUN pip install numpy==1.23.5
3340
# https://github.com/open-mmlab/mmdetection/issues/10962
3441
RUN pip install yapf==0.40.1
3542

36-
# python-dotenv 1.2.1 in system Python (3.13) needs upgrade to 1.2.2 (GHSA-mf9w-mj56-hr94, symlink overwrite);
37-
# transitive dep of mlflow-skinny (>=0.19.0,<2) and pydantic-settings (>=0.21.0) — parents use loose floors
38-
RUN /opt/conda/bin/python3.13 -m pip install --no-cache-dir --upgrade 'python-dotenv>=1.2.2'
43+
# python-dotenv 1.2.1 in system Python (3.13) needs upgrade to 1.2.2 (GHSA-mf9w-mj56-hr94, symlink overwrite).
44+
# Root cause (verified 2026-05 via importlib.metadata against /opt/conda py3.13):
45+
# - python-dotenv is installed in the base /opt/conda env (py3.13) by the upstream
46+
# base image, brought in transitively by anaconda-auth (no version constraint) and
47+
# pydantic-settings (>=0.21.0); both parents accept any 1.x including 1.2.2.
48+
# - No parent in /opt/conda blocks the upgrade, but neither parent has been re-released
49+
# to require >=1.2.2 yet, so we must override here until the base image catches up.
50+
# - The ptca conda env (py3.10) already gets 1.2.2 transitively via mlflow-skinny when
51+
# requirements.txt is installed above, so this RUN only needs to fix the py3.13 env.
52+
# Bound the upgrade to the 1.x line to keep rebuilds reproducible without locking out future patches.
53+
RUN /opt/conda/bin/python3.13 -m pip install --no-cache-dir --upgrade 'python-dotenv>=1.2.2,<2'

0 commit comments

Comments
 (0)