diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index 030f5341fb..ac30f04cd7 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -2,7 +2,6 @@ namespace App\Livewire\Project\Application; -use App\Actions\Application\GenerateConfig; use App\Enums\StaticImageTypes; use App\Jobs\ApplicationDeploymentJob; use App\Livewire\Project\Service\Storage; @@ -904,19 +903,6 @@ class General extends Component } } - public function downloadConfig() - { - $config = GenerateConfig::run($this->application, true); - $fileName = str($this->application->name)->slug()->append('_config.json'); - - return response()->streamDownload(function () use ($config) { - echo $config; - }, $fileName, [ - 'Content-Type' => 'application/json', - 'Content-Disposition' => 'attachment; filename='.$fileName, - ]); - } - public function getDetectedPortInfoProperty(): ?array { $detectedPort = $this->application->detectPortFromEnvironment(); diff --git a/tests/Feature/Authorization/ApplicationConfigAuthorizationTest.php b/tests/Feature/Authorization/ApplicationConfigAuthorizationTest.php index 93c9658a7b..2db4a30dd3 100644 --- a/tests/Feature/Authorization/ApplicationConfigAuthorizationTest.php +++ b/tests/Feature/Authorization/ApplicationConfigAuthorizationTest.php @@ -173,6 +173,22 @@ test('member cannot update application general settings', function () { expect($this->member->can('update', $this->application))->toBeFalse(); }); +test('application config download is not callable through Livewire', function () { + $this->actingAs($this->member); + session(['currentTeam' => $this->team]); + $this->application->update([ + 'static_image' => 'nginx:alpine', + 'base_directory' => '/', + 'is_http_basic_auth_enabled' => false, + 'redirect' => 'no', + ]); + + $component = Livewire::test(ApplicationGeneral::class, ['application' => $this->application]); + + expect(fn () => $component->call('downloadConfig')) + ->toThrow(MethodNotFoundException::class); +}); + test('member cannot reset application labels', function () { $this->actingAs($this->member); session(['currentTeam' => $this->team]);