v0.1.2 hotfix: add required capabilities for entrypoint init under cap_drop ALL#513
Closed
v0.1.2 hotfix: add required capabilities for entrypoint init under cap_drop ALL#513
Conversation
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.
Known Impacted Versions
Problem
Test runs with different cap than what's required.
Root Cause
docker-compose.prod.ymlspecifiescap_drop: ALLfor security hardening, which removes all Linux capabilities — including ones essential for the entrypoint's "start as root → init → drop privileges" pattern:CAP_DAC_OVERRIDE— needed for root to write to the/databind mount owned by a non-root host userCAP_SETUID/CAP_SETGID— needed bygosuto drop privilegesCAP_CHOWN— needed to set correct ownership on directories created during initFix
docker-compose.prod.ymlAdded
cap_addwith the 4 minimum capabilities needed aftercap_drop: ALL:CHOWN,DAC_OVERRIDE,SETUID,SETGIDThis follows the same pattern already used by the Caddy service in the same file.
entrypoint.shAdded early creation of the storage directory (
/data/artifacts) before the lock file resolution logic. On first boot, the directory doesn't exist yet, causing the lock file to fall back to/data. Creating it early keeps the lock file in the correct location.Security
These capabilities are only effective during the brief root initialization phase of the entrypoint. After
gosuswitches to the target UID/GID, they have no effect. The container retainsread_only: true, all other capabilities remain dropped, and the application runs with zero capabilities.Testing
(AI-generated via Claude Code w/ Opus 4.5)
Manual testing