mirror of https://github.com/apache/cloudstack.git
cloudstack 3.0 UI - XSS - detailView in Edit mode - fix it to show original value instead of HTML-encoding value.
This commit is contained in:
parent
5d96f58814
commit
17bada6a62
|
|
@ -56,7 +56,7 @@
|
|||
};
|
||||
|
||||
/**
|
||||
* Sanitize user input -- shortcut _s
|
||||
* Sanitize user input (HTML Encoding) -- shortcut _s
|
||||
*
|
||||
* Strip unwanted characters from user-based input
|
||||
*/
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
else if(typeof(value) == null || typeof(value) == "undefined") {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
var sanitized = value
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
|
|
@ -84,4 +84,17 @@
|
|||
|
||||
return sanitized;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reverse sanitization (HTML Decoding)
|
||||
*/
|
||||
cloudStack.sanitizeReverse = function(value) {
|
||||
var reversedValue = value
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">");
|
||||
|
||||
return reversedValue;
|
||||
};
|
||||
|
||||
})(jQuery, cloudStack);
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@
|
|||
// Turn into form field
|
||||
var selectData = $value.data('detail-view-editable-select');
|
||||
var isBoolean = $value.data('detail-view-editable-boolean');
|
||||
var data = !isBoolean ? $value.html() : $value.data('detail-view-boolean-value');
|
||||
var data = !isBoolean ? cloudStack.sanitizeReverse($value.html()) : $value.data('detail-view-boolean-value');
|
||||
|
||||
$value.html('');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue