mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
84f47f5c86
commit
5fe7091dff
@ -148,8 +148,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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user