diff --git a/changelog/unreleased/bugfix-escape-html-characters-in-activities-and-notification-view b/changelog/unreleased/bugfix-escape-html-characters-in-activities-and-notification-view
new file mode 100644
index 00000000000..ae25acd381d
--- /dev/null
+++ b/changelog/unreleased/bugfix-escape-html-characters-in-activities-and-notification-view
@@ -0,0 +1,7 @@
+Bugfix: Escape HTML characters in activities and notification view
+
+We've fixed a bug where HTML characters were not escaped in the activities and notification view.
+This could lead to potential XSS attacks.
+
+https://github.com/owncloud/web/pull/11706
+https://github.com/owncloud/web/issues/11705
diff --git a/packages/web-app-files/src/components/SideBar/ActivitiesPanel.vue b/packages/web-app-files/src/components/SideBar/ActivitiesPanel.vue
index 1d58f00f027..ba180c406cb 100644
--- a/packages/web-app-files/src/components/SideBar/ActivitiesPanel.vue
+++ b/packages/web-app-files/src/components/SideBar/ActivitiesPanel.vue
@@ -42,6 +42,7 @@ import { useTask } from 'vue-concurrency'
import { call, Resource } from '@ownclouders/web-client'
import { DateTime } from 'luxon'
import { Activity } from '@ownclouders/web-client/graph/generated'
+import escape from 'lodash-es/escape'
const visibilityObserver = new VisibilityObserver()
export default defineComponent({
@@ -82,7 +83,9 @@ export default defineComponent({
const getHtmlFromActivity = (activity: Activity) => {
let message = activity.template.message
for (const [key, value] of Object.entries(activity.template.variables)) {
- message = message.replace(`{${key}}`, `${value.displayName || value.name}`)
+ const escapedValue = escape(value.displayName || value.name)
+
+ message = message.replace(`{${key}}`, `${escapedValue}`)
}
return message
}
diff --git a/packages/web-runtime/src/components/Topbar/Notifications.vue b/packages/web-runtime/src/components/Topbar/Notifications.vue
index b13d7357123..7b61b29320e 100644
--- a/packages/web-runtime/src/components/Topbar/Notifications.vue
+++ b/packages/web-runtime/src/components/Topbar/Notifications.vue
@@ -75,6 +75,7 @@