Commit 1427ba0c authored by Robert Speicher's avatar Robert Speicher

Merge branch 'sh-ignore-out-of-range-epics' into 'master'

[master] Ignore out of range epic IDs

See merge request gitlab/gitlab-ee!825
parents 1b06baea bb35021c
...@@ -107,6 +107,10 @@ module EE ...@@ -107,6 +107,10 @@ module EE
end end
end end
def reference_valid?(reference)
reference.to_i > 0 && reference.to_i <= ::Gitlab::Database::MAX_INT_VALUE
end
def link_reference_pattern def link_reference_pattern
%r{ %r{
(?<url> (?<url>
......
...@@ -69,6 +69,12 @@ describe Banzai::Filter::EpicReferenceFilter do ...@@ -69,6 +69,12 @@ describe Banzai::Filter::EpicReferenceFilter do
expect(doc(text).to_s).to eq(ERB::Util.html_escape_once(text)) expect(doc(text).to_s).to eq(ERB::Util.html_escape_once(text))
end end
it 'ignores out of range epic IDs' do
text = "Check &1161452270761535925900804973910297"
expect(doc(text).to_s).to eq(ERB::Util.html_escape_once(text))
end
it 'does not process links containing epic numbers followed by text' do it 'does not process links containing epic numbers followed by text' do
href = "#{reference}st" href = "#{reference}st"
link = doc("<a href='#{href}'></a>").css('a').first.attr('href') link = doc("<a href='#{href}'></a>").css('a').first.attr('href')
......
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