Skip to content

Commit 64e6fe0

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

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dev/tests/functional/utils/log.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
}
1010

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

1919
echo serialize($file);

0 commit comments

Comments
 (0)