My application is developed using Oracle ADF. I'm using <af:inputText>
input fields in my forms.
Here I have to avoid HTML content in input fields. Is there a way in ADF to avoid HTML content in form input fields.
My application is developed using Oracle ADF. I'm using <af:inputText>
input fields in my forms.
Here I have to avoid HTML content in input fields. Is there a way in ADF to avoid HTML content in form input fields.
OWASP #3 - Cross-Site Scripting (XSS)
All data input to a system must be validated before it is persisted in the database. Especially data input that is later re-displayed on the application user interface exposes a risk of cross-site scripting.
To enforce valid data input in Oracle ADF, you should implement the following strategy
Reference: http://www.oracle.com/technetwork/developer-tools/adf/adfowasptop10-final-2348304.pdf
One way to work this out is to add a validator on your inputText(s). So you'll have something like this:
<af:inputText ... validator="#{scope.beanName.methodName}".../>
And of course in beanName, you'll have to add the validator method:
public void methodName(FacesContext pContext, UIComponent pComponent, Object pValue) {
String userInput = pValue.toString();
if( containsHtml(userInput) ) {
FacesMessage message = new FacesMessage(...);
throw new ValidationException(message);
}
}
public boolean containsHtml(String pUserInput) { ... your logic ... }