From 8946546175e4867a43b3ef238eca18bef18b0277 Mon Sep 17 00:00:00 2001 From: scottglz <4769021+scottglz@users.noreply.github.com> Date: Sun, 22 Nov 2026 08:24:04 -0800 Subject: [PATCH] Image: remove npm, npx, corepack and yarn from the final stage They come with the Node base image but never run in the container, and npm's bundled dependencies were the image's only Trivy findings. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 5 +++++ Dockerfile | 4 +++- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 196d92f..8c7c362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.3.1 - 2026-11-22 + +- The image no longer contains npm, npx, corepack or yarn from the Node base image. Nothing used them at runtime, and + npm's bundled dependencies were the image's only Trivy findings. + ## 0.3.0 - 2026-11-20 - `MAILVIEW_USERS` entries can be email addresses (`alice@example.com=alice`), matched case-insensitively and only diff --git a/Dockerfile b/Dockerfile index b54c0ca..457f859 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,9 @@ ENV NODE_ENV=production ENV PORT=8080 WORKDIR /app COPY package.json package-lock.json .npmrc ./ -RUN npm ci --omit=dev && npm cache clean --force +# npm, npx, corepack and yarn come with the base image but never run here: remove them so the image carries less +# code to patch (Trivy flags npm's bundled dependencies). +RUN npm ci --omit=dev && npm cache clean --force && rm -rf /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/corepack /opt/yarn-v* /usr/local/bin/npm /usr/local/bin/npx /usr/local/bin/corepack /usr/local/bin/yarn /usr/local/bin/yarnpkg COPY server ./server COPY --from=build /app/dist ./dist USER node diff --git a/package-lock.json b/package-lock.json index fb060eb..9075301 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mailview", - "version": "0.3.0", + "version": "0.3.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mailview", - "version": "0.3.0", + "version": "0.3.1", "license": "MIT", "dependencies": { "@hono/node-server": "2.1.6", diff --git a/package.json b/package.json index 696131a..d5eaec6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mailview", "private": true, - "version": "0.3.0", + "version": "0.3.1", "description": "A read-only web UI for Mail-Archiver: search, read and download archived email, one account per person.", "license": "MIT", "repository": {