sanitize note title && attrs just to be sure

This commit is contained in:
zadam
2022-07-06 23:09:16 +02:00
parent 4fc686bbbc
commit 12b3302687
6 changed files with 24 additions and 2 deletions
+6
View File
@@ -18,6 +18,7 @@ const Branch = require('../becca/entities/branch');
const Note = require('../becca/entities/note');
const Attribute = require('../becca/entities/attribute');
const dayjs = require("dayjs");
const htmlSanitizer = require("./html_sanitizer.js");
function getNewNotePosition(parentNoteId) {
const note = becca.notes[parentNoteId];
@@ -98,6 +99,11 @@ function getNewNoteTitle(parentNote) {
}
}
// this isn't in theory a good place to sanitize title, but this will catch a lot of XSS attempts
// title is supposed to contain text only (not HTML) and be printed text only, but given the number of usages
// it's difficult to guarantee correct handling in all cases
title = htmlSanitizer.sanitize(title);
return title;
}