select2: always escape .text attributes to prevent XSS via

vcs references.
This commit is contained in:
Marcin Lulek 2017-10-18 11:21:18 +02:00
parent ce2de33a5a
commit 897e95f252
2 changed files with 2 additions and 4 deletions

View file

@ -223,7 +223,7 @@ var formatSelect2SelectionRefs = function(commit_ref){
} else if (commit_ref.type === 'book'){
tmpl = tmpl.concat('<i class="icon-bookmark"></i> ');
}
return tmpl.concat(commit_ref.text);
return tmpl.concat(escapeHtml(commit_ref.text));
};
// takes a given html element and scrolls it down offset pixels

View file

@ -35,7 +35,6 @@ var select2RefBaseSwitcher = function(targetElement, loadUrl, initialData){
$(targetElement).select2({
cachedDataSource: {},
dropdownAutoWidth: true,
formatResult: formatResult,
width: "resolve",
containerCssClass: "drop-menu",
dropdownCssClass: "drop-menu-dropdown",
@ -59,11 +58,10 @@ var select2RefBaseSwitcher = function(targetElement, loadUrl, initialData){
});
}
},
initSelection: function(element, callback) {
callback(initialData);
},
formatResult: formatResult,
formatSelection: formatSelection
});