Explorar o código

Sanitize output from Helper.urls2links

Haocen Xu %!s(int64=6) %!d(string=hai) anos
pai
achega
5f0011b0f6
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      js/privatebin.js

+ 5 - 3
js/privatebin.js

@@ -405,9 +405,11 @@ jQuery.PrivateBin = (function($, RawDeflate) {
         me.urls2links = function(element)
         me.urls2links = function(element)
         {
         {
             element.html(
             element.html(
-                element.html().replace(
-                    /(((https?|ftp):\/\/[\w?!=&.\/-;#@~%+*-]+(?![\w\s?!&.\/;#~%"=-]>))|((magnet):[\w?=&.\/-;#@~%+*-]+))/ig,
-                    '<a href="$1" rel="nofollow">$1</a>'
+                DOMPurify.sanitize(
+                    element.html().replace(
+                        /(((https?|ftp):\/\/[\w?!=&.\/-;#@~%+*-]+(?![\w\s?!&.\/;#~%"=-]>))|((magnet):[\w?=&.\/-;#@~%+*-]+))/ig,
+                        '<a href="$1" rel="nofollow">$1</a>'
+                    )
                 )
                 )
             );
             );
         };
         };