public abstract class WhiteBlackExpressionSecurityAdapter extends Object implements SecurityAdapter<String>
Modifier and Type | Field and Description |
---|---|
protected Pattern |
blackRegExPattern |
protected Pattern |
whiteRegExPattern |
REGEX_PROP_FILE
Constructor and Description |
---|
WhiteBlackExpressionSecurityAdapter() |
WhiteBlackExpressionSecurityAdapter(Pattern blackRegExPattern,
Pattern whiteRegExPattern) |
WhiteBlackExpressionSecurityAdapter(String blackRegEx,
String whiteRegEx) |
Modifier and Type | Method and Description |
---|---|
Pattern |
getBlackRegExPattern() |
Pattern |
getWhiteRegExPattern() |
protected void |
processInvalidQuery(Data<String> input) |
protected void |
processNameValue(String name,
String value)
Used by
processParams(Data) |
protected void |
processParams(Data<String> input)
If there are param pairs then process them pair wise
|
Data<String> |
sanitize(Data<String> input)
Sanitize content, from malicious to harmless.
|
void |
setBlackRegExPattern(Pattern blackRegExPattern) |
void |
setWhiteRegExPattern(Pattern whiteRegExPattern) |
void |
validate(Data<String> input)
Check if the input is safe or not
When used in a chained or a SecurityContext with other SecurityAdapter s then the Adapters throwing
a OperationNotSupportedException will be ignored. |
protected void |
validateAgainstBlackRegEx(Data<String> input) |
protected void |
validateAgainstWhiteRegEx(Data<String> input) |
protected Pattern blackRegExPattern
protected Pattern whiteRegExPattern
public WhiteBlackExpressionSecurityAdapter()
public WhiteBlackExpressionSecurityAdapter(String blackRegEx, String whiteRegEx)
public Data<String> sanitize(Data<String> input) throws org.owasp.validator.html.ScanException, org.owasp.validator.html.PolicyException, OperationNotSupportedException
SecurityAdapter
OperationNotSupportedException
.
When used in a chained or a SecurityContext
with other SecurityAdapter
s 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.ScanException
org.owasp.validator.html.PolicyException
OperationNotSupportedException
public void validate(Data<String> input) throws SecurityException, IOException
SecurityAdapter
SecurityContext
with other SecurityAdapter
s then the Adapters throwing
a OperationNotSupportedException
will be ignored.validate
in interface SecurityAdapter<String>
input
- as Data
SecurityException
- is its is not safe. This is to provide additional details about the failure that te return param cannot.IOException
- for any type of setup, reading, infra related issue with files/configsprotected void validateAgainstBlackRegEx(Data<String> input) throws SecurityException, IOException
SecurityException
IOException
protected void validateAgainstWhiteRegEx(Data<String> input) throws SecurityException, IOException
SecurityException
IOException
protected void processParams(Data<String> input) throws SecurityException, IOException
input
- SecurityException
IOException
protected void processNameValue(String name, String value) throws SecurityException, IOException
processParams(Data)
name
- value
- SecurityException
IOException
protected void processInvalidQuery(Data<String> input) throws SecurityException, IOException
SecurityException
IOException
public Pattern getBlackRegExPattern()
public void setBlackRegExPattern(Pattern blackRegExPattern)
public Pattern getWhiteRegExPattern()
public void setWhiteRegExPattern(Pattern whiteRegExPattern)
Copyright © 2018. All rights reserved.