Files
postfixadmin/tests/SyncRoundcubemailTotpScriptTest.php
Rodrigo Cortés Cano bc80d14b76 4.x: scope Roundcube TOTP preference updates (#1139)
Limit the Roundcube preference update to the selected user and prevent serialized preferences from instantiating classes.

This ports PR #1133 with PHP 7.4 compatibility and validates the script arguments before accessing them.

Refs #1128

Thanks @TrapoAMA
2026-09-02 20:30:36 +01:00

24 lines
649 B
PHP

<?php
use PHPUnit\Framework\TestCase;
class SyncRoundcubemailTotpScriptTest extends TestCase
{
private string $script;
protected function setUp(): void
{
$this->script = file_get_contents(__DIR__ . '/../scripts/examples/sync-roundcubemail-totp.php');
}
public function testUpdateIsLimitedToTheSelectedUser(): void
{
$this->assertStringContainsString('UPDATE users SET preferences=? WHERE user_id=?', $this->script);
}
public function testSerializedPreferencesCannotInstantiateClasses(): void
{
$this->assertStringContainsString("['allowed_classes' => false]", $this->script);
}
}