Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-15631

HTML Cleaning Stripping <style> Tags

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • High
    • Resolution: Fixed
    • 13.4.24, 14.7.15, 15.3.0, 15.4.0
    • 15.5.0, 16.0.0
    • None
    • 4
    • Flagged
    • Orion
    • Orion Cycle Gap, Orion.Cycle1.Sprint1
    • Undetermined

    Description

      Reproduction

      1. Create a new Document Type and add the Rich Text Editor field group
      2. Set the htmlprocessor to `no-filter` and add { allowedContent: true } to the ckeditor.config.overlayed.json (documentation here).
      3. Create a new document using the newly created Document Type.
      4. Enter the below code snippet as the content
      5. Upon saving, the `<style>` tag gets stripped out

       

      <style>
      .heading { color: red }
      </style>
      <h1 class="heading">Heading</h1> 

      Cause
      Third party HTML cleaner was bumped to 2.29 per CMS-15420 in 13.4.24, 14.7.15, 15.3.0.

      See https://htmlcleaner.sourceforge.net/release.php

      April. 29, 2023{_}: HtmlCleaner release 2.28

      • 229 style-tag should not be allowed in body in HTML5

      Solution proposed by mmilicevic
       

      import org.htmlcleaner.*;
      public class BloomreachHtmlProvider extends Html5TagProvider {
      public static final BloomreachHtmlProvider INSTANCE = new BloomreachHtmlProvider();
      public BloomreachHtmlProvider()
      { final TagInfo tagInfo = new TagInfo("style", ContentType.text, BelongsTo.HEAD_AND_BODY, false, false, false, CloseTag.required, Display.none); this.put("style", tagInfo); }
      }
      // org.onehippo.cms7.services.htmlprocessor.HtmlProcessorImpl fork:
      parser = new HtmlCleaner(BloomreachHtmlProvider.INSTANCE, properties);
      

       

      Attachments

        Activity

          People

            smudgal Shikha Mudgal
            skuzey Sami Kuzey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: