mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
N°1935: Security hardening
This commit is contained in:
@@ -184,7 +184,15 @@ EOF
|
||||
$sFile = utils::ReadParam('file', '', false, 'raw_data');
|
||||
$oBackup = new DBBackupScheduled();
|
||||
$sBackupDir = APPROOT.'data/backups/';
|
||||
$oBackup->DownloadBackup($sBackupDir.$sFile);
|
||||
$sPathNoDotDotPattern = '/^((?!\/\.\.\/).)*$/';
|
||||
if(preg_match($sPathNoDotDotPattern, $sBackupDir.$sFile) == 1)
|
||||
{
|
||||
$oBackup->DownloadBackup($sBackupDir.$sFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidParameterException('Invalid file path');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user