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()