Files
postfixadmin/tests/SyncRoundcubemailTotpScriptTest.php
Rodrigo Cortés Cano 47667e56ab Scope Roundcube TOTP preference updates (#1133)
Limit the example Roundcube synchronization update to the selected user and disallow object instantiation while decoding stored preferences.

The script also validates its arguments and safely initializes malformed preference data.

Refs #1128

thanks @TrapoSAMA
2026-08-29 14:56:57 +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);
}
}