Skip to content

Run sync server container as a non-root user - #26

Merged
jpol34 merged 1 commit into
mainfrom
sync-server-dockerfile-nonroot
Sep 16, 2026
Merged

jpol34 merged 1 commit into
mainfrom
sync-server-dockerfile-nonroot

Conversation

@jpol34

@jpol34 jpol34 commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • The sync server's server/Dockerfile had no USER directive, so the Pode process ran as root inside the container - standard container-hardening practice is to drop privileges.
  • Adds a fixed-UID/GID (10001:10001) non-root user, chowns /data to it before the VOLUME instruction (so a fresh named volume inherits that ownership on first mount, per Docker's documented behavior for empty volumes), and switches to it before ENTRYPOINT.
  • No existing deployments to migrate - confirmed with @jpol34 this sync server feature just landed on main and 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 build succeeded with the new user/ownership steps.
  • docker run --entrypoint pwsh ... id confirmed the container runs as uid=10001(strongbox) gid=10001(strongbox), not root.
  • Started the server as this container and confirmed it created /data/admin-bootstrap-token and /data/strongbox-sync.db successfully as the non-root user (both owned by strongbox:strongbox), and that the API responded (401 unauthenticated) as expected.

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.
@jpol34
jpol34 merged commit 5735842 into main Sep 16, 2026
1 check passed
@jpol34
jpol34 deleted the sync-server-dockerfile-nonroot branch September 16, 2026 22:45
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.

2 participants