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

malicious_regexp_shared_examples.rb « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a86050e2cf252fe8e68188a48ec9d9675912128c (plain)
1
2
3
4
5
6
7
8
9
10
11
require 'timeout'

shared_examples 'malicious regexp' do
  let(:malicious_text) { 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!' }
  let(:malicious_regexp_re2) { '(?i)^(([a-z])+.)+[A-Z]([a-z])+$' }
  let(:malicious_regexp_ruby) { '/^(([a-z])+.)+[A-Z]([a-z])+$/i' }

  it 'takes under a second' do
    expect { Timeout.timeout(1) { subject } }.not_to raise_error
  end
end