debian-mirror-gitlab/spec/support/shared_examples/malicious_regexp_shared_examples.rb

14 lines
437 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
require 'timeout'
2017-08-17 22:00:37 +05:30
shared_examples 'malicious regexp' do
2019-03-02 22:35:43 +05:30
let(:malicious_text) { 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!' }
2019-04-03 18:18:56 +05:30
let(:malicious_regexp_re2) { '(?i)^(([a-z])+.)+[A-Z]([a-z])+$' }
let(:malicious_regexp_ruby) { '/^(([a-z])+.)+[A-Z]([a-z])+$/i' }
2017-08-17 22:00:37 +05:30
it 'takes under a second' do
expect { Timeout.timeout(1) { subject } }.not_to raise_error
end
end