WIP Improving docker security#27670
Draft
br41nslug wants to merge 4 commits into
Draft
Conversation
ComfortablyCoding
left a comment
Member
There was a problem hiding this comment.
Some comments or things that may be worth it if time permits:
- Utilize DHI or equivalent
- Do build + install pkgs in the builder and move only what is needed from builder to runtime to avoid manually removing inside runtime
- Remove corepack as it is now >0.31. https://github.com/nodejs/corepack
- Pin node alpine and introduce automated way to update it over
apk --no-cache upgrade
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.
Scope
What's changed:
apk --no-cache upgrade(openssl, zlib, busybox, etc.).npm,npx,corepackbinaries + theirnode_modules, and the/root/.npmcache). Nothing at runtime shells out to npm/pnpm, and the bundled npm tree (notablypicomatch) was the main remaining CVE source.pm2from v5 to v6 (the previouscorepack@latestglobal install in the runtime stage is dropped as part of this).package.json>pnpm.overrides): pin/bump transitive packages flagged by CVE scanning:basic-ftp5.2.2 -> 5.3.0, and new pins for@xmldom/xmldom0.8.13,protobufjs7.5.5,vitest>vite7.3.2, andesbuild0.28.0.ajv8.17.1 entry frompnpm-workspace.yaml.Potential Risks / Drawbacks
pm2-runtime startpath should be validated against the v6 changelog before rollout.apk upgradereduces build reproducibility. The set of upgraded OS packages depends on what is current in the Alpine repos at build time, so two builds of the same commit can differ. It also slightly increases image build time.esbuild,vite,protobufjs) may conflict with future direct-dependency bumps and will need periodic review.Tested Scenarios
docker build .).node cli.js bootstrapsucceeds andpm2-runtimestarts the app on:8055.Review Notes / Questions
ecosystem.config.cjsneeds any changes for v6.apk --no-cache upgradeapproach vs. pinning specific package versions, given the reproducibility trade-off.ajvcatalog removal has no remaining consumers (it appeared unused).Checklist
Fixes ENG-1430