Files
coolify/tests/Feature/ServerIndexIpExposureTest.php
T
Andras BacsaiandClaude Opus 5.5 f008e0593b fix(server): hide server IP addresses on the servers list
The dashboard redesign added an IP address column to the servers list
and put each server IP into the Alpine data, so the IP showed in the
page source. Remove the column and the value, and render the component
in the test instead of matching template strings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:28:01 +02:00

43 lines
1.3 KiB
PHP

<?php
use App\Http\Middleware\PreventRequestsDuringMaintenance;
use App\Livewire\Server\Index as ServerIndex;
use App\Models\InstanceSettings;
use App\Models\PrivateKey;
use App\Models\Server;
use App\Models\Team;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
uses(RefreshDatabase::class);
beforeEach(function () {
$this->withoutMiddleware(PreventRequestsDuringMaintenance::class);
InstanceSettings::unguarded(fn () => InstanceSettings::updateOrCreate(['id' => 0], ['id' => 0]));
$this->team = Team::factory()->create();
$this->user = User::factory()->create();
$this->user->teams()->attach($this->team, ['role' => 'owner']);
$privateKey = PrivateKey::factory()->create(['team_id' => $this->team->id]);
$this->server = Server::factory()->create([
'name' => 'production-server',
'ip' => '203.0.113.45',
'team_id' => $this->team->id,
'private_key_id' => $privateKey->id,
]);
$this->actingAs($this->user);
session(['currentTeam' => $this->team]);
});
test('server index does not expose server IP addresses', function () {
Livewire::test(ServerIndex::class)
->assertSee('production-server')
->assertDontSee('203.0.113.45')
->assertDontSee('IP address');
});