Stop FormHelper from emitting inline validity handlers #71

Merged
gnilebein merged 1 commits from fix/csp-inline-validity-handlers into main 2026-11-12 22:58:27 +01:00
2 changed files with 4 additions and 0 deletions
Showing only changes of commit 220227fa86 - Show all commits

No files matched your search

+2
View File
@@ -38,5 +38,7 @@ class AppView extends View
public function initialize(): void
{
$this->addHelper('Format');
// No generated oninvalid/oninput handlers: the CSP blocks inline event handlers.
$this->addHelper('Form', ['autoSetCustomValidity' => false]);
}
}
@@ -64,6 +64,8 @@ class AdminFragmentTest extends TestCase
$this->assertResponseNotContains('onclick=');
$this->assertResponseContains('data-confirm=');
// Required fields (settings form) must not get generated oninvalid/oninput handlers, the CSP blocks them.
$this->assertDoesNotMatchRegularExpression('/\son[a-z]+="/', (string)$this->_response->getBody());
}
public function testSlideFormFragmentIsTheDialogContent(): void