@Service(value="blExploitProtectionService") public class ExploitProtectionServiceImpl extends Object implements ExploitProtectionService
Modifier and Type | Field and Description |
---|---|
protected String |
antiSamyPolicyFileLocation |
protected boolean |
xsrfProtectionEnabled |
protected boolean |
xssProtectionEnabled |
Constructor and Description |
---|
ExploitProtectionServiceImpl() |
Modifier and Type | Method and Description |
---|---|
String |
cleanString(String string)
Detect and remove possible XSS threats from the passed in string.
|
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.
|
String |
getAntiSamyPolicyFileLocation() |
String |
getCSRFToken() |
String |
getCsrfTokenParameter() |
protected boolean |
hasHTMLTags(String text) |
String |
htmlDecode(String value) |
void |
setAntiSamyPolicyFileLocation(String antiSamyPolicyFileLocation) |
void |
setXssProtectionEnabled(boolean xssProtectionEnabled) |
protected String antiSamyPolicyFileLocation
@Value(value="${exploitProtection.xsrfEnabled:true}") protected boolean xsrfProtectionEnabled
@Value(value="${exploitProtection.xssEnabled:true}") protected boolean xssProtectionEnabled
public String cleanString(String string) throws ServiceException
ExploitProtectionService
<script>
tags, and the like.cleanString
in interface ExploitProtectionService
string
- The possibly dirty stringServiceException
public String cleanStringWithResults(String string) throws ServiceException
ExploitProtectionService
<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.cleanStringWithResults
in interface ExploitProtectionService
string
- The possibly dirty stringServiceException
protected boolean hasHTMLTags(String text)
public void compareToken(String passedToken) throws ServiceException
ExploitProtectionService
compareToken
in interface ExploitProtectionService
passedToken
- The csrf token that was passed in the requestServiceException
public String getCSRFToken() throws ServiceException
getCSRFToken
in interface ExploitProtectionService
ServiceException
public String getAntiSamyPolicyFileLocation()
getAntiSamyPolicyFileLocation
in interface ExploitProtectionService
public void setAntiSamyPolicyFileLocation(String antiSamyPolicyFileLocation)
setAntiSamyPolicyFileLocation
in interface ExploitProtectionService
public String getCsrfTokenParameter()
getCsrfTokenParameter
in interface ExploitProtectionService
public String htmlDecode(String value)
htmlDecode
in interface ExploitProtectionService
public void setXssProtectionEnabled(boolean xssProtectionEnabled)
Copyright © 2022. All rights reserved.