Make user ID configurable in Dockerfiles#3853
Open
Fisiu wants to merge 1 commit into
Open
Conversation
Add USER_ID build argument with default value 1001 to both runner and server Dockerfiles Make user creation and file ownership use the configurable USER_ID instead of hardcoded 1001 Signed-off-by: Mariusz Fik <fisiu82@gmail.com>
There was a problem hiding this comment.
Security review (automation): PR #3853
Scope: deployment/docker/server/Dockerfile and deployment/docker/runner/Dockerfile — configurable container UID via ARG USER_ID=1001.
Outcome: No medium, high, or critical issues identified in the changed code.
Analysis (brief):
- The new value is a Docker build-time
ARGwith default1001, substituted intoadduser -u,COPY --chown, andUSER. It does not expose Semaphore’s HTTP/API or runtime config to new attacker-controlled input. - Official release workflows (e.g.
.github/workflows/community_release.yml) do not passUSER_IDfrom PRs or other untrusted sources; downstream operators who controldocker buildalready control the Dockerfile and build context. - Choosing
USER_ID=0would run the process as root inside the image; that is an intentional deployment choice and was already achievable before this change (e.g.docker run --user 0), not a new auth boundary in the application.
No inline findings were filed because nothing met the bar for a substantiated medium+ vulnerability tied to this diff.
Sent by Cursor Automation: Find vulnerabilities
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.


Description
This PR makes the UID of the
semaphoreuser inside the Docker container configurable at build time.Why?
Many users run Semaphore on Linux hosts and want to avoid permission issues with mounted volumes (
/var/lib/semaphore, Ansible venv, etc.) by matching the container UID with their host user UID.Changes
ARG USER_ID=1001in the final Docker stageadduserto use${USER_ID}COPY --chown=instructionUSERinstruction toUSER ${USER_ID}Usage
Build with custom UID:
docker build --build-arg USER_ID=1000 -t semaphore:custom .Run with custom UID: