mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Added XSS check for uploaded SVG files before they get stored (in Form plugin)
This commit is contained in:
parent
4d4efb31e3
commit
492cc1d2f1
|
|
@ -23,6 +23,7 @@ use Grav\Common\User\Interfaces\UserInterface;
|
|||
use Grav\Common\Utils;
|
||||
use Grav\Framework\Compat\Serializable;
|
||||
use Grav\Framework\ContentBlock\HtmlBlock;
|
||||
use Grav\Framework\Form\FormFlashFile;
|
||||
use Grav\Framework\Form\Interfaces\FormFlashInterface;
|
||||
use Grav\Framework\Form\Interfaces\FormInterface;
|
||||
use Grav\Framework\Session\SessionInterface;
|
||||
|
|
@ -775,13 +776,16 @@ trait FormTrait
|
|||
{
|
||||
// Handle bad filenames.
|
||||
$filename = $file->getClientFilename();
|
||||
|
||||
if ($filename && !Utils::checkFilename($filename)) {
|
||||
$grav = Grav::instance();
|
||||
throw new RuntimeException(
|
||||
sprintf($grav['language']->translate('PLUGIN_FORM.FILEUPLOAD_UNABLE_TO_UPLOAD', null, true), $filename, 'Bad filename')
|
||||
);
|
||||
}
|
||||
|
||||
if ($file instanceof FormFlashFile) {
|
||||
$file->checkXss();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user