@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 ExploitProtectionServicestring - The possibly dirty stringServiceExceptionpublic 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 ExploitProtectionServicestring - The possibly dirty stringServiceExceptionprotected boolean hasHTMLTags(String text)
public void compareToken(String passedToken) throws ServiceException
ExploitProtectionServicecompareToken in interface ExploitProtectionServicepassedToken - The csrf token that was passed in the requestServiceExceptionpublic String getCSRFToken() throws ServiceException
getCSRFToken in interface ExploitProtectionServiceServiceExceptionpublic String getAntiSamyPolicyFileLocation()
getAntiSamyPolicyFileLocation in interface ExploitProtectionServicepublic void setAntiSamyPolicyFileLocation(String antiSamyPolicyFileLocation)
setAntiSamyPolicyFileLocation in interface ExploitProtectionServicepublic String getCsrfTokenParameter()
getCsrfTokenParameter in interface ExploitProtectionServicepublic String htmlDecode(String value)
htmlDecode in interface ExploitProtectionServicepublic void setXssProtectionEnabled(boolean xssProtectionEnabled)
Copyright © 2022. All rights reserved.