fix(docker): pin nginx in the deployment recipes#5942
Open
haoyu-haoyu wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for ohif-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
|
||
| # # Stage 2: Bundle the built application into a Docker container which runs NGINX using Alpine Linux | ||
| FROM nginx:alpine | ||
| FROM nginx:1.27.1-alpine |
Contributor
There was a problem hiding this comment.
Pinned version is missing CVE-2024-7347 patch
Pinning over a floating tag is exactly the right approach here, but nginx:1.27.1-alpine was released August 14, 2024 and is missing the patch for CVE-2024-7347 — an out-of-bounds read in ngx_http_mp4_module that can allow a crafted MP4 file to crash the process or leak memory. The fix shipped in nginx 1.27.2 on September 4, 2024, just three weeks later.
The same version is pinned in all four recipe Dockerfiles:
platform/app/.recipes/Nginx-Orthanc/dockerfile:30platform/app/.recipes/Nginx-Dcm4chee/dockerfile:30platform/app/.recipes/Nginx-Orthanc-Keycloak/dockerfile:33platform/app/.recipes/Nginx-Dcm4chee-Keycloak/dockerfile:25
Please bump to nginx:1.27.4-alpine (or the current latest stable/mainline) in all four files to preserve reproducibility without introducing a known CVE.
Suggested change
| FROM nginx:1.27.1-alpine | |
| FROM nginx:1.27.4-alpine |
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.
Context
Fixes #5938.
The nginx-based deployment recipes currently build from
nginx:alpine, which means they implicitly pick up upstream image changes over time. The report in #5938 shows that this is enough to break the Orthanc and dcm4chee recipes in a way that leaves REST requests hanging and the viewer unable to load studies correctly.Changes & Results
This pins the nginx stage in the four affected recipes to
nginx:1.27.1-alpine:platform/app/.recipes/Nginx-Orthanc/dockerfileplatform/app/.recipes/Nginx-Orthanc-Keycloak/dockerfileplatform/app/.recipes/Nginx-Dcm4chee/dockerfileplatform/app/.recipes/Nginx-Dcm4chee-Keycloak/dockerfileThe goal here is to make these recipes reproducible again and avoid pulling in a moving nginx base image at build time.
Testing
I ran
git diff --check.I also verified that
nginx:1.27.1-alpineis still published by checking its image manifest with Docker.I did not run a full docker compose build for all four recipes in this environment.
Checklist
PR
Code
Public Documentation Updates
Tested Environment
Greptile Summary
This PR correctly addresses the reproducibility issue from #5938 by pinning
nginx:alpineto a specific version across all four deployment recipe Dockerfiles. The fix direction is sound — floating base image tags are a well-known source of silent, hard-to-debug breakage. However, the chosen pinned versionnginx:1.27.1-alpine(released August 14, 2024) predates the patch for CVE-2024-7347 by just three weeks — the fix landed innginx:1.27.2on September 4, 2024. Since these are production deployment recipes, bumping to a more recent version (e.g.nginx:1.27.4-alpineor the current stable) would achieve reproducibility without shipping a known vulnerability.Nginx-Orthanc,Nginx-Dcm4chee,Nginx-Orthanc-Keycloak,Nginx-Dcm4chee-KeycloakFROM nginx:alpinereplaced withFROM nginx:1.27.1-alpinein each — correct approach, wrong specific versionnginx:1.27.1-alpineis missing the CVE-2024-7347 patch (ngx_http_mp4_module OOB read) — recommend bumping tonginx:1.27.4-alpineor the current latest stable before mergingConfidence Score: 3/5
Functionally safe to merge; pinning approach is correct but the chosen version carries CVE-2024-7347 — should be bumped before production use
The change is minimal, correct in direction, and does not break any functionality. The only concern is that nginx:1.27.1-alpine predates the CVE-2024-7347 fix by 3 weeks, making it a slightly worse security posture than using a more current pinned version. Bumping to 1.27.4-alpine or later in all four files would raise this to a 5.
All four Dockerfile recipes need their nginx version bumped from 1.27.1-alpine to 1.27.4-alpine (or newer) before these images are deployed.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["Build Stage\nnode:20.18.1-slim"] --> B["yarn install\n--frozen-lockfile"] B --> C["yarn build\nAPP_CONFIG per recipe"] C --> D["Runtime Stage\nnginx:1.27.1-alpine ⚠️"] D --> E["COPY dist → /var/www/html"] E --> F["EXPOSE 80 / 443"] F --> G["CMD nginx -g 'daemon off;'"]Reviews (1): Last reviewed commit: "fix(docker): pin nginx in the deployment..." | Re-trigger Greptile