Interface HtmlSanitizer

  • All Known Implementing Classes:
    DefaultHtmlSanitizer

    public interface HtmlSanitizer
    In data sanitization, HTML sanitization is the process of examining an HTML document and producing a new HTML document that preserves only whatever tags are designated "safe" and desired. HTML sanitization can be used to protect against attacks such as cross-site scripting (XSS) by sanitizing any HTML code submitted by a user.
    Author:
    silveryocha
    • Method Detail

      • sanitize

        String sanitize​(String html)
        Sanitizing the given content by keeping:
        • safe formatting
        • safe blocks
        • safe images
        • safe links
        • safe tables
        • safe styles

        All links are modified in order to be opened safely into a new blank page.

        Parameters:
        html - a string representing an HTML content.
        Returns:
        a string representing the sanitized version of given parameter.