Class AttributeSanitizerExtension

java.lang.Object
org.apache.wiki.markdown.extensions.attributesanitizer.AttributeSanitizerExtension
All Implemented Interfaces:
com.vladsch.flexmark.html.HtmlRenderer.HtmlRendererExtension, com.vladsch.flexmark.util.misc.Extension

public class AttributeSanitizerExtension extends Object implements com.vladsch.flexmark.html.HtmlRenderer.HtmlRendererExtension
HtmlRenderer.HtmlRendererExtension which strips dangerous author-supplied attributes from the rendered HTML. Flexmark's AttributesExtension applies attribute lists such as {onclick=...} written by page authors to the rendered elements without any filtering, so without this extension any author could attach on* event handlers (stored XSS), style overlays or javascript: URLs to rendered content. HtmlRenderer.ESCAPE_HTML does not cover extension-assigned attributes.

This extension must be registered after AttributesExtension, so its attribute provider runs last and sees the final attribute set of each node.

  • Constructor Details

  • Method Details

    • create

    • rendererOptions

      public void rendererOptions(com.vladsch.flexmark.util.data.MutableDataHolder options)
      Specified by:
      rendererOptions in interface com.vladsch.flexmark.html.HtmlRenderer.HtmlRendererExtension
    • extend

      public void extend(com.vladsch.flexmark.html.HtmlRenderer.Builder rendererBuilder, String rendererType)
      Specified by:
      extend in interface com.vladsch.flexmark.html.HtmlRenderer.HtmlRendererExtension