From dbfe1c9baebbc9d0b2a9ec7a7c9a436260f9e566 Mon Sep 17 00:00:00 2001 From: Zhengchao An Date: Thu, 16 Jul 2026 22:15:29 +0800 Subject: [PATCH] fix(docker): upgrade base-image packages in runtime stages to clear Trivy CVE alerts (#4909) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(docker): upgrade base-image packages in runtime stages Trivy code scanning reports 40 open alerts against the published container images, all from OS packages frozen at the base-image tag: - musl image (alpine:3.23.4): openssl libssl3/libcrypto3 3.5.6-r0, including HIGH CVE-2026-45447; fixed in 3.5.7-r0 - glibc image (ubuntu:24.04): tar, gzip, perl-base, ncurses CVEs with fixes already published in the Ubuntu archive The runtime stages only ever installed packages and never upgraded the ones shipped with the base image, so distro security fixes could not reach released images until the base tag itself moved. Run `apk upgrade` / `apt-get upgrade -y` in the runtime stages of Dockerfile, Dockerfile.glibc and Dockerfile.source so each build picks up current security fixes. Verified against the exact base tags: after upgrade, alpine 3.23.4 resolves libssl3/libcrypto3 3.5.7-r0 and ubuntu 24.04 resolves tar 1.35+dfsg-3ubuntu0.2, gzip 1.12-1ubuntu3.2, perl-base 5.38.2-3.2ubuntu0.3, ncurses 6.4+20240113-1ubuntu2.1 — matching every fixed version demanded by the open alerts. --- Dockerfile | 4 +++- Dockerfile.glibc | 5 ++++- Dockerfile.source | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5156c6aaa..c9dce17fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,7 +88,9 @@ LABEL name="RustFS" \ url="https://rustfs.com" \ license="Apache-2.0" -RUN apk update && \ +# Upgrade base-image packages so published images pick up security fixes +# (e.g. openssl/libssl3 CVEs) without waiting for a new Alpine point release. +RUN apk upgrade --no-cache && \ apk add --no-cache ca-certificates coreutils curl COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ diff --git a/Dockerfile.glibc b/Dockerfile.glibc index e837b8570..a790abed6 100644 --- a/Dockerfile.glibc +++ b/Dockerfile.glibc @@ -93,7 +93,10 @@ LABEL name="RustFS" \ url="https://rustfs.com" \ license="Apache-2.0" -RUN apt-get update && apt-get install -y --no-install-recommends \ +# Upgrade base-image packages so published images pick up security fixes +# (e.g. tar/gzip/perl CVEs) without waiting for a new Ubuntu point release. +RUN apt-get update && apt-get upgrade -y \ + && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ && rm -rf /var/lib/apt/lists/* diff --git a/Dockerfile.source b/Dockerfile.source index 2054405dc..e5827b89c 100644 --- a/Dockerfile.source +++ b/Dockerfile.source @@ -223,6 +223,7 @@ LABEL name="RustFS (dev-local)" \ RUN set -eux; \ export DEBIAN_FRONTEND=noninteractive; \ apt-get update; \ + apt-get upgrade -y; \ apt-get install -y --no-install-recommends \ ca-certificates \ curl \