Repository navigation
Strip unused package managers from the frontend image and scan it - #7
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the package managers that
node:22-alpinebundles from the frontend runtime image, and adds the frontend to the container scan, which until now scanned only the backend.The runtime image carried npm, npx, corepack and yarn 1.22.22. None of them runs: the image starts with
node server.js, and the StartOS package launches it through that entrypoint. npm's own dependencies brought 10 HIGH findings into the shipped image (brace-expansion2.0.2,ip-address10.1.0,pacote,picomatch4.0.3 andsigstore3.1.0, all under/usr/local/lib/node_modules/npm/). Deleting them in the runtime stage clears all 10. The builder stage still uses corepack and pnpm; only the runtime stage changes.container-scanis now a summary of a matrix job,image-scan, that builds and scans the backend and frontend images separately. The deployment gate indocs/security/production-deployment-gate.mdrequires a check namedcontainer-scan, so the summary keeps that name and fails unless every image scan passed.Verified locally, building with
NEXT_PUBLIC_CANARY_MODE=self-hostedas the StartOS package does, and comparing against an image built from master:/,/loginand/walletsredirect to/sign-inwith 307 on both,/sign-inreturns 200 at an identical 91,628 bytes with the same static assets, and neither logs a server error.npm,npx,corepack,yarnandyarnpkgare absent andnoderuns asnextjs. Trivy on the new image, with the CI settings: 0 CRITICAL or HIGH across the Alpine and Node packages it inventories.