Kaynağa Gözat

Prevent possible xss

sbkwgh 6 yıl önce
ebeveyn
işleme
6dc486f082
1 değiştirilmiş dosya ile 2 ekleme ve 4 silme
  1. 2 4
      frontend/src/main.js

+ 2 - 4
frontend/src/main.js

@@ -157,10 +157,8 @@ Vue.filter('formatDate', function (value, format = '', join = ' ') {
 });
 
 Vue.filter('stripTags', function (value) {
-	let div = document.createElement('div')
-	div.innerHTML = value
-
-	return div.textContent
+	let doc = new DOMParser().parseFromString(value, 'text/html')
+	return doc.body.textContent || ''
 });
 
 Vue.filter('truncate', function (value, length) {