Skip to content

Commit 3904da9

Browse files
authored
Merge pull request #58864 from nextcloud/fix/cached_exporter_hardening
2 parents 9b54383 + 509784c commit 3904da9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/private/OpenMetrics/Exporters/Cached.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use OCP\ICache;
1414
use OCP\ICacheFactory;
1515
use OCP\OpenMetrics\IMetricFamily;
16+
use OCP\OpenMetrics\Metric;
17+
use OCP\OpenMetrics\MetricValue;
1618
use Override;
1719

1820
/**
@@ -43,7 +45,12 @@ abstract public function gatherMetrics(): Generator;
4345
public function metrics(): Generator {
4446
$cacheKey = static::class;
4547
if ($data = $this->cache->get($cacheKey)) {
46-
yield from unserialize($data);
48+
yield from unserialize(
49+
$data,
50+
[
51+
'allowed_classes' => [Metric::class, MetricValue::class],
52+
],
53+
);
4754
return;
4855
}
4956

0 commit comments

Comments
 (0)