diff --git a/Dockerfile b/Dockerfile index 80de6d4d16..c50338ccba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -254,6 +254,21 @@ RUN curl -sL https://deb.nodesource.com/setup_24.x | bash - RUN apt-get -y update && apt-get install -y --no-install-recommends curl procps nodejs awscli && apt-get clean \ && rm -rf /var/lib/apt/lists/* +# The npm bundled with nodejs carries undici (via node-gyp) older than 6.29.1, which has +# CVE-2026-109383. Replaced in place until a bundled npm ships a fixed one; a bundled undici +# at or past this version, or on a later major, is left alone. +ARG NPM_UNDICI_VERSION=6.29.1 +RUN dir=/usr/lib/node_modules/npm/node_modules/undici; \ + if [ -f "$dir/package.json" ]; then \ + current="$(node -p "require('$dir/package.json').version")"; \ + if [ "${current%%.*}" = "${NPM_UNDICI_VERSION%%.*}" ] && [ "$(printf '%s\n' "$current" "$NPM_UNDICI_VERSION" | sort -V | head -n1)" != "$NPM_UNDICI_VERSION" ]; then \ + cd /tmp && npm pack "undici@$NPM_UNDICI_VERSION" \ + && rm -rf "$dir" && mkdir "$dir" \ + && tar -xzf "undici-$NPM_UNDICI_VERSION.tgz" -C "$dir" --strip-components=1 \ + && rm "undici-$NPM_UNDICI_VERSION.tgz" && rm -rf /root/.npm; \ + fi; \ + fi + # go build is slower the first time it is ran, so we prewarm it in the build # This mirrors Windmill's Go wrapper structure: main.go imports inner package, uses encoding/json, os, fmt RUN export GOCACHE=/tmp/build_cache/go && \