diff --git a/spec/models/concerns/has_xss_sanitized_note_examples.rb b/spec/models/concerns/has_xss_sanitized_note_examples.rb index a88a19bd9..051f01e8b 100644 --- a/spec/models/concerns/has_xss_sanitized_note_examples.rb +++ b/spec/models/concerns/has_xss_sanitized_note_examples.rb @@ -5,6 +5,11 @@ RSpec.shared_examples 'HasXssSanitizedNote' do |model_factory:| context 'with injected JS' do subject { create(model_factory, note: 'test 123 some text') } + before do + # XSS processing may run into a timeout on slow CI systems, so turn the timeout off for the test. + stub_const("#{HtmlSanitizer}::PROCESSING_TIMEOUT", nil) + end + it 'strips out some other text diff --git a/test/unit/html_sanitizer_test.rb b/test/unit/html_sanitizer_test.rb index 8d6ff934b..1542cedbc 100644 --- a/test/unit/html_sanitizer_test.rb +++ b/test/unit/html_sanitizer_test.rb @@ -4,6 +4,11 @@ require 'test_helper' class HtmlSanitizerTest < ActiveSupport::TestCase + processing_timeout = HtmlSanitizer.const_get(:PROCESSING_TIMEOUT) + + # XSS processing may run into a timeout on slow CI systems, so turn the timeout off for the test. + HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, nil) + test 'xss' do assert_equal(HtmlSanitizer.strict('123'), '123') assert_equal(HtmlSanitizer.strict(''), '') @@ -153,4 +158,6 @@ test 123 assert_equal(HtmlSanitizer.strict('test'), 'test') end + + HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, processing_timeout) end