diff --git a/applications/content/config/content.properties b/applications/content/config/content.properties index ae6da3868b..18851787fe 100644 --- a/applications/content/config/content.properties +++ b/applications/content/config/content.properties @@ -34,8 +34,4 @@ content.upload.max.files=250 content.upload.always.local.file=true # content output folder (relative to ofbiz.home) -content.output.path=runtime/output - -#Should we sanitize generic content by default (specific contents - order, party, category, product, configured product, product promo and work effort - are always encoded) -# This has a slightly impact on the code rendered, see OFBIZ-6669. True By default! -content.sanitize=true +content.output.path=runtime/output \ No newline at end of file diff --git a/applications/content/src/org/ofbiz/content/content/ContentWorker.java b/applications/content/src/org/ofbiz/content/content/ContentWorker.java index 2e6e35b5e6..57abf94625 100644 --- a/applications/content/src/org/ofbiz/content/content/ContentWorker.java +++ b/applications/content/src/org/ofbiz/content/content/ContentWorker.java @@ -35,6 +35,7 @@ import org.ofbiz.base.util.BshUtil; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilCodec; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; @@ -52,7 +53,6 @@ import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; -import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.SimpleMapProcessor; import org.ofbiz.service.DispatchContext; @@ -60,8 +60,6 @@ import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ModelService; import org.ofbiz.service.ServiceUtil; -import org.owasp.html.PolicyFactory; -import org.owasp.html.Sanitizers; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -74,6 +72,7 @@ import freemarker.ext.dom.NodeModel; public class ContentWorker implements org.ofbiz.widget.content.ContentWorkerInterface { public static final String module = ContentWorker.class.getName(); + static final UtilCodec.SimpleEncoder encoder = UtilCodec.getEncoder("html"); public ContentWorker() { } @@ -339,8 +338,7 @@ public class ContentWorker implements org.ofbiz.widget.content.ContentWorkerInte String rendered = writer.toString(); // According to https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet#XSS_Prevention_Rules_Summary // Normally head should be protected by X-XSS-Protection Response Header by default - if (EntityUtilProperties.propertyValueEqualsIgnoreCase("content.properties", "content.sanitize", "true", delegator) - && (rendered.contains("