Merge remote-tracking branch 'origin/support/3.2' into support/3.3

# Conflicts:
#	application/utils.inc.php
This commit is contained in:
jf-cbd
2026-10-08 14:31:52 +02:00
3 changed files with 72 additions and 0 deletions

View File

@@ -72,6 +72,30 @@ class utilsTest extends ItopTestCase
];
}
/**
* @dataProvider DoPostRequestAllowedProtocolsProvider
*/
public function testDoPostRequestRespectsAllowedProtocolsConfig(string $sAllowedProtocols, bool $bFileProtocolAllowed): void
{
// Config::Set changes the in-memory setting only; the test framework reloads config after this test class.
utils::GetConfig()->Set('security.post_requests.allowed_protocols', $sAllowedProtocols);
if (!$bFileProtocolAllowed) {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Problem opening URL');
} else {
$this->expectNotToPerformAssertions();
}
utils::DoPostRequest('file:///tmp', ['payload' => 'test']);
}
public function DoPostRequestAllowedProtocolsProvider(): array
{
return [
'file protocol is allowed' => ['file,http,https', true],
'file protocol is not allowed' => ['http,https', false],
];
}
/**
* @dataProvider realPathDataProvider
* @covers utils::RealPath()