Преглед изворни кода

addressing false positive jsverify rngState 85f362db8950cea741

El RIDO пре 6 година
родитељ
комит
12c83a13c7
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      js/test/AttachmentViewer.js

+ 6 - 1
js/test/AttachmentViewer.js

@@ -88,7 +88,12 @@ describe('AttachmentViewer', function () {
                 if (prefix.indexOf('<a') === -1 && postfix.indexOf('<a') === -1) {
                     result = $('<textarea>').text((prefix + filename + postfix)).text();
                 } else {
-                    result = prefix + $.PrivateBin.Helper.htmlEntities(filename) + postfix;
+                    result = DOMPurify.sanitize(
+                        prefix + $.PrivateBin.Helper.htmlEntities(filename) + postfix, {
+                            ALLOWED_TAGS: ['a', 'i', 'span'],
+                            ALLOWED_ATTR: ['href', 'id']
+                        }
+                    );
                 }
                 if (filename.length) {
                     results.push(