Package org.exoplatform.commons.utils
Class HTMLSanitizer
java.lang.Object
org.exoplatform.commons.utils.HTMLSanitizer
Prevent XSS/XEE attacks by encoding user HTML inputs. This class will be used
to encode data in in presentation layer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Function<org.owasp.html.HtmlStreamEventReceiver, org.owasp.html.HtmlSanitizer.Policy> A policy definition that matches the minimal HTML that eXo allows. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
POLICY_DEFINITION
public static final Function<org.owasp.html.HtmlStreamEventReceiver,org.owasp.html.HtmlSanitizer.Policy> POLICY_DEFINITIONA policy definition that matches the minimal HTML that eXo allows.
-
-
Constructor Details
-
HTMLSanitizer
public HTMLSanitizer()
-
-
Method Details
-
sanitize
This service reads HTML from input forms and writes sanitized content to a StringBuffer- Parameters:
html- TheStringobject- Returns:
- The sanitized HTML to store in DB layer
-