Add Source Code Linter Pipeline
This commit is contained in:
parent
0d0e7140c4
commit
d252f6ef50
313 changed files with 36277 additions and 0 deletions
37
screwdriver-3.5.6/box/snippets/java/XssSanitizer.java
Normal file
37
screwdriver-3.5.6/box/snippets/java/XssSanitizer.java
Normal file
|
@ -0,0 +1,37 @@
|
|||
package +zoccolo+.web.sanitizer;
|
||||
|
||||
import org.owasp.validator.html.AntiSamy;
|
||||
import org.owasp.validator.html.CleanResults;
|
||||
import org.owasp.validator.html.Policy;
|
||||
import org.owasp.validator.html.PolicyException;
|
||||
import org.owasp.validator.html.ScanException;
|
||||
|
||||
public class XssSanitizer {
|
||||
|
||||
private AntiSamy antiSamy;
|
||||
private Policy policy;
|
||||
|
||||
|
||||
public XssSanitizer(String policyFilePath) throws PolicyException{
|
||||
this.policy = Policy.getInstance(this.getClass().getResourceAsStream(policyFilePath));
|
||||
|
||||
this.antiSamy = new AntiSamy(this.policy);
|
||||
}
|
||||
|
||||
public CleanResults scan(String input) throws ScanException, PolicyException{
|
||||
if(input == null)
|
||||
throw new ScanException("input parameter is null.");
|
||||
CleanResults cleanResults = this.antiSamy.scan(input);
|
||||
return cleanResults;
|
||||
}
|
||||
|
||||
public AntiSamy getAntiSamy() {
|
||||
return antiSamy;
|
||||
}
|
||||
|
||||
public Policy getPolicy() {
|
||||
return policy;
|
||||
}
|
||||
/* screwdriver_knife */
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue