Skip to content

Commit e8c101f

Browse files
XananasX7marcelklehr
authored andcommitted
fix(TaskProcessing): restrict allowed_classes in Manager cache deserialization
The availableTaskTypes cache stores serialized arrays containing ShapeDescriptor objects, ShapeEnumValue objects, and EShapeType enum values. The unserialize() call did not restrict which classes could be instantiated. Restrict deserialization to the three known types: - OCP\TaskProcessing\ShapeDescriptor - OCP\TaskProcessing\ShapeEnumValue - OCP\TaskProcessing\EShapeType This prevents PHP Object Injection if an attacker gains write access to the distributed cache backend. Signed-off-by: El Mehdi Abenhazou <mehdiananas007@gmail.com>
1 parent d0cce3d commit e8c101f

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/private/TaskProcessing/Manager.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -939,12 +939,12 @@ public function getAvailableTaskTypes(bool $showDisabled = false, ?string $userI
939939
$cachedValue = $this->distributedCache->get($cacheKey);
940940
if ($cachedValue !== null) {
941941
$this->availableTaskTypes = unserialize($cachedValue, [
942-
'allowed_classes' => [
943-
ShapeDescriptor::class,
944-
ShapeEnumValue::class,
945-
EShapeType::class,
946-
],
947-
]);
942+
'allowed_classes' => [
943+
ShapeDescriptor::class,
944+
ShapeEnumValue::class,
945+
EShapeType::class,
946+
],
947+
]);
948948
}
949949
}
950950
// Either we have no cache or showDisabled is turned on, which we don't want to cache, ever.

0 commit comments

Comments
 (0)