Return 404 for unused Filament import/export download routes

This commit is contained in:
Constantin Graf
2026-11-03 16:31:17 +01:00
committed by Constantin Graf
parent cc9d04ab5a
commit eab05eb92e
2 changed files with 47 additions and 0 deletions

View File

@@ -122,3 +122,9 @@ Route::get('/organization-invitations/{invitation}', [OrganizationInvitationCont
Route::get('/users/{user}/verify-email-change', [UserController::class, 'verifyEmailChange'])
->middleware(['auth:web', 'signed:relative'])
->name('users.verify-email-change');
// Filament's import/export download routes are not used, and the required tables do not exist.
Route::prefix(config('filament.system_route_prefix', 'filament'))->group(function (): void {
Route::get('/exports/{export}/download', fn () => abort(404));
Route::get('/imports/{import}/failed-rows/download', fn () => abort(404));
});

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Endpoint\Web;
use App\Models\User;
class FilamentActionsEndpointTest extends EndpointTestAbstract
{
public function test_export_download_returns_not_found(): void
{
// Act
$response = $this->get('/filament/exports/1/download');
// Assert
$response->assertNotFound();
}
public function test_import_failed_rows_download_returns_not_found(): void
{
// Act
$response = $this->get('/filament/imports/1/failed-rows/download');
// Assert
$response->assertNotFound();
}
public function test_import_failed_rows_download_returns_not_found_for_logged_in_user(): void
{
// Arrange
$user = User::factory()->withPersonalOrganization()->create();
$this->actingAs($user);
// Act
$response = $this->get('/filament/imports/1/failed-rows/download');
// Assert
$response->assertNotFound();
}
}