diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-10-24 12:01:48 +0300 |
---|---|---|
committer | Thiago Presa <tpresa@gitlab.com> | 2018-10-25 03:42:26 +0300 |
commit | 0fe2f07a0a0190221793cb8c9b0306a8fc050d6a (patch) | |
tree | 8e2bc6495a204a812291789446d58d7396725ae1 /app | |
parent | b84c2e9002e53732bd79c37de957f264598e364d (diff) |
Merge branch 'security-11-3-2717-fix-issue-title-xss' into 'security-11-3'
[11.3] Escape issue title while template rendering to prevent XSS
See merge request gitlab/gitlabhq!2557
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index 73b2cd0b2c7..03256ca2285 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -199,7 +199,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; }, @@ -265,7 +265,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; }, @@ -521,8 +521,9 @@ GfmAutoComplete.Labels = { }; // Issues and MergeRequests 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 = { |