Skip to content

Commit 95a5148

Browse files
committed
Fix collection path traversal
GHSA-x275-h9j4-7p4h
1 parent 90acf7e commit 95a5148

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Cms/Collections.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ public function load(string $name): mixed
105105
{
106106
$kirby = App::instance();
107107

108-
// first check for collection file
109-
$file = $kirby->root('collections') . '/' . $name . '.php';
108+
// first check for collection file in the `collections` root
109+
$root = $kirby->root('collections');
110+
$file = $root . '/' . $name . '.php';
110111

111-
if (is_file($file) === true) {
112+
if (F::exists($file, $root) === true) {
112113
$collection = F::load($file, allowOutput: false);
113114

114115
if ($collection instanceof Closure) {

0 commit comments

Comments
 (0)