fix(security): validate volumeName and escape volume-backup file names

Add VOLUME_NAME_REGEX (Docker volume-name format) and enforce it on volumeName in
create/update/runManually — a legit volume name never contains shell metacharacters,
so this blocks injection across every docker run/rm/rclone sink at once. Escape the
user-supplied backupFileName and the mount volumeName in database rebuild with quote().
This commit is contained in:
Mauricio Siu
2026-07-20 16:45:55 -06:00
parent eeb6e7b8ea
commit d629faebc6
5 changed files with 25 additions and 6 deletions
@@ -14,6 +14,7 @@ import { deployMySql } from "@dokploy/server/services/mysql";
import { deployPostgres } from "@dokploy/server/services/postgres";
import { deployRedis } from "@dokploy/server/services/redis";
import { eq } from "drizzle-orm";
import { quote } from "shell-quote";
import { removeService } from "../docker/utils";
import { execAsync, execAsyncRemote } from "../process/execAsync";
@@ -40,7 +41,7 @@ export const rebuildDatabase = async (
for (const mount of database.mounts) {
if (mount.type === "volume") {
const command = `docker volume rm ${mount?.volumeName} --force`;
const command = `docker volume rm ${quote([mount?.volumeName ?? ""])} --force`;
if (database.serverId) {
await execAsyncRemote(database.serverId, command);
} else {