Skip to content

Commit 43d3a0f

Browse files
author
Oleksandr Gorkun
committed
MAGETWO-92160: Log File Validation
1 parent 03ab0fd commit 43d3a0f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

dev/tests/functional/utils/log.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
*/
66

77
if (!isset($_GET['name'])) {
8-
throw new \InvalidArgumentException('The name of log file is required for getting logs.');
8+
throw new \InvalidArgumentException(
9+
'The name of log file is required for getting logs.'
10+
);
911
}
10-
1112
$name = urldecode($_GET['name']);
12-
$file = file_get_contents('../../../../var/log/' . $name);
13+
if (preg_match('/\.\.(\\\|\/)/', $name)) {
14+
throw new \InvalidArgumentException('Invalid log file name');
15+
}
1316

14-
echo serialize($file);
17+
echo serialize(file_get_contents('../../../../var/log' .'/' .$name));

0 commit comments

Comments
 (0)