mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-21 22:05:23 +02:00
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:
@@ -13,6 +13,8 @@ import { db } from "@dokploy/server/db";
|
||||
import {
|
||||
createVolumeBackupSchema,
|
||||
updateVolumeBackupSchema,
|
||||
VOLUME_NAME_MESSAGE,
|
||||
VOLUME_NAME_REGEX,
|
||||
volumeBackups,
|
||||
} from "@dokploy/server/db/schema";
|
||||
import { findDestinationById } from "@dokploy/server/services/destination";
|
||||
@@ -275,7 +277,10 @@ export const volumeBackupsRouter = createTRPCRouter({
|
||||
z.object({
|
||||
backupFileName: z.string().min(1),
|
||||
destinationId: z.string().min(1),
|
||||
volumeName: z.string().min(1),
|
||||
volumeName: z
|
||||
.string()
|
||||
.min(1)
|
||||
.regex(VOLUME_NAME_REGEX, VOLUME_NAME_MESSAGE),
|
||||
id: z.string().min(1),
|
||||
serviceType: z.enum(["application", "compose"]),
|
||||
serverId: z.string().optional(),
|
||||
|
||||
Reference in New Issue
Block a user