mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
fix: 修复高危bug
This commit is contained in:
parent
5aded9daa3
commit
4104dea68e
@ -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);
|
||||
|
||||
@ -2117,7 +2117,7 @@ class Base
|
||||
}
|
||||
$scaleName = "";
|
||||
if ($param['fileName']) {
|
||||
$fileName = $param['fileName'];
|
||||
$fileName = basename($param['fileName']);
|
||||
} else {
|
||||
if ($param['scale'] && is_array($param['scale'])) {
|
||||
list($width, $height) = $param['scale'];
|
||||
@ -2276,7 +2276,7 @@ class Base
|
||||
if ($param['fileName'] === true) {
|
||||
$fileName = $file->getClientOriginalName();
|
||||
} elseif ($param['fileName']) {
|
||||
$fileName = $param['fileName'];
|
||||
$fileName = basename($param['fileName']);
|
||||
} else {
|
||||
if ($param['scale'] && is_array($param['scale'])) {
|
||||
list($width, $height) = $param['scale'];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user