How to configure validation directives in AntiSamy

Issue

  • When trying to import content between sites, i.e. knowledge base, a validation error arises:
An unexpected error occurred with the publication process. Please check your portal and publishing configuration.

com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.sanitizer.SanitizerException: org.owasp.validator.html.ScanException: The input was too large. The specified input was 215.183 bytes and the maximum is 200.000 bytes.

 

Environment

  • Liferay DXP 7.0

Resolution

  • AntiSamy validation directives are defined in the file
/META-INF/resources/sanitizer-configuration.xml
This file is packaged in DXP product's AntiSamy bundle:
com.liferay.portal.security.antisamy-x.y.x.jar
And that bundle is packaged in LPKG file:
osgi/marketplace/Liferay Foundation.lpkg
  • So, firstly, extract com.liferay.portal.security.antisamy-x.y.z.jar file from Liferay Foundation.lpkg. Note: LPKG format is Liferay packaging format.
  • Extract the content from com.liferay.portal.security.antisamy-x.y.z.jar, with the same directory structure.
  • Edit following file:
META-INF/resources/sanitizer-configuration.xml
  • Find directive
<directive name="maxInputSize" value="200000"/>
and edit with custom value. Save file.
  • Update bundle with previous edited file:
jar uf com.liferay.portal.security.antisamy-x.y.x.jar META-INF/resources/sanitizer-configuration.xml
  • Add (overwrite) com.liferay.portal.security.antisamy-x.y.z.jar file in Liferay Foundation.lpkg
  • Shutdown application server.
  • Copy (overwrite) Liferay Foundation.lpkg in pathosgi/marketplace/
  • Delete osgi/state/ directory content.
  • Boot application server and check the directive custom value is used.

Additional Information

 

 

Was this article helpful?
1 out of 1 found this helpful