From 93a512c11cfb1404da0942f0256e06f52744a3e4 Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:55:22 +0100 Subject: [PATCH 1/2] feat: make plugin CSP compliant --- CHANGELOG.md | 4 ++++ setup.php | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9738197..0efc0a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [UNRELEASED] +### Changed + +- Make the plugin compatible with the Content Security Policy + ### Fixed - Fix hidden question not available in anonymous forms diff --git a/setup.php b/setup.php index ba4f51f..66f1934 100644 --- a/setup.php +++ b/setup.php @@ -93,6 +93,7 @@ function plugin_version_advancedforms(): array 'author' => 'Teclib\'', 'license' => '', 'homepage' => '', + 'csp_compliant' => true, 'requirements' => [ 'glpi' => [ 'min' => PLUGIN_ADVANCEDFORMS_MIN_GLPI_VERSION, From d482861472b979b82bdd8395871c8d182be820e4 Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Tue, 10 Nov 2026 16:01:25 +0100 Subject: [PATCH 2/2] test: expect access denied on config tab for technician --- tests/Front/ConfigFormTest.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/Front/ConfigFormTest.php b/tests/Front/ConfigFormTest.php index 004a7d0..bbf7895 100644 --- a/tests/Front/ConfigFormTest.php +++ b/tests/Front/ConfigFormTest.php @@ -77,14 +77,13 @@ public function testTabHasContentExistOnConfigPageForAdmin(): void $this->assertCount(1, $config_header); } - public function testTabContentIsEmptyForTech(): void + public function testTabContentIsDeniedForTech(): void { - // Act: go to the advanced form tab on the config - $this->login('tech'); - $crawler = $this->get("/ajax/common.tabs.php", $this->getConfigTabUrlParams()); + $this->expectException(AccessDeniedHttpException::class); - // Assert: no html was rendered as we lack rights to view config - $this->assertEmpty($crawler); + // Act: go to the advanced form tab on the config as technician + $this->login('tech'); + $this->get("/ajax/common.tabs.php", $this->getConfigTabUrlParams()); } #[DataProvider('provideQuestionTypes')]