Improve asset file path handling
This commit is contained in:
parent
a9b4a5b2c7
commit
2b8939cc8b
|
|
@ -285,7 +285,14 @@ class Asset extends Extendable
|
|||
$fileName = $this->fileName;
|
||||
}
|
||||
|
||||
return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName;
|
||||
// Limit paths to those under the assets directory
|
||||
$directory = $this->theme->getPath() . '/' . $this->dirName . '/';
|
||||
$path = realpath($directory . $fileName);
|
||||
if (!starts_with($path, $directory)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue