fix(security): remove unused application config download action

This commit is contained in:
Andras Bacsai
2026-09-23 22:07:11 +02:00
parent 46988dcec2
commit 73b12ba0da
2 changed files with 16 additions and 14 deletions
@@ -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();
@@ -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]);