fix: 修复高危bug

This commit is contained in:
weifashi
2023-12-28 23:15:22 +08:00
parent 5aded9daa3
commit 4104dea68e
2 changed files with 6 additions and 2 deletions

View File

@@ -321,6 +321,10 @@ class IndexController extends InvokeController
$data = parse_url($key);
$path = Arr::get($data, 'path');
$file = public_path($path);
// 防止 ../ 穿越获取到系统文件
if (strpos(realpath($file), public_path()) !== 0) {
return abort(404);
}
//
if (file_exists($file)) {
parse_str($data['query'], $query);