Skip to content

Commit 40e1e38

Browse files
author
galiautdinov
committed
fix: gate docker container lifecycle mutations on docker:read
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.
1 parent 0e5fc58 commit 40e1e38

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎apps/dokploy/server/api/routers/docker.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const dockerRouter = createTRPCRouter({
3838
return await getContainers(input.serverId);
3939
}),
4040

41-
restartContainer: withPermission("service", "read")
41+
restartContainer: withPermission("docker", "read")
4242
.input(
4343
z.object({
4444
containerId: z
@@ -64,7 +64,7 @@ export const dockerRouter = createTRPCRouter({
6464
});
6565
}),
6666

67-
startContainer: withPermission("service", "read")
67+
startContainer: withPermission("docker", "read")
6868
.input(
6969
z.object({
7070
containerId: z
@@ -90,7 +90,7 @@ export const dockerRouter = createTRPCRouter({
9090
});
9191
}),
9292

93-
stopContainer: withPermission("service", "read")
93+
stopContainer: withPermission("docker", "read")
9494
.input(
9595
z.object({
9696
containerId: z
@@ -116,7 +116,7 @@ export const dockerRouter = createTRPCRouter({
116116
});
117117
}),
118118

119-
killContainer: withPermission("service", "read")
119+
killContainer: withPermission("docker", "read")
120120
.input(
121121
z.object({
122122
containerId: z

0 commit comments

Comments
 (0)