Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-08-26 10:43:03 +0300
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-08-26 10:43:03 +0300
commita9ff1532818814fd9645fa8c673b3018ea1f91c6 (patch)
treeb2c6030db514e94e281a1715ab9c5845a7f30825 /spec/lib/banzai/filter/project_reference_filter_spec.rb
parent71636fed6e048b41cc595871bea412d6e75c56ea (diff)
parentdcae7fab92a93f3750831b4e70e9b61d3c064b83 (diff)
Merge branch 'security-61974-limit-issue-comment-size-12-1' into '12-1-stable'
Limit the size of issuable description and comments See merge request gitlab/gitlabhq!3271
Diffstat (limited to 'spec/lib/banzai/filter/project_reference_filter_spec.rb')
-rw-r--r--spec/lib/banzai/filter/project_reference_filter_spec.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/lib/banzai/filter/project_reference_filter_spec.rb b/spec/lib/banzai/filter/project_reference_filter_spec.rb
index 69f9c1ae829..927d226c400 100644
--- a/spec/lib/banzai/filter/project_reference_filter_spec.rb
+++ b/spec/lib/banzai/filter/project_reference_filter_spec.rb
@@ -26,10 +26,18 @@ describe Banzai::Filter::ProjectReferenceFilter do
expect(reference_filter(act).to_html).to eq(CGI.escapeHTML(exp))
end
- it 'fails fast for long invalid string' do
- expect do
- Timeout.timeout(5.seconds) { reference_filter("A" * 50000).to_html }
- end.not_to raise_error
+ context 'when invalid reference strings are very long' do
+ shared_examples_for 'fails fast' do |ref_string|
+ it 'fails fast for long strings' do
+ # took well under 1 second in CI https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/3267#note_172824
+ expect do
+ Timeout.timeout(3.seconds) { reference_filter(ref_string).to_html }
+ end.not_to raise_error
+ end
+ end
+
+ it_behaves_like 'fails fast', 'A' * 50000
+ it_behaves_like 'fails fast', '/a' * 50000
end
it 'allows references with text after the > character' do