From 14401a90f81bf8fe18918247bd7091dbd2070c69 Mon Sep 17 00:00:00 2001 From: Manuk Date: Wed, 11 Nov 2026 19:49:34 +0400 Subject: [PATCH] fix: escape the field name in the field row --- .../views/livewire/manage-custom-field.blade.php | 4 ++-- .../Admin/Pages/CustomFieldsFieldManagementTest.php | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/resources/views/livewire/manage-custom-field.blade.php b/resources/views/livewire/manage-custom-field.blade.php index e8087b5e..0b33dd0e 100644 --- a/resources/views/livewire/manage-custom-field.blade.php +++ b/resources/views/livewire/manage-custom-field.blade.php @@ -33,8 +33,8 @@ class="h-4.5 w-4.5 text-neutral-700 dark:text-neutral-400 ml-2" {{ $this->editAction()->icon(false) - ->label(new HtmlString(''.$field->name.'')) - ->extraAttributes(['class' => 'truncate', 'x-tooltip.raw' => $field->name]) + ->label(new HtmlString(''.e($field->name).'')) + ->extraAttributes(['class' => 'truncate', 'x-tooltip.raw' => e($field->name)]) ->link() }} diff --git a/tests/Feature/Admin/Pages/CustomFieldsFieldManagementTest.php b/tests/Feature/Admin/Pages/CustomFieldsFieldManagementTest.php index 64c316ff..697b10bc 100644 --- a/tests/Feature/Admin/Pages/CustomFieldsFieldManagementTest.php +++ b/tests/Feature/Admin/Pages/CustomFieldsFieldManagementTest.php @@ -239,6 +239,17 @@ ]); }); + it('renders the field name as text in the field row', function (): void { + $this->field->update(['name' => '">']); + + livewire(ManageCustomField::class, [ + 'field' => $this->field, + ]) + ->assertDontSeeHtml('') + ->assertSeeHtml('"><img src=x onerror=alert(1)>') + ->assertSeeHtml('x-tooltip.raw=""><img src=x onerror=alert(1)>"'); + }); + it('can activate an inactive field', function (): void { // Arrange $inactiveField = CustomField::factory()