mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-22 15:22:22 +00:00
fix: improve robustness and security in database restore flows
- Add null checks for server instances in restore events to prevent errors - Escape S3 credentials to prevent command injection vulnerabilities - Fix file upload clearing custom location to prevent UI confusion - Optimize isSafeTmpPath helper by avoiding redundant dirname calls - Remove unnecessary --rm flag from long-running S3 restore container - Prioritize uploaded files over custom location in import logic - Add comprehensive unit tests for restore event null server handling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -639,7 +639,13 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
||||
} else {
|
||||
$commands[] = "docker run -d --network {$network} --name backup-of-{$this->backup_log_uuid} --rm -v $this->backup_location:$this->backup_location:ro {$fullImageName}";
|
||||
}
|
||||
$commands[] = "docker exec backup-of-{$this->backup_log_uuid} mc alias set temporary {$endpoint} {$key} \"{$secret}\"";
|
||||
|
||||
// Escape S3 credentials to prevent command injection
|
||||
$escapedEndpoint = escapeshellarg($endpoint);
|
||||
$escapedKey = escapeshellarg($key);
|
||||
$escapedSecret = escapeshellarg($secret);
|
||||
|
||||
$commands[] = "docker exec backup-of-{$this->backup_log_uuid} mc alias set temporary {$escapedEndpoint} {$escapedKey} {$escapedSecret}";
|
||||
$commands[] = "docker exec backup-of-{$this->backup_log_uuid} mc cp $this->backup_location temporary/$bucket{$this->backup_dir}/";
|
||||
instant_remote_process($commands, $this->server);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user