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