mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
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
This commit is contained in:
1 parent
f29ac152fb
commit
bc80d14b76
2 files changed
+37
-4
No files matched your search
@@ -0,0 +1,23 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user