Class ExploitProtectionServiceImpl
java.lang.Object
org.broadleafcommerce.common.security.service.ExploitProtectionServiceImpl
- All Implemented Interfaces:
ExploitProtectionService
@Service("blExploitProtectionService")
public class ExploitProtectionServiceImpl
extends Object
implements ExploitProtectionService
- Author:
- jfischer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncleanString
(String string) Detect and remove possible XSS threats from the passed in string.cleanStringWithResults
(String string) Detect and remove possible XSS threats from the passed in string.void
compareToken
(String passedToken) Detect possible XSRF attacks by comparing the csrf token included in the request against the true token for this user from the session.htmlDecode
(String value) void
setXssProtectionEnabled
(boolean xssProtectionEnabled)
-
Field Details
-
xsrfProtectionEnabled
@Value("${exploitProtection.xsrfEnabled:true}") protected boolean xsrfProtectionEnabled -
xssProtectionEnabled
@Value("${exploitProtection.xssEnabled:true}") protected boolean xssProtectionEnabled
-
-
Constructor Details
-
ExploitProtectionServiceImpl
public ExploitProtectionServiceImpl()
-
-
Method Details
-
cleanString
Description copied from interface:ExploitProtectionService
Detect and remove possible XSS threats from the passed in string. This includes<script>
tags, and the like.- Specified by:
cleanString
in interfaceExploitProtectionService
- Parameters:
string
- The possibly dirty string- Returns:
- The cleansed version of the string
- Throws:
ServiceException
-
cleanStringWithResults
Description copied from interface:ExploitProtectionService
Detect and remove possible XSS threats from the passed in string. This includes<script>
tags, and the like. If an html, validation, or security problem is detected, an exception is thrown. This method also emits well formed xml, which is important if using Thymeleaf to display the results.- Specified by:
cleanStringWithResults
in interfaceExploitProtectionService
- Parameters:
string
- The possibly dirty string- Returns:
- The cleansed version of the string
- Throws:
ServiceException
-
compareToken
Description copied from interface:ExploitProtectionService
Detect possible XSRF attacks by comparing the csrf token included in the request against the true token for this user from the session. If they are different, then the exception is thrown.- Specified by:
compareToken
in interfaceExploitProtectionService
- Parameters:
passedToken
- The csrf token that was passed in the request- Throws:
ServiceException
-
getCSRFToken
- Specified by:
getCSRFToken
in interfaceExploitProtectionService
- Throws:
ServiceException
-
getCsrfTokenParameter
- Specified by:
getCsrfTokenParameter
in interfaceExploitProtectionService
-
htmlDecode
- Specified by:
htmlDecode
in interfaceExploitProtectionService
-
setXssProtectionEnabled
public void setXssProtectionEnabled(boolean xssProtectionEnabled)
-