N°1933: Security hardening

This commit is contained in:
Stephen Abello
2019-01-14 11:57:16 +01:00
parent dfe81f6272
commit ed3fd851f1

View File

@@ -527,6 +527,8 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
* @param string $sFile * @param string $sFile
*/ */
public function DownloadBackup($sFile) public function DownloadBackup($sFile)
{
if (file_exists($sFile))
{ {
header('Content-Description: File Transfer'); header('Content-Description: File Transfer');
header('Content-Type: multipart/x-zip'); header('Content-Type: multipart/x-zip');
@@ -537,6 +539,11 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the "
header('Content-Length: '.filesize($sFile)); header('Content-Length: '.filesize($sFile));
readfile($sFile) ; readfile($sFile) ;
} }
else
{
throw new InvalidParameterException('Invalid file path');
}
}
/** /**
* Helper to open a Database connection * Helper to open a Database connection