diff --git a/lib/models/user.js b/lib/models/user.js
index ff154745..befd95ff 100644
--- a/lib/models/user.js
+++ b/lib/models/user.js
@@ -143,10 +143,11 @@ module.exports = function (sequelize, DataTypes) {
return filterXSS(photo)
}
User.parseProfileByEmail = function (email) {
+ const sanitizedEmail = email.replaceAll('"', '').replaceAll("'", '').replaceAll('<', '').replaceAll('>', '')
return {
- name: email.substring(0, email.lastIndexOf('@')),
- photo: generateAvatarURL('', email, false),
- biggerphoto: generateAvatarURL('', email, true)
+ name: sanitizedEmail.split('@')[0],
+ photo: generateAvatarURL('', sanitizedEmail, false),
+ biggerphoto: generateAvatarURL('', sanitizedEmail, true)
}
}
diff --git a/public/docs/release-notes.md b/public/docs/release-notes.md
index e49ac73f..5916b9f7 100644
--- a/public/docs/release-notes.md
+++ b/public/docs/release-notes.md
@@ -2,6 +2,13 @@
## 1.x UNRELEASED
+### Security fixes
+
+This release contains a ... security fix:
+- [GHSA-6c2w-8w96-3pcv](https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-6c2w-8w96-3pcv) reports a possible HTML injection via the localpart of an email address.
+
+Thanks to [Chandler Johnson](https://github.com/chndlrx) for reporting!
+
### Enhancements
- Added a warning page when clicking external links
diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs
index 97274ba1..5ee3645f 100644
--- a/public/views/pretty.ejs
+++ b/public/views/pretty.ejs
@@ -34,7 +34,7 @@
<% if(lastchangeuserprofile) { %>
-
+
<% } else { %>
<% } %>
@@ -45,7 +45,7 @@
<% if(ownerprofile && owner !== lastchangeuser) { %>
-
+
owned this note
<% } %>