Repository navigation
Run sync server container as a non-root user - #26
Merged
Merged
Conversation
The Dockerfile had no USER directive, so the Pode process ran as root inside the container. Add a fixed-UID/GID non-root user, own /data before the VOLUME instruction (so a fresh named volume inherits that ownership on first mount), and switch to it before ENTRYPOINT. No existing deployments to migrate yet - this repo's sync server just landed on main.
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.
Summary
server/Dockerfilehad noUSERdirective, so the Pode process ran as root inside the container - standard container-hardening practice is to drop privileges.10001:10001) non-root user,chowns/datato it before theVOLUMEinstruction (so a fresh named volume inherits that ownership on first mount, per Docker's documented behavior for empty volumes), and switches to it beforeENTRYPOINT.mainand isn't in real use yet, so there's no root-owned volume upgrade path to worry about.Found during a security review of the new sync server feature.
Test plan
docker buildsucceeded with the new user/ownership steps.docker run --entrypoint pwsh ... idconfirmed the container runs asuid=10001(strongbox) gid=10001(strongbox), not root./data/admin-bootstrap-tokenand/data/strongbox-sync.dbsuccessfully as the non-root user (both owned bystrongbox:strongbox), and that the API responded (401 unauthenticated) as expected.