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 fromLiferay 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 inLiferay 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
- Feature request to allow specifying an AntiSamy configuration file outside the module bundle: LPS-88322
- sanitizer-configuration.xml on GitHub
Subscriber Exclusive Content
A Liferay Enterprise Subscription provides access to over 1,500 articles that include best practices, troubleshooting, and other valuable solutions. Sign in for full access.
Sign In