summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2019-10-26 14:06:59 +0800
committerHeinrich Lee Yu <heinrich@gitlab.com>2019-11-25 13:34:41 +0800
commitad48a55cc22864e97f5a616a3aafc953e8c43ff2 (patch)
treefb792bba5ba5fcda3dcceffd6c3066bbe97089f5 /lib
parent4c442bdda212490c660a4c0acd82d03f60d72dc9 (diff)
downloadgitlab-ce-ad48a55cc22864e97f5a616a3aafc953e8c43ff2.tar.gz
Escape namespace in label references
When referencing cross-namespace labels, we append the namespace name to the rendered label. This MR escapes the name to prevent XSS attacks.
Diffstat (limited to 'lib')
-rw-r--r--lib/banzai/filter/label_reference_filter.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/banzai/filter/label_reference_filter.rb b/lib/banzai/filter/label_reference_filter.rb
index db620c65237..609ea8fb5ca 100644
--- a/lib/banzai/filter/label_reference_filter.rb
+++ b/lib/banzai/filter/label_reference_filter.rb
@@ -89,7 +89,7 @@ module Banzai
parent_from_ref = from_ref_cached(project_path)
reference = parent_from_ref.to_human_reference(parent)
- label_suffix = " <i>in #{reference}</i>" if reference.present?
+ label_suffix = " <i>in #{ERB::Util.html_escape(reference)}</i>" if reference.present?
end
presenter = object.present(issuable_subject: parent)