diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/filter/SanitizerFilter.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/filter/SanitizerFilter.java index 9ecf6abd0f..bcf3905022 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/filter/SanitizerFilter.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/filter/SanitizerFilter.java @@ -22,7 +22,6 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; -import java.util.logging.Logger; import java.util.stream.Stream; import javax.annotation.Nullable; @@ -40,6 +39,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.bonitasoft.console.common.server.preferences.properties.PropertiesFactory; import org.owasp.html.HtmlChangeListener; @@ -54,10 +54,9 @@ * * @author Vincent Hemery */ +@Slf4j public class SanitizerFilter extends ExcludingPatternFilter { - protected static Logger log = Logger.getLogger(SanitizerFilter.class.getName()); - /** * Sanitizer to apply to values. * Do not let TABLES and LINKS which can be mis-leading as phishing. @@ -84,14 +83,18 @@ public class SanitizerFilter extends ExcludingPatternFilter { @Override public void discardedTag(@Nullable Object context, String elementName) { - log.fine(() -> format("Tag '%s' has been discarded", elementName)); + if (log.isDebugEnabled()) { + log.debug(format("Tag '%s' has been discarded", elementName)); + } } @Override public void discardedAttributes( @Nullable Object context, String elementName, String... attributeNames) { - log.fine(() -> format("Tag '%s' has been cleaned from the following attributes: %s", elementName, - attributeNames)); + if (log.isDebugEnabled()) { + log.debug(format("Tag '%s' has been cleaned from the following attributes: %s", elementName, + String.join(", ", attributeNames))); + } } }; @@ -281,7 +284,7 @@ private Optional sanitizeValueAndPerformAction(String value, Consumer + diff --git a/platform/platform-resources/src/main/resources/platform_portal/security-config.properties b/platform/platform-resources/src/main/resources/platform_portal/security-config.properties index 3a6c34be9b..4dd5440415 100644 --- a/platform/platform-resources/src/main/resources/platform_portal/security-config.properties +++ b/platform/platform-resources/src/main/resources/platform_portal/security-config.properties @@ -1,7 +1,7 @@ #Enable/disable CSRF security filter security.csrf.enabled true #Enable/disable the Sanitizer protection activation (true/false). This sanitizer protects against multiple attacks such as XSS, but may restrict the use of some character sequences. -security.sanitizer.enabled false +security.sanitizer.enabled true #Name of the Attributes excluded from sanitizer protection (comma separated) security.sanitizer.exclude email,password,password_confirm #Add or not the secure flag to the CSRF token cookie (HTTPS only)