diff options
author | Kushal Pandya <kushal@gitlab.com> | 2018-10-19 13:47:56 +0530 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2018-10-19 15:18:11 +0530 |
commit | 4f23bb9caaf626dffad1ebaf875b75921dbc7307 (patch) | |
tree | b77a46be8e35793cda38af61cba42861bc2c3844 | |
parent | 64fabd5dc132b7988d83bddb6f17a16223e76508 (diff) | |
download | gitlab-ce-4f23bb9caaf626dffad1ebaf875b75921dbc7307.tar.gz |
Escape issue title while template rendering to prevent XSS
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index 95636a9ccdd..7dd0efd622d 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -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 = { |