fix(DatabaseBackupJob): escape PostgreSQL password in backup command (#5759)

This commit is contained in:
busybox
2025-05-03 13:34:40 +02:00
committed by GitHub
parent d8185e3d6a
commit edb4e60478

View File

@@ -390,7 +390,7 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
$commands[] = 'mkdir -p '.$this->backup_dir; $commands[] = 'mkdir -p '.$this->backup_dir;
$backupCommand = 'docker exec'; $backupCommand = 'docker exec';
if ($this->postgres_password) { if ($this->postgres_password) {
$backupCommand .= " -e PGPASSWORD=$this->postgres_password"; $backupCommand .= " -e PGPASSWORD=\"{$this->postgres_password}\"";
} }
if ($this->backup->dump_all) { if ($this->backup->dump_all) {
$backupCommand .= " $this->container_name pg_dumpall --username {$this->database->postgres_user} | gzip > $this->backup_location"; $backupCommand .= " $this->container_name pg_dumpall --username {$this->database->postgres_user} | gzip > $this->backup_location";