Project

General

Profile

Feature #42444 ยป 42444.patch

Go MAEDA, 2026-03-21 02:46

View differences:

lib/redmine/wiki_formatting/common_mark/sanitization_filter.rb
121 121
                margin margin-left margin-right margin-top margin-bottom
122 122
                border border-left border-right border-top border-bottom border-radius border-style border-collapse border-spacing
123 123
                font font-style font-variant font-weight font-stretch font-size line-height font-family
124
                text-align
124
                text-align text-decoration
125 125
                float
126 126
              ].freeze
127 127
            }
lib/redmine/wiki_formatting/textile/redcloth3.rb
511 511
        atts
512 512
    end
513 513

  
514
    STYLES_RE = /^(color|(min-|max-)?+(width|height)|border|background|padding|margin|font|text|float)(-[a-z]+)*:\s*((\d+%?|\d+px|\d+(\.\d+)?em|#[0-9a-f]+|[a-z]+)\s*)+$/i
514
    STYLES_RE = /^(color|(min-|max-)?+(width|height)|border|background|padding|margin|font|text|float)(-[a-z]+)*:\s*((\d+%?|\d+px|\d+(\.\d+)?em|#[0-9a-f]+|[a-z]+(?:-[a-z]+)*)\s*)+$/i
515 515

  
516 516
    def sanitize_styles(str)
517 517
      styles = str.split(";").map(&:strip)
test/unit/lib/redmine/wiki_formatting/common_mark/sanitization_filter_test.rb
131 131
      ],
132 132
      [
133 133
        '<b>Lo<!-- comment -->rem</b> <a href="pants" title="foo" style="text-decoration: underline;">ipsum</a> <a href="http://example.com/"><strong>dolor</strong></a> sit<br/>amet <style>.foo { color: #fff; }</style> <script>alert("hello world");</script>',
134
        '<b>Lorem</b> <a href="pants" title="foo">ipsum</a> <a href="http://example.com/"><strong>dolor</strong></a> sit<br>amet .foo { color: #fff; } '
134
        '<b>Lorem</b> <a href="pants" title="foo" style="text-decoration: underline;">ipsum</a> <a href="http://example.com/"><strong>dolor</strong></a> sit<br>amet .foo { color: #fff; } '
135 135
      ],
136 136
      [
137 137
        'Lo<!-- comment -->rem</b> <a href=pants title="foo>ipsum <a href="http://example.com/"><strong>dolor</a></strong> sit<br/>amet <script>alert("hello world");',
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
86 86
        'p{max-width:100px}. text'     => '<p style="max-width:100px;">text</p>',
87 87
        'p{height:40px}. text'         => '<p style="height:40px;">text</p>',
88 88
        'p{max-height:80px}. text'     => '<p style="max-height:80px;">text</p>',
89
        'p{text-decoration: line-through}. text'     => '<p style="text-decoration: line-through;">text</p>',
89 90
      },
90 91
      false
91 92
    )
    (1-1/1)