Переглянути джерело

[editor] jHueNotify Error message shown in UI should sanitised to prevent Html injection (#1943)

Co-authored-by: Akhil Naik <asnaik@cloudere.com>
Akhil S Naik 4 роки тому
батько
коміт
87defd31d7

+ 2 - 0
desktop/core/src/desktop/js/jquery/plugins/jquery.notify.js

@@ -15,6 +15,7 @@
 // limitations under the License.
 
 import $ from 'jquery';
+import hueUtils from 'utils/hueUtils';
 
 /*
  * jHue notify plugin
@@ -50,6 +51,7 @@ Plugin.prototype.show = function () {
   const MARGIN = 4;
 
   _this.options.message = _this.options.message.replace(/(<([^>]+)>)/gi, ''); // escape HTML messages
+  _this.options.message = hueUtils.deXSS(_this.options.message); // escape XSS messages
 
   if (
     _this.options.message !== '' &&

+ 1 - 0
desktop/core/src/desktop/static/desktop/js/jquery.notify.js

@@ -49,6 +49,7 @@
     var MARGIN = 4;
 
     _this.options.message = _this.options.message.replace(/(<([^>]+)>)/ig, ''); // escape HTML messages
+    _this.options.message = hueUtils.deXSS(_this.options.message); // escape XSS messages
 
     if (_this.options.message !== '' && $(".jHueNotify .message").last().text() !== _this.options.message) {