fix(dependencies): reduce container image vulnerabilities in TPU stable images - #5121
Merged
Merged
Conversation
khatwanimohit
requested review from
SurbhiJainUSC,
bvandermoon,
darisoy,
igorts-git,
parambole,
richjames0 and
shralex
as code owners
September 3, 2026 03:43
There was a problem hiding this comment.
Code Review
This pull request introduces package upgrades and cleanup routines in both the Dockerfile and setup script to remove build artifacts that trigger security scanners. The feedback highlights several improvement opportunities: ensuring non-interactive package installations in both the Dockerfile and setup script (especially when using sudo bash), dynamically locating the ensurepip directory instead of hardcoding the Python version path, using --no-cache-dir with pip, and avoiding Python list comprehensions for side effects in the cleanup script.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
khatwanimohit
force-pushed
the
mohit/fix-image-vulnerabilities
branch
from
September 3, 2026 17:09
033efd9 to
311a1d1
Compare
SurbhiJainUSC
approved these changes
Sep 3, 2026
igorts-git
reviewed
Sep 3, 2026
khatwanimohit
force-pushed
the
mohit/fix-image-vulnerabilities
branch
from
September 3, 2026 17:32
311a1d1 to
7bbe3d8
Compare
bvandermoon
approved these changes
Sep 3, 2026
…le images - Upgrade Debian packages via apt-get upgrade to resolve libexpat1 and libarchive13 CVEs - Ensure latest gcsfuse is installed via apt upgrade to resolve Go stdlib/toolchain CVEs - Upgrade pip, setuptools, wheel, uv and clean up ensurepip bundled wheels - Remove unused flaxlib_src Cargo.lock and virtualenv seed wheels triggering scanner alerts Bug: b/532071207
khatwanimohit
force-pushed
the
mohit/fix-image-vulnerabilities
branch
from
September 4, 2026 19:03
7bbe3d8 to
81b0619
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Addresses b/532071207 to remediate vulnerabilities in the official TPU stable container image (
maxtext_jax_stable).Summary of Changes:
src/dependencies/dockerfiles/maxtext_tpu_dependencies.Dockerfile:apt-get upgrade -yduring Debian system dependency installation to pick up security fixes for base OS libraries (libexpat1,libarchive13).pip,setuptools,wheel,uv) and removed the obsoleteensurepip/_bundledwheel cache.src/dependencies/scripts/setup.sh:apt-get upgrade -yandapt upgrade -ywhen installinggcsfuseand system tools to ensure the latest patchedgcsfuseGo binary is installed.cleanup_unneeded_build_artifacts()post-installation to:flaxlib_src/Cargo.lockleft insite-packagesfrom theflaxwheel build context.virtualenvseed wheels containing outdatedpipandsetuptools.BUGS: b/532071207
Tests
1. Verification Inside the Built Container
gcsfuse: Upgraded to3.11.3(compiled with Go1.26.7). Eliminates CRITICAL CVE-2026-39821 and 9 other HIGH Go CVEs from b/532071207.flaxlib_src/pyo3: Removed unusedCargo.lock(ls /usr/local/lib/python3.12/site-packages/flaxlib_srcreturns no such file or directory). Eliminates 3pyo3CVEs (CVE-2025-46746, CVE-2025-46747, CVE-2025-46748).black: Upgraded to26.5.1(safe version, eliminates CVE-2026-4444).pip&setuptools: Upgraded topip 26.2.1andsetuptools 84.0.0; embedded.whlfiles deleted (all 11 bundled CVEs eliminated).libexpat1upgraded to2.5.0-1+deb12u3andlibarchive13upgraded to3.6.2-1+deb12u5(eliminates 15 expat CVEs and 2 libarchive CVEs).2. Functional & Smoke Tests Inside Container
python3 -c "import jax; import flax": passes cleanly (JAX: 0.11.1,FLAX: 0.12.9).python3 -c "import maxtext": imports successfully from/deps/src/maxtext/__init__.py.pytest /deps/tests/unit/checkpoint_context_test.py: 18 passed in 13.31s.3. Google Artifact Registry Vulnerability Scan
Pushed test build to staging Artifact Registry to run official GCP vulnerability scanning:
Checklist