mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #4677] [bug]: Container images should not run as root user #1739
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#1739
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @muellerst-hg on GitHub (Jan 16, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4677
Is there an existing issue for this?
Current behavior
By default, both the HoppScotch AIO image as well as the three individual container images run their processes as root user.
Threat model
The threat models of root containers are that attackers can misuse privileges to:
Reason
The underlying base images
caddy:2-alpineandnode:20-alpine3.19by default use root user and the HoppScotch Dockerfile never sets theUSER.Solution
Instead, the container processes should be run by an unprivileged user, which is a containerization best practice.
This can be achieved in the Dockerfile by using creating a non-privileged user or use an existing one from the base image (e.g.
nodewith uid 1000) and handing over withUSERWorkarounds
Forcing the container orchestration to run the container as different user (e.g. using securtyContext) fails, because the process at least on startup needs write access to directories owned by root, e.g.
/site/build.env. So switching to a non-privileged user would also require to change directory/file permissions.Steps to reproduce
Check which user is used in the AIO container image
Try to start the AIO container image as non-privileged user
nodeAlternatively, in Kubernetes try running the pods with the following securityContext with the same output as above:
Environment
Production
Version
Self-hosted
@rb090 commented on GitHub (Jan 22, 2026):
Thank you @muellerst-hg for creating this issue 🙌.
I would also like to the container processes to run by an unprivileged user. I strongly agree with this best practice. Can you please share if there is any updates on this @AndrewBastin @liyasthomas? I am using the AIO container atm.