diff --git a/frontend/package.json b/frontend/package.json index 98cd51a3..61ebcf81 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -30,6 +30,7 @@ "chart.js": "^4.4.1", "codemirror": "^6.0.1", "dayjs": "^1.11.6", + "dompurify": "^3.2.6", "feather-icons": "^4.28.0", "frappe-ui": "0.1.173", "highlight.js": "^11.11.1", diff --git a/frontend/src/components/Modals/EditProfile.vue b/frontend/src/components/Modals/EditProfile.vue index d335b39f..144878ae 100644 --- a/frontend/src/components/Modals/EditProfile.vue +++ b/frontend/src/components/Modals/EditProfile.vue @@ -97,7 +97,8 @@ import { } from 'frappe-ui' import { reactive, watch } from 'vue' import { FileText, X } from 'lucide-vue-next' -import { getFileSize } from '@/utils' +import { getFileSize, decodeEntities } from '@/utils' +import DOMPurify from 'dompurify' const reloadProfile = defineModel('reloadProfile') @@ -147,6 +148,22 @@ const updateProfile = createResource({ }) const saveProfile = (close) => { + profile.bio = DOMPurify.sanitize(decodeEntities(profile.bio), { + ALLOWED_TAGS: [ + 'b', + 'i', + 'em', + 'strong', + 'a', + 'p', + 'br', + 'ul', + 'ol', + 'li', + 'img', + ], + ALLOWED_ATTR: ['href', 'target', 'src'], + }) updateProfile.submit( {}, { diff --git a/frontend/src/pages/ProfileAbout.vue b/frontend/src/pages/ProfileAbout.vue index 6ef662dc..47477d38 100644 --- a/frontend/src/pages/ProfileAbout.vue +++ b/frontend/src/pages/ProfileAbout.vue @@ -5,7 +5,24 @@