Fixed security issue where custom form description tags were able to include script tags

This commit is contained in:
witzig 2017-03-19 15:53:41 +01:00
parent b09af60fac
commit adf4be7836

View file

@ -102,6 +102,9 @@ module.exports.create = (listId, form, callback) => {
Object.keys(form).forEach(key => {
let value = form[key].trim();
key = tools.toDbKey(key);
if (key === 'description') {
value = tools.purifyHTML(value);
}
if (allowedKeys.indexOf(key) >= 0) {
keys.push(key);
values.push(value);
@ -146,6 +149,9 @@ module.exports.update = (id, updates, callback) => {
Object.keys(updates).forEach(key => {
let value = typeof updates[key] === 'string' ? updates[key].trim() : updates[key];
key = tools.toDbKey(key);
if (key === 'description') {
value = tools.purifyHTML(value);
}
if (allowedKeys.indexOf(key) >= 0) {
keys.push(key);
values.push(value);