Skip to content

Commit f969b9d

Browse files
author
Oleksandr Gorkun
committed
MAGETWO-92162: [Backport for 2.2.x] Log File Validation
1 parent 1ff3ca5 commit f969b9d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dev/tests/functional/utils/log.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
}
1010

1111
$name = urldecode($_GET['name']);
12-
$file = file_get_contents('../../../../var/log/' . $name);
12+
$logDir = realpath('../../../../var/log');
13+
$logFile = realpath($logDir .'/' .$name);
14+
if (!$logFile || !$logDir || mb_strpos($logFile, $logDir .'/') !== 0) {
15+
throw new \InvalidArgumentException('Invalid log file name');
16+
}
17+
$file = file_get_contents($logFile);
1318

1419
echo serialize($file);

0 commit comments

Comments
 (0)