Commit 4f23bb9c authored by Kushal Pandya's avatar Kushal Pandya

Escape issue title while template rendering to prevent XSS

parent 64fabd5d
...@@ -201,7 +201,7 @@ class GfmAutoComplete { ...@@ -201,7 +201,7 @@ class GfmAutoComplete {
displayTpl(value) { displayTpl(value) {
let tmpl = GfmAutoComplete.Loading.template; let tmpl = GfmAutoComplete.Loading.template;
if (value.title != null) { if (value.title != null) {
tmpl = GfmAutoComplete.Issues.template; tmpl = GfmAutoComplete.Issues.templateFunction(value.id, value.title);
} }
return tmpl; return tmpl;
}, },
...@@ -267,7 +267,7 @@ class GfmAutoComplete { ...@@ -267,7 +267,7 @@ class GfmAutoComplete {
displayTpl(value) { displayTpl(value) {
let tmpl = GfmAutoComplete.Loading.template; let tmpl = GfmAutoComplete.Loading.template;
if (value.title != null) { if (value.title != null) {
tmpl = GfmAutoComplete.Issues.template; tmpl = GfmAutoComplete.Issues.templateFunction(value.id, value.title);
} }
return tmpl; return tmpl;
}, },
...@@ -370,7 +370,7 @@ class GfmAutoComplete { ...@@ -370,7 +370,7 @@ class GfmAutoComplete {
displayTpl(value) { displayTpl(value) {
let tmpl = GfmAutoComplete.Loading.template; let tmpl = GfmAutoComplete.Loading.template;
if (value.title != null) { if (value.title != null) {
tmpl = GfmAutoComplete.Issues.template; tmpl = GfmAutoComplete.Issues.templateFunction(value.id, value.title);
} }
return tmpl; return tmpl;
}, },
...@@ -557,8 +557,9 @@ GfmAutoComplete.Labels = { ...@@ -557,8 +557,9 @@ GfmAutoComplete.Labels = {
}; };
// Issues, MergeRequests and Snippets // Issues, MergeRequests and Snippets
GfmAutoComplete.Issues = { GfmAutoComplete.Issues = {
// eslint-disable-next-line no-template-curly-in-string templateFunction(id, title) {
template: '<li><small>${id}</small> ${title}</li>', return `<li><small>${id}</small> ${_.escape(title)}</li>`;
},
}; };
// Milestones // Milestones
GfmAutoComplete.Milestones = { GfmAutoComplete.Milestones = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment