Pārlūkot izejas kodu

fix: Avoid tabnabbing

Reported by Manav.
master
Boris Grozev 8 gadus atpakaļ
vecāks
revīzija
b0eeb8a207
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 2
    2
      modules/UI/side_pannels/chat/Replacement.js

+ 2
- 2
modules/UI/side_pannels/chat/Replacement.js Parādīt failu

23
 
23
 
24
     //URLs starting with http://, https://, or ftp://
24
     //URLs starting with http://, https://, or ftp://
25
     replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
25
     replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
26
-    replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');
26
+    replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>');
27
 
27
 
28
     //URLs starting with "www." (without // before it, or it'd re-link the ones done above).
28
     //URLs starting with "www." (without // before it, or it'd re-link the ones done above).
29
     replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
29
     replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
30
-    replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');
30
+    replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank" rel="noopener noreferrer">$2</a>');
31
 
31
 
32
     //Change email addresses to mailto: links.
32
     //Change email addresses to mailto: links.
33
     replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim;
33
     replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim;

Notiek ielāde…
Atcelt
Saglabāt