Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(backups): allow volume backup delete without password when 2FA off

Andras Bacsaifab012b5c847
diff --git a/app/Livewire/Project/Shared/Storages/VolumeBackups.php b/app/Livewire/Project/Shared/Storages/VolumeBackups.php
index d16a5e2c8a..a378101b88 100644
--- a/app/Livewire/Project/Shared/Storages/VolumeBackups.php
+++ b/app/Livewire/Project/Shared/Storages/VolumeBackups.php
@@ -206,7 +206,7 @@ class VolumeBackups extends Component
{
$this->authorize('update', $this->resource);
- if (! $password || ! verifyPasswordConfirmation($password, $this)) {
+ if (! verifyPasswordConfirmation($password, $this)) {
return 'The provided password is incorrect.';
}
diff --git a/tests/Feature/VolumeBackupTest.php b/tests/Feature/VolumeBackupTest.php
index 17194a1874..7e8ee0c21b 100644
--- a/tests/Feature/VolumeBackupTest.php
+++ b/tests/Feature/VolumeBackupTest.php
@@ -1151,6 +1151,23 @@ it('deletes local archives before deleting a volume backup schedule', function (
&& str_contains($process->command, 'archive.tar.gz'));
});
+it('deletes a volume backup schedule without a password when two-step confirmation is disabled', function () {
+ $team = Team::factory()->create();
+ signInForVolumeBackups($this, $team);
+ [$application, $volume] = createVolumeBackupApplication($team);
+ InstanceSettings::get()->update(['disable_two_step_confirmation' => true]);
+ $backup = $volume->scheduledBackups()->create([
+ 'team_id' => $team->id,
+ 'frequency' => 'daily',
+ ]);
+
+ Livewire::test(VolumeBackups::class, ['storage' => $volume, 'resource' => $application])
+ ->call('delete', '')
+ ->assertDispatched('success');
+
+ expect($backup->fresh())->toBeNull();
+});
+
it('deletes S3 archives from the storage recorded on each execution', function () {
$team = Team::factory()->create();
signInForVolumeBackups($this, $team);