Package org.owasp.validator.html
Class AntiSamy
- java.lang.Object
-
- org.owasp.validator.html.AntiSamy
-
public class AntiSamy extends java.lang.ObjectThis is the only class from which the outside world should be calling. Thescan()method holds the meat and potatoes of AntiSamy. The file contains a number of ways forscan()'ing depending on the accessibility of the policy file.- Author:
- Arshan Dabirsiaghi
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CleanResultsscan(java.lang.String taintedHTML)The meat and potatoes.CleanResultsscan(java.lang.String taintedHTML, int scanType)CleanResultsscan(java.lang.String taintedHTML, java.io.File policyFile)This method wrapsscan()using the policy File object passed in.CleanResultsscan(java.lang.String taintedHTML, java.lang.String filename)This method wrapsscan()using the Policy object passed in.CleanResultsscan(java.lang.String taintedHTML, Policy policy)This method wrapsscan()using the Policy object passed in.CleanResultsscan(java.lang.String taintedHTML, Policy policy, int scanType)
-
-
-
Constructor Detail
-
AntiSamy
public AntiSamy()
-
AntiSamy
public AntiSamy(Policy policy)
-
-
Method Detail
-
scan
public CleanResults scan(java.lang.String taintedHTML) throws ScanException, PolicyException
The meat and potatoes. Thescan()family of methods are the only methods the outside world should be calling to invoke AntiSamy.- Parameters:
taintedHTML- Untrusted HTML which may contain malicious code.- Returns:
- A
CleanResultsobject which contains information about the scan (including the results). - Throws:
ScanException- When there is a problem encountered while scanning the HTML.PolicyException- When there is a problem reading the policy file.
-
scan
public CleanResults scan(java.lang.String taintedHTML, int scanType) throws ScanException, PolicyException
- Throws:
ScanExceptionPolicyException
-
scan
public CleanResults scan(java.lang.String taintedHTML, Policy policy) throws ScanException, PolicyException
This method wrapsscan()using the Policy object passed in.- Throws:
ScanExceptionPolicyException
-
scan
public CleanResults scan(java.lang.String taintedHTML, Policy policy, int scanType) throws ScanException, PolicyException
- Throws:
ScanExceptionPolicyException
-
scan
public CleanResults scan(java.lang.String taintedHTML, java.lang.String filename) throws ScanException, PolicyException
This method wrapsscan()using the Policy object passed in.- Throws:
ScanExceptionPolicyException
-
scan
public CleanResults scan(java.lang.String taintedHTML, java.io.File policyFile) throws ScanException, PolicyException
This method wrapsscan()using the policy File object passed in.- Throws:
ScanExceptionPolicyException
-
-