Repository navigation
chore(frontend): run the nginx image as non-root - #611
Merged
Merged
Conversation
Switch to nginxinc/nginx-unprivileged (digest pinned, same nginx 1.31.3). The container now runs as user 101 and listens on 8080 instead of 80. The example docker-compose.yml maps host port 80 to 8080, so it keeps working unchanged for its users. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Visit the preview URL for this PR (updated for commit 79563bb): https://tormap-36f44--pr611-chore-frontend-nginx-ur79mgoi.web.app (expires Wed, 11 Nov 2026 20:21:40 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 0c1f71965de18e60b0e686b0d0356977fec090dc |
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.
What
The frontend container now runs as a non-root user. This matches the backend, which already runs as
1000:1000.Dockerfile:nginx:1.31.3-alpine->nginxinc/nginx-unprivileged:1.31.3-alpine, pinned by digest. Same nginx version, now running as user101.EXPOSE 8080.nginx.conf:listen 8080. Ports below 1024 cannot be bound without root.backend/docker-compose.yml:"80:80"->"80:8080". The host port stays 80, so the example setup works unchanged.frontend/README.md,THREAT_MODEL.md: document the port and the non-root user.The Firebase deployment does not use this image and is not affected.
Verification
Built the image locally and ran it:
/-> 200text/html,/some/deep/link-> 200 (SPA fallback), a hashed JS asset -> 200application/javascriptid->uid=101(nginx), and all nginx processes (master included) run asnginxnginx -tpassesDependencies (base image)
Docker base images are not covered by the OpenSourceMalware check, so this is the only vetting that applies:
nginxinc/nginx-unprivileged:1.31.3-alpine, digestsha256:f972e532..., multi-arch with linux/amd64 and linux/arm64 (the platforms the workflow builds). The officialnginx:1.31.3-alpinedigest in Docker Hub matches the one previously pinned, so the tag lineage is consistent.Deployment notes
Operators who run the frontend image with their own port mapping must change the container side from
80to8080, e.g.-p 80:8080instead of-p 80:80, and update reverse-proxy upstreams that target container port 80. The exampledocker-compose.ymlis updated and needs no change on the host side.🤖 Generated with Claude Code