Skip to content

fix: run container as non-root user in runtime stage (closes #45)#46

Merged
LucasMaupin merged 1 commit into
mainfrom
fix/issue-45-dockerfile-non-root-user
Jun 10, 2026
Merged

fix: run container as non-root user in runtime stage (closes #45)#46
LucasMaupin merged 1 commit into
mainfrom
fix/issue-45-dockerfile-non-root-user

Conversation

@LucasMaupin

Copy link
Copy Markdown
Collaborator

Summary

  • Added a dedicated non-root user (appuser in group appgroup) to the Dockerfile runtime stage using addgroup/adduser
  • Set ownership of /app to appuser:appgroup after installing dependencies
  • Added USER appuser directive before the CMD instruction

Without a USER directive the Node.js process runs as UID 0 (root) inside the container. If the service is compromised this gives the attacker full write access to the container filesystem and significantly raises the risk of container escape.

Closes #45

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SECURITY][MEDIUM] Backend Dockerfile runs as root — no USER directive

1 participant