diff --git a/lib/rails/html/scrubbers.rb b/lib/rails/html/scrubbers.rb index 6182abb..7dde73a 100644 --- a/lib/rails/html/scrubbers.rb +++ b/lib/rails/html/scrubbers.rb @@ -134,6 +134,12 @@ def validate!(var, name) if var && !var.is_a?(Enumerable) raise ArgumentError, "You should pass :#{name} as an Enumerable" end + + if var && name == :tags && var.include?("noscript") + warn("WARNING: 'noscript' tags cannot be allowed by the PermitScrubber and will be scrubbed") + var.delete("noscript") + end + var end diff --git a/test/sanitizer_test.rb b/test/sanitizer_test.rb index 8cfb523..05c4130 100644 --- a/test/sanitizer_test.rb +++ b/test/sanitizer_test.rb @@ -1026,6 +1026,24 @@ def test_should_sanitize_across_newlines assert_equal "", sanitize_css(raw) end + def test_should_prune_noscript + # https://hackerone.com/reports/2509647 + input, tags = "