diff --git a/lib/models/user.js b/lib/models/user.js
index 383be1a72..d79530039 100644
--- a/lib/models/user.js
+++ b/lib/models/user.js
@@ -2,6 +2,7 @@
// external modules
const Sequelize = require('sequelize')
const scrypt = require('scrypt-kdf')
+const filterXSS = require('xss')
// core
const logger = require('../logger')
@@ -74,7 +75,7 @@ module.exports = function (sequelize, DataTypes) {
}
if (profile) {
profile = {
- name: profile.displayName || profile.username,
+ name: filterXSS(profile.displayName || profile.username),
photo: User.parsePhotoByProfile(profile),
biggerphoto: User.parsePhotoByProfile(profile, true)
}
@@ -135,7 +136,7 @@ module.exports = function (sequelize, DataTypes) {
photo = generateAvatarURL(profile.username)
break
}
- return photo
+ return filterXSS(photo)
}
User.parseProfileByEmail = function (email) {
return {
diff --git a/public/views/hedgedoc/head.ejs b/public/views/hedgedoc/head.ejs
index 446687953..419d5dcc7 100644
--- a/public/views/hedgedoc/head.ejs
+++ b/public/views/hedgedoc/head.ejs
@@ -7,7 +7,7 @@
<%- include('../includes/favicon') %>
<% for (var og in opengraph) { %>
<% if (opengraph.hasOwnProperty(og) && opengraph[og].trim() !== '') { %>
-
+
<% }} if (!opengraph.hasOwnProperty('image')) { %>