From 468645cee8aff4720b879ed512c1fbd664bcbc75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 May 2026 15:25:53 +0200 Subject: [PATCH] Doc --- htdocs/waf.inc.php | 2 +- test/phpunit/SecurityTest.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/waf.inc.php b/htdocs/waf.inc.php index d8323180dfa..ba9230297c5 100644 --- a/htdocs/waf.inc.php +++ b/htdocs/waf.inc.php @@ -318,7 +318,7 @@ if (!empty($_SERVER["REQUEST_METHOD"]) && $_SERVER["REQUEST_METHOD"] == "TRACE") // Sanity check on URL if (!defined('NOSCANPHPSELFFORINJECTION') && !empty($_SERVER["PHP_SELF"])) { - $morevaltochecklikepost = array($_SERVER["PHP_SELF"]); + $morevaltochecklikepost = array($_SERVER["PHP_SELF"]); // Note:if an url is called with mypage.php/aaa/bbb (used only by API) the aaa/bbb is also part of $_SERVER["PHP_SELF"] so analyzed too. analyseVarsForSqlAndScriptsInjection($morevaltochecklikepost, 2); } // Sanity check on GET parameters diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 3a2ad5e114b..de9446d5d51 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -144,6 +144,10 @@ class SecurityTest extends CommonClassTest $result = testSqlAndScriptInject($_SERVER["PHP_SELF"], 2); $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject for PHP_SELF that should detect XSS'); + $_SERVER["PHP_SELF"] = '/dolibarr/htdocs/admin/index.php/aaa%bbb'; + $result = testSqlAndScriptInject($_SERVER["PHP_SELF"], 2); + $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject for PHP_SELF that should detect % inside URL'); + $test = 'select @@version'; $result = testSqlAndScriptInject($test, 0); $this->assertEquals($expectedresult, $result, 'Error on testSqlAndScriptInject for SQL1a. Should find an attack on POST param and did not.');