Remove button from allowed tags (#14434)

This commit is contained in:
Mac Siri 2021-08-11 10:48:07 -04:00 committed by GitHub
parent e749626e71
commit 443e852091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -4,7 +4,7 @@ class RenderedMarkdownScrubber < Rails::Html::PermitScrubber
super
self.tags = %w[
a abbr add b blockquote br button center cite code col colgroup dd del dl dt em figcaption
a abbr add b blockquote br center cite code col colgroup dd del dl dt em figcaption
h1 h2 h3 h4 h5 h6 hr img kbd li mark ol p pre q rp rt ruby small source span strong sub sup table
tbody td tfoot th thead time tr u ul video
]

View file

@ -22,6 +22,11 @@ RSpec.describe MarkdownProcessor::Parser, type: :service do
expect(generate_and_parse_markdown(code_block)).to include("{% raw %}", "{% endraw %}")
end
it "does not allow button tag" do
button = "<button>no</button>"
expect(generate_and_parse_markdown(button)).not_to include("button")
end
it "does not render the escaped dashes when using a `raw` Liquid tag in codeblocks with syntax highlighting" do
code_block = "```js\n{% raw %}some text{% endraw %}\n```"
expect(generate_and_parse_markdown(code_block)).not_to include("----")