# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
require 'test_helper'
class HtmlSanitizerTest < ActiveSupport::TestCase
setup do
@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)
end
teardown do
HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, @processing_timeout)
end
test 'xss' do
assert_equal(HtmlSanitizer.strict('123'), '123')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict('123123'), '123123')
assert_equal(HtmlSanitizer.strict('123123abc'), '123123abc')
assert_equal(HtmlSanitizer.strict('123'), '123')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict('">'), '">')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict(''), '')
assert_equal(HtmlSanitizer.strict('