public class XSSAntiSamySecurityAdapter extends Object implements SecurityAdapter<String>
SecurityAdapter for preventing & sanitizing AntiSamy DOM-XSS. One can also refer to a ready set of Policy files
at classpath:com/neurosys/cluzo/antisamy
REGEX_PROP_FILE| Constructor and Description |
|---|
XSSAntiSamySecurityAdapter() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
org.owasp.validator.html.Policy |
getPolicy() |
String |
getPolicyId() |
int |
hashCode() |
Data |
sanitize(Data<String> input)
Sanitize content, from malicious to harmless.
|
void |
setPolicy(org.owasp.validator.html.Policy policy) |
XSSAntiSamySecurityAdapter |
setPolicyFile(File policyFile)
Locations can be files, urls or classpaths.
|
void |
setPolicyId(String policyId) |
XSSAntiSamySecurityAdapter |
setPolicyResourceLocation(String resourceLocation)
Locations can be files, urls or classpaths.
|
XSSAntiSamySecurityAdapter |
setPolicyUrl(URL url)
Locations can be files, urls or classpaths.
|
void |
validate(Data<String> input)
Check if the input is safe or not
When used in a chained or a SecurityContext with other SecurityAdapters then the Adapters throwing
a OperationNotSupportedException will be ignored. |
public XSSAntiSamySecurityAdapter setPolicyFile(File policyFile) throws org.owasp.validator.html.PolicyException
location - as Fileorg.owasp.validator.html.PolicyExceptionpublic XSSAntiSamySecurityAdapter setPolicyUrl(URL url) throws org.owasp.validator.html.PolicyException
location - as URLorg.owasp.validator.html.PolicyExceptionpublic XSSAntiSamySecurityAdapter setPolicyResourceLocation(String resourceLocation) throws IOException, org.owasp.validator.html.PolicyException
resourceLocation - as Spring Resource locationorg.owasp.validator.html.PolicyExceptionIOExceptionpublic Data sanitize(Data<String> input) throws org.owasp.validator.html.ScanException, org.owasp.validator.html.PolicyException, OperationNotSupportedException
SecurityAdapterOperationNotSupportedException.
When used in a chained or a SecurityContext with other SecurityAdapters then the Adapters throwing
a OperationNotSupportedException will be ignored. Any other exception will be thrown if there is
an issue in the executionof the sanitization process.sanitize in interface SecurityAdapter<String>org.owasp.validator.html.ScanExceptionorg.owasp.validator.html.PolicyExceptionOperationNotSupportedExceptionpublic void validate(Data<String> input) throws SecurityException, OperationNotSupportedException
SecurityAdapterSecurityContext with other SecurityAdapters then the Adapters throwing
a OperationNotSupportedException will be ignored.validate in interface SecurityAdapter<String>input - as DataSecurityException - is its is not safe. This is to provide additional details about the failure that te return param cannot.OperationNotSupportedExceptionpublic void setPolicy(org.owasp.validator.html.Policy policy)
public org.owasp.validator.html.Policy getPolicy()
public void setPolicyId(String policyId)
public String getPolicyId()
Copyright © 2018. All rights reserved.