From f1fcaedbd23bfd3afd5d1db200b72dbda1992e3c Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 23 Feb 2017 20:33:44 -0500 Subject: Avoid potential XSS in Gantt chart --- assets/js/src/Gantt.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'assets/js/src') diff --git a/assets/js/src/Gantt.js b/assets/js/src/Gantt.js index 96479d36..cd6cac00 100644 --- a/assets/js/src/Gantt.js +++ b/assets/js/src/Gantt.js @@ -77,7 +77,7 @@ Kanboard.Gantt.prototype.renderVerticalHeader = function() { .append(" "); if (this.data[i].type == "task") { - content.append(jQuery("", {"href": this.data[i].link, "title": this.data[i].title}).append(this.data[i].title)); + content.append(jQuery("", {"href": this.data[i].link, "title": this.data[i].title}).text(this.data[i].title)); } else { content @@ -85,7 +85,7 @@ Kanboard.Gantt.prototype.renderVerticalHeader = function() { .append(" ") .append(jQuery("", {"href": this.data[i].gantt_link, "title": $(this.options.container).data("label-gantt-link")}).append('')) .append(" ") - .append(jQuery("", {"href": this.data[i].link}).append(this.data[i].title)); + .append(jQuery("", {"href": this.data[i].link}).text(this.data[i].title)); } seriesDiv.append(jQuery("
", {"class": "ganttview-vtheader-series-name"}).append(content)); @@ -215,7 +215,11 @@ Kanboard.Gantt.prototype.getVerticalHeaderTooltip = function(record) { var tooltip = ""; if (record.type == "task") { - tooltip = "" + record.column_title + " (" + record.progress + ")
" + record.title; + tooltip = jQuery("") + .append(jQuery("").text(record.column_title)) + .append(document.createTextNode(' (' + record.progress + ')')) + .append(jQuery("
")) + .append(document.createTextNode(record.title)).prop('outerHTML'); } else { var types = ["project-manager", "project-member"]; @@ -227,11 +231,11 @@ Kanboard.Gantt.prototype.getVerticalHeaderTooltip = function(record) { for (var user_id in record.users[type]) { if (user_id) { - list.append(jQuery("
  • ").append(record.users[type][user_id])); + list.append(jQuery("
  • ").text(record.users[type][user_id])); } } - tooltip += "

    " + $(this.options.container).data("label-" + type) + "

    " + list[0].outerHTML; + tooltip += "

    " + $(this.options.container).data("label-" + type) + "

    " + list.prop('outerHTML'); } } } @@ -248,8 +252,11 @@ Kanboard.Gantt.prototype.getBarTooltip = function(record) { } else { if (record.type == "task") { - tooltip = "" + record.progress + "
    " + - $(this.options.container).data("label-assignee") + " " + (record.assignee ? record.assignee : '') + "
    "; + var assigneeLabel = $(this.options.container).data("label-assignee"); + tooltip += jQuery("").text(record.progress).prop('outerHTML'); + tooltip += "
    "; + tooltip += jQuery('').append(document.createTextNode(assigneeLabel + " " + (record.assignee ? record.assignee : ''))).prop('outerHTML'); + tooltip += "
    "; } tooltip += $(this.options.container).data("label-start-date") + " " + $.datepicker.formatDate('yy-mm-dd', record.start) + "
    "; -- cgit v1.2.3