Widget:ChatBox: Unterschied zwischen den Versionen
Aus MediaWiki
KKeine Bearbeitungszusammenfassung |
Sicherheitskorrektur bei Widget-Wiederherstellung: URL- und HTML-Kontexte |
||
| Zeile 239: | Zeile 239: | ||
var d = document.createElement('div'); | var d = document.createElement('div'); | ||
d.textContent = str; | d.textContent = str; | ||
return d.innerHTML; | return d.innerHTML.replace(/"/g, """).replace(/'/g, "'"); | ||
} | } | ||
| Zeile 315: | Zeile 315: | ||
var pct = Math.round((s.score || 0) * 100); | var pct = Math.round((s.score || 0) * 100); | ||
var url = s.url || ''; | var url = s.url || ''; | ||
try { | |||
var parsedSourceUrl = new URL(url, location.origin); | |||
if (parsedSourceUrl.protocol !== 'https:' && parsedSourceUrl.protocol !== 'http:') url = '#'; | |||
} catch (invalidSourceUrl) { url = '#'; } | |||
var title = ''; | var title = ''; | ||
if (url) { | if (url) { | ||