fix: enforce docker:read on container start/stop/kill/restart mutations#4332
Open
iExad wants to merge 1 commit intoDokploy:canaryfrom
Open
fix: enforce docker:read on container start/stop/kill/restart mutations#4332iExad wants to merge 1 commit intoDokploy:canaryfrom
iExad wants to merge 1 commit intoDokploy:canaryfrom
Conversation
restartContainer, startContainer, stopContainer and killContainer
were guarded by withPermission("service", "read"), which the default
member role grants. Any authenticated org member with an API key
could start/stop/kill/restart any container in the organization,
regardless of canAccessToDocker or accessedServices scope.
Switch the four mutations to withPermission("docker", "read"),
matching removeContainer, getConfig and getContainers. Members now
need canAccessToDocker=true (legacy override) or an explicit
docker:read grant via a custom role to invoke them.
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
docker.startContainer,docker.stopContainer,docker.killContainer,docker.restartContainer) were gated bywithPermission("service", "read"),which the default member role grants. Any authenticated org member
with an API key could change the state of any container in the
organization — regardless of
canAccessToDockeroraccessedServicesscope. Read-only endpoints andremoveContainerwere already correctly gated on
docker:read.withPermission("docker", "read"),matching
removeContainer,getConfigandgetContainers. Membercallers now need
canAccessToDocker=true(legacy override ingetLegacyOverrides) or an explicitdocker:readgrant via acustom role.
Severity
Privilege escalation inside an organization — a member could DoS
production containers (DBs, Traefik, app/compose services) and cycle
them in a loop. No audit log in OSS, so recovery is via host-level
docker logs only.
Reproduction (before fix)
With a member API key where
canAccessToDocker=falseand the targetcontainer is outside
accessedServices/accessedProjects:Greptile Summary
This PR fixes a privilege escalation vulnerability where four Docker mutation endpoints (
restartContainer,startContainer,stopContainer,killContainer) were gated bywithPermission("service", "read")instead ofwithPermission("docker", "read"). Since thememberRolegrantsservice: ["read"]butdocker: [], any authenticated org member could mutate container state without needingcanAccessToDocker=trueor a custom role granting docker access. The fix aligns all destructive docker endpoints withremoveContainer,getConfig, andgetContainers, which were already correctly gated ondocker:read.Confidence Score: 5/5
Safe to merge — minimal, targeted fix with no regressions.
The change is a four-line permission string swap, each line verified against the access-control statements (
dockeronly defines"read", andmemberRolegrantsdocker: []). The fix is consistent with the pre-existing pattern used byremoveContainer,getConfig, andgetContainers. No logic, schema, or API surface is changed beyond the permission gate.No files require special attention.
Reviews (1): Last reviewed commit: "fix: gate docker container lifecycle mut..." | Re-trigger Greptile