Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@
FROM node:24-trixie-slim AS base
WORKDIR /app

# `apt-get upgrade` pulls the security-patched versions of the Debian (trixie)
# base-image packages at build time — clears the subset of container-scan CVEs
# (perl / util-linux / systemd / ncurses / zlib / tar / sqlite / shadow / pam …)
# that already have a fix published in trixie. CVEs without an upstream fix yet
# (local-only TOCTOU, etc.) remain until the distro patches them and the image
# is rebuilt; none are reachable from the proxy's request surface at runtime.
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 \

&& apt-get install -y --no-install-recommends libsecret-1-0 ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Refresh the globally-installed npm so its *bundled* node_modules (undici, tar)
# ship the patched versions. These are npm's own internals — not application
# dependencies (our app already resolves undici@8.5.0 / tar@7.5.16, both fixed) —
# but the container scanner flags the stale copies under
# /usr/local/lib/node_modules/npm/node_modules. npm is not invoked at runtime in
# the runner stages, so this is hygiene, not an exploitable runtime path.
RUN npm install -g npm@latest \
&& npm cache clean --force
Comment on lines +24 to +25

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


# ── Builder ────────────────────────────────────────────────────────────────
FROM base AS builder

Expand Down
Loading