security: Stop accepting other variables in install that we do not use (#7511)

This commit is contained in:
Neil Lathwood 2017-10-18 13:19:16 +01:00 committed by laf
parent 9009633392
commit cbc2757cea

View File

@ -3,7 +3,12 @@ session_start();
if (empty($_POST) && !empty($_SESSION) && !isset($_REQUEST['stage'])) {
$_POST = $_SESSION;
} elseif (!file_exists("../config.php")) {
$_SESSION = array_replace($_SESSION, $_POST);
$allowed_vars = array('stage','build-ok','dbhost','dbuser','dbpass','dbname','dbport','dbsocket','add_user','add_pass','add_email');
foreach ($allowed_vars as $allowed) {
if (isset($_POST[$allowed])) {
$_SESSION[$allowed] = $_POST[$allowed];
}
}
}
$stage = isset($_POST['stage']) ? $_POST['stage'] : 0;