Skip to content

chore(docker): harden base image against container-scan CVEs (v3.8.40) - #5229

Merged
diegosouzapw merged 1 commit into
release/v3.8.40from
chore/docker-cve-hardening-40
Jun 28, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.40from
chore/docker-cve-hardening-40

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Cherry-pick de #5228 para a release ativa v3.8.40.

No stage base do Dockerfile: apt-get upgrade -y (pacotes Debian trixie já corrigidos) + npm install -g npm@latest (refresca undici/tar empacotados no npm global). Resolve a parcela acionável dos CVEs de container-scan do painel de code-scanning; nenhum deles está no código/deps do app (já em undici@8.5.0/tar@7.5.16, ambos corrigidos), nem é alcançável pela superfície de request em runtime.

Validação: só Dockerfile; build completo da imagem validado pelo job docker-publish do CI no merge. Detalhes completos em #5228.

apt-get upgrade -y in the base stage pulls security-patched trixie
packages at build time, and npm install -g npm@latest refreshes the
globally-bundled undici/tar inside the npm CLI. Together these clear the
subset of GitHub container-scan CVE alerts that have an upstream fix
available.

None of the flagged CVEs are in the application dependency tree (app
already resolves undici@8.5.0 / tar@7.5.16, both fixed); they live in
the node:24-trixie-slim base layer and npm's own internals, and none are
reachable from the proxy request surface at runtime. CVEs without a
published fix (local-only TOCTOU, etc.) remain until the distro patches
them and the image is rebuilt.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Dockerfile to upgrade base Debian packages and refresh the globally-installed npm to address container-scan CVEs. The review feedback suggests improving build reliability and determinism by adding DEBIAN_FRONTEND=noninteractive to the package upgrade command, removing a redundant cache-clearing command, and pinning the npm installation to a specific major version (npm@10) with optimization flags.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Dockerfile
RUN --mount=type=cache,target=/var/cache/apt,sharing=shared \
--mount=type=cache,target=/var/lib/apt/lists,sharing=shared \
apt-get update \
&& apt-get upgrade -y \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Para evitar que o build trave ou falhe devido a prompts interativos de configuração durante a atualização de pacotes, é altamente recomendável adicionar DEBIAN_FRONTEND=noninteractive antes do comando apt-get upgrade.

Além disso, observe que como /var/lib/apt/lists está montado como cache (--mount=type=cache), o comando rm -rf /var/lib/apt/lists/* no final desta instrução RUN (na linha 16) limpará o cache persistente, anulando o propósito do cache mount. Como os cache mounts não são incluídos na imagem final de qualquer forma, você pode remover com segurança o rm -rf em uma refatoração futura para permitir a persistência correta do cache entre builds.

  && DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \

Comment thread Dockerfile
Comment on lines +24 to +25
RUN npm install -g npm@latest \
&& npm cache clean --force

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

O uso de npm@latest não é determinístico e pode levar a falhas inesperadas no build se uma nova versão major do npm (ex: v11 ou v12) for lançada com alterações incompatíveis com o Node 24.

É mais seguro fixar a instalação em uma versão major compatível com o Node 24 (como npm@10). Adicionalmente, adicionar as flags --no-audit e --no-fund acelerará a instalação e reduzirá o ruído nos logs, mantendo a consistência com outras instalações globais do npm neste Dockerfile.

RUN npm install -g --no-audit --no-fund npm@10 \
  && npm cache clean --force

@diegosouzapw
diegosouzapw merged commit 8da9e6a into release/v3.8.40 Jun 28, 2026
3 checks passed
@diegosouzapw
diegosouzapw deleted the chore/docker-cve-hardening-40 branch June 28, 2026 13:23
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…-inference#5229)

apt-get upgrade -y in the base stage pulls security-patched trixie
packages at build time, and npm install -g npm@latest refreshes the
globally-bundled undici/tar inside the npm CLI. Together these clear the
subset of GitHub container-scan CVE alerts that have an upstream fix
available.

None of the flagged CVEs are in the application dependency tree (app
already resolves undici@8.5.0 / tar@7.5.16, both fixed); they live in
the node:24-trixie-slim base layer and npm's own internals, and none are
reachable from the proxy request surface at runtime. CVEs without a
published fix (local-only TOCTOU, etc.) remain until the distro patches
them and the image is rebuilt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant