mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
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
24 lines
649 B
PHP
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);
|
|
}
|
|
}
|