Escape issue title while template rendering to prevent XSS
This commit is contained in:
parent
64fabd5dc1
commit
4f23bb9caa
1 changed files with 6 additions and 5 deletions
|
@ -201,7 +201,7 @@ class GfmAutoComplete {
|
|||
displayTpl(value) {
|
||||
let tmpl = GfmAutoComplete.Loading.template;
|
||||
if (value.title != null) {
|
||||
tmpl = GfmAutoComplete.Issues.template;
|
||||
tmpl = GfmAutoComplete.Issues.templateFunction(value.id, value.title);
|
||||
}
|
||||
return tmpl;
|
||||
},
|
||||
|
@ -267,7 +267,7 @@ class GfmAutoComplete {
|
|||
displayTpl(value) {
|
||||
let tmpl = GfmAutoComplete.Loading.template;
|
||||
if (value.title != null) {
|
||||
tmpl = GfmAutoComplete.Issues.template;
|
||||
tmpl = GfmAutoComplete.Issues.templateFunction(value.id, value.title);
|
||||
}
|
||||
return tmpl;
|
||||
},
|
||||
|
@ -370,7 +370,7 @@ class GfmAutoComplete {
|
|||
displayTpl(value) {
|
||||
let tmpl = GfmAutoComplete.Loading.template;
|
||||
if (value.title != null) {
|
||||
tmpl = GfmAutoComplete.Issues.template;
|
||||
tmpl = GfmAutoComplete.Issues.templateFunction(value.id, value.title);
|
||||
}
|
||||
return tmpl;
|
||||
},
|
||||
|
@ -557,8 +557,9 @@ GfmAutoComplete.Labels = {
|
|||
};
|
||||
// Issues, MergeRequests and Snippets
|
||||
GfmAutoComplete.Issues = {
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
template: '<li><small>${id}</small> ${title}</li>',
|
||||
templateFunction(id, title) {
|
||||
return `<li><small>${id}</small> ${_.escape(title)}</li>`;
|
||||
},
|
||||
};
|
||||
// Milestones
|
||||
GfmAutoComplete.Milestones = {
|
||||
|
|
Loading…
Reference in a new issue