SECURITY Sanitize messages passed to generated JS calls in FormResponse::status_message(), e.g. to avoid XSS on 'Successfully published <page title>' messages

This commit is contained in:
Ingo Schommer 2012-01-31 15:01:59 +01:00
parent bdd63913bc
commit 475e0772a2

View File

@ -146,8 +146,8 @@ class FormResponse {
* @param $status string * @param $status string
*/ */
static function status_message($message = "", $status = null) { static function status_message($message = "", $status = null) {
$JS_message = Convert::raw2js($message); $JS_message = Convert::raw2js(Convert::raw2xml($message));
$JS_status = Convert::raw2js($status); $JS_status = Convert::raw2js(Convert::raw2xml($status));
if(isset($JS_status)) { if(isset($JS_status)) {
self::$status_messages[$JS_status] = "statusMessage('{$JS_message}', '{$JS_status}');"; self::$status_messages[$JS_status] = "statusMessage('{$JS_message}', '{$JS_status}');";
} else { } else {