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:
Rodrigo Cortés Cano authored and GitHub committed 2026-09-02 20:30:36 +01:00
1 parent f29ac152fb
commit bc80d14b76
2 files changed
+37 -4

No files matched your search

+23
View File
@@ -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);
}
}