fix(deployer): grant baseline capabilities to every sandboxed Compose service - #947
Merged
Merged
Conversation
… service Temps dropped all Linux capabilities from every Compose service by default, only granting CHOWN/DAC_OVERRIDE/FOWNER/SETUID/SETGID back for services explicitly opted into `relaxed_capability_services`. Those five capabilities are exactly what nearly every official image's entrypoint needs to chown a data/cache directory and drop from root to a service user — not just database images, but ordinary ones like nginx:alpine — so a plain compose stack with no opt-in reliably failed with "Operation not permitted" after a full readiness timeout. Grant that minimal set by default to every sandboxed service instead, matching Docker's own out-of-the-box capability set. The opt-in list is now vestigial (kept for deserializing older stored configs) and the now-inert "Elevated permissions" per-service toggle is removed from the console; reactive/pre-deploy messaging now points at "Disable sandbox" (unsandboxed_services) for images that need capabilities beyond this default set. Security-auditor reviewed: the granted capabilities operate within a container's own mount/user namespace and cannot cross the `:ro` secrets bind-mount or reach another tenant's containers, so this does not widen the sandbox's actual attack surface. Signed-off-by: David Viejo <dviejo@kfs.es>
Greptile SummaryThe PR grants a five-capability baseline to every sandboxed Compose service while preserving the remaining sandbox controls.
Confidence Score: 5/5The PR appears safe to merge, with the capability change remaining bounded by existing Compose mount and sandbox controls. The implementation consistently grants the intended baseline only to sandboxed services, leaves unsandboxed behavior unchanged, preserves legacy configuration compatibility, and aligns operator-facing diagnostics with the new behavior.
|
| Filename | Overview |
|---|---|
| crates/temps-deployer/src/compose.rs | Applies the baseline capability set to all sandboxed services and consistently updates generation, diagnostics, and focused tests. |
| crates/temps-deployments/src/jobs/deploy_compose.rs | Removes obsolete opt-in guidance and updates deployment failure remediation for the new baseline. |
| crates/temps-entities/src/preset.rs | Retains the legacy capability field for deserialization compatibility while documenting that it is inert. |
| web/src/components/project/settings/GitSettings.tsx | Removes the obsolete elevated-permissions checkbox and explains the automatic baseline and sandbox escape hatch. |
Reviews (1): Last reviewed commit: "fix(deployer): grant baseline capabiliti..." | Re-trigger Greptile
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
cap_drop: ALLwith no capabilities granted back unless the operator explicitly opted the service intorelaxed_capability_services(the "Elevated permissions" toggle). Those 5 capabilities (CHOWN, DAC_OVERRIDE, FOWNER, SETUID, SETGID) are exactly what nearly every official image's entrypoint needs tochowna data/cache directory and drop from root to a service user — not just database images, but ordinary ones too (e.g. plainnginx:alpinewith no volumes at all). Without the opt-in, a totally standard compose stack reliably failed with"Operation not permitted"only after a full 300s readiness timeout.GitSettings.tsx) since it no longer changes anything; therelaxedCapabilityServicesfield/schema is kept only so older stored configs keep deserializing.compose.rs,deploy_compose.rs) to reflect the new default and point atunsandboxed_services("Disable sandbox") as the escape hatch for images that need capabilities beyond this default set.Security review
A
security-auditorpass confirmed this does not widen the sandbox's actual attack surface: the granted capabilities operate within a container's own mount/user namespace, cannot cross the:rosecrets bind-mount (kernel-enforcedMS_RDONLY, independent of capabilities), and there is no shared cross-tenant volume/network for them to act on.privileged, host namespaces, andcap_additself remain blocked in tenant-supplied compose files regardless.Test plan
cargo check --libontemps-deployer,temps-deployments,temps-entities,temps-presetscargo test --libon the same crates — all green (a few pre-existing Docker-network-pool-exhaustion failures on the local dev box are unrelated to this change)cargo clippy -- -D warningscleancargo fmt --checkcleancompose.rscovering: both a DB image and a plain web-server image get the baseline capability set with no opt-in; a fully unsandboxed service gets nocap_drop/cap_addat all;capability_denial_remediationreflects the new default-granted message