Skip to content

Commit 5a5c5c3

Browse files
authored
Merge pull request #142 from eventfuel/added_list_type_style_to_css_props
Added list-style-type as a safe CSS property to whitelist
2 parents 6b81467 + df373e2 commit 5a5c5c3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/loofah/html5/whitelist.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ module WhiteList
125125
border-bottom-color border-collapse border-color border-left-color
126126
border-right-color border-top-color clear color cursor direction
127127
display elevation float font font-family font-size font-style
128-
font-variant font-weight height letter-spacing line-height overflow
129-
pause pause-after pause-before pitch pitch-range richness speak
128+
font-variant font-weight height letter-spacing line-height list-style-type
129+
overflow pause pause-after pause-before pitch pitch-range richness speak
130130
speak-header speak-numeral speak-punctuation speech-rate stress
131131
text-align text-decoration text-indent unicode-bidi vertical-align
132132
voice-family volume white-space width]

test/html5/test_sanitizer.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def test_should_allow_multi_word_data_attributes
136136
check_sanitization(input, output, output, output)
137137
end
138138
end
139-
139+
140140
HTML5::WhiteList::ALLOWED_URI_DATA_MEDIATYPES.each do |data_uri_type|
141141
define_method "test_should_allow_data_#{data_uri_type}_uris" do
142142
input = %(<a href="data:#{data_uri_type}">foo</a>)
@@ -291,6 +291,12 @@ def test_css_function_sanitization_leaves_whitelisted_functions_rgb
291291
assert_match %r/rgb\(255, 0, 0\)/, sane.inner_html
292292
end
293293

294+
def test_css_function_sanitization_leaves_whitelisted_list_style_type
295+
html = "<ol style='list-style-type:lower-greek;'></ol>"
296+
sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :strip).to_html)
297+
assert_match %r/list-style-type:lower-greek/, sane.inner_html
298+
end
299+
294300
def test_css_function_sanitization_strips_style_attributes_with_unsafe_functions
295301
html = "<span style=\"width:attr(data-evil-attr)\">"
296302
sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :strip).to_html)

0 commit comments

Comments
 (0)