Fixes: #4053 - Zammad email display broken.

(cherry picked from commit 584e3ec188d97169593aa0939b063c45b71ad863)
This commit is contained in:
Martin Gruner 2022-05-10 13:54:28 +02:00
parent 61f42f950f
commit 8042a609cd
2 changed files with 20 additions and 0 deletions

View file

@ -132,17 +132,22 @@ Rails.application.config.html_sanitizer_css_values_blocklist = {
'table' => [ 'table' => [
'font-size:0', 'font-size:0',
'font-size:0px', 'font-size:0px',
'font-size:0pt',
'font-size:0em', 'font-size:0em',
'font-size:0%', 'font-size:0%',
'font-size:1',
'font-size:1px', 'font-size:1px',
'font-size:1pt',
'font-size:1em', 'font-size:1em',
'font-size:1%', 'font-size:1%',
'font-size:2', 'font-size:2',
'font-size:2px', 'font-size:2px',
'font-size:2pt',
'font-size:2em', 'font-size:2em',
'font-size:2%', 'font-size:2%',
'font-size:3', 'font-size:3',
'font-size:3px', 'font-size:3px',
'font-size:3pt',
'font-size:3em', 'font-size:3em',
'font-size:3%', 'font-size:3%',
'display:none', 'display:none',
@ -151,17 +156,22 @@ Rails.application.config.html_sanitizer_css_values_blocklist = {
'th' => [ 'th' => [
'font-size:0', 'font-size:0',
'font-size:0px', 'font-size:0px',
'font-size:0pt',
'font-size:0em', 'font-size:0em',
'font-size:0%', 'font-size:0%',
'font-size:1',
'font-size:1px', 'font-size:1px',
'font-size:1pt',
'font-size:1em', 'font-size:1em',
'font-size:1%', 'font-size:1%',
'font-size:2', 'font-size:2',
'font-size:2px', 'font-size:2px',
'font-size:2pt',
'font-size:2em', 'font-size:2em',
'font-size:2%', 'font-size:2%',
'font-size:3', 'font-size:3',
'font-size:3px', 'font-size:3px',
'font-size:3pt',
'font-size:3em', 'font-size:3em',
'font-size:3%', 'font-size:3%',
'display:none', 'display:none',
@ -170,18 +180,22 @@ Rails.application.config.html_sanitizer_css_values_blocklist = {
'tr' => [ 'tr' => [
'font-size:0', 'font-size:0',
'font-size:0px', 'font-size:0px',
'font-size:0pt',
'font-size:0em', 'font-size:0em',
'font-size:0%', 'font-size:0%',
'font-size:1', 'font-size:1',
'font-size:1px', 'font-size:1px',
'font-size:1pt',
'font-size:1em', 'font-size:1em',
'font-size:1%', 'font-size:1%',
'font-size:2', 'font-size:2',
'font-size:2px', 'font-size:2px',
'font-size:2pt',
'font-size:2em', 'font-size:2em',
'font-size:2%', 'font-size:2%',
'font-size:3', 'font-size:3',
'font-size:3px', 'font-size:3px',
'font-size:3pt',
'font-size:3em', 'font-size:3em',
'font-size:3%', 'font-size:3%',
'display:none', 'display:none',
@ -190,17 +204,22 @@ Rails.application.config.html_sanitizer_css_values_blocklist = {
'td' => [ 'td' => [
'font-size:0', 'font-size:0',
'font-size:0px', 'font-size:0px',
'font-size:0pt',
'font-size:0em', 'font-size:0em',
'font-size:0%', 'font-size:0%',
'font-size:1',
'font-size:1px', 'font-size:1px',
'font-size:1pt',
'font-size:1em', 'font-size:1em',
'font-size:1%', 'font-size:1%',
'font-size:2', 'font-size:2',
'font-size:2px', 'font-size:2px',
'font-size:2pt',
'font-size:2em', 'font-size:2em',
'font-size:2%', 'font-size:2%',
'font-size:3', 'font-size:3',
'font-size:3px', 'font-size:3px',
'font-size:3pt',
'font-size:3em', 'font-size:3em',
'font-size:3%', 'font-size:3%',
'display:none', 'display:none',

View file

@ -134,6 +134,7 @@ test 123
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2">abc</a>') <a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2">abc</a>')
assert_equal(HtmlSanitizer.strict('<table><tr style="font-size: 0"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>') assert_equal(HtmlSanitizer.strict('<table><tr style="font-size: 0"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>')
assert_equal(HtmlSanitizer.strict('<table><tr style="font-size: 0px"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>') assert_equal(HtmlSanitizer.strict('<table><tr style="font-size: 0px"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>')
assert_equal(HtmlSanitizer.strict('<table><tr style="font-size: 0pt"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>')
assert_equal(HtmlSanitizer.strict('<table><tr style="font-size:0"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>') assert_equal(HtmlSanitizer.strict('<table><tr style="font-size:0"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>')
assert_equal(HtmlSanitizer.strict('<table><tr style="font-Size:0px"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>') assert_equal(HtmlSanitizer.strict('<table><tr style="font-Size:0px"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>')
assert_equal(HtmlSanitizer.strict('<table><tr style="font-size:0em"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>') assert_equal(HtmlSanitizer.strict('<table><tr style="font-size:0em"><td>123</td></tr></table>'), '<table><tr><td>123</td></tr></table>')