Title:
Implementing the OWASP ESAPI validator in batch mode generates NULL pointer exception
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/Duplicate
Reporter/Name(from Bugbase): Miguel Fernandez / Miguel Fernandez (Miguel Fernandez)
Created: 07/16/2013
Components: General Server
Versions: 10.0
Failure Type: Non Functioning
Found In Build/Fixed In Build: Final /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Win 2008 Server R2 64 bit
Vote Count: 0
Duplicate ID: CF-3595899
Problem Description:
I entered bug #3595899 for ColdFusion 9.0.1 and the same issue occurs in ColdFusion 10. I have been working with the OWASP ESAPI utilities that are included with ColdFusion. The encoder utilities are pretty straight forward and I believe I have them working fine. The problem is with the validator utilities.
I can get them to work singly. That is, if I call the validator.getValidInput() method with "invalid" data it will throw an error that I can catch. However, when I try to call the validator method in batch I get a null pointer exception. By batch I mean attempting to execute groups of validation attempts. This is supposed to work by passing the validator.getValidInput() method a ValidationErrorList parameter which should tell it NOT to throw an error but instead just add the error to the error list. I cannot get it to work in this mode.
Steps to Reproduce:
Attached test script "test_fails.cfm" will generate the NULL pointer exception.
Actual Result:
NULL pointer exception is thrown.
Expected Result:
The NULL pointer error should not be thrown. Instead any validation errors should be added to the ErrorList array and processing should continue. Although a workaround has been provided below, it should not be necessary. The ErrorList array should be initialized when it is instantiated.
Any Workarounds:
Thanks to the advice of Chris Schmidt on StackOverflow if you initialize the ErrorList variable before calling the validation methods it will work as expected. Add this line to the test script before calling the getValidInput method and it will work.
<cfset ErrorList = ErrorList.init() />
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3595943
External Customer Info:
External Company:
External Customer Name: Miguel-F
External Customer Email:
External Test Config: My Hardware and Environment details:
ColdFusion version: 10,283111
Java version: 1.6.0_41
Windows version: Windows XP
Attachments:
- July 16, 2013 00:00:00: 1_test_fails.cfm
- July 16, 2013 00:00:00: 2_test_works.cfm
Comments: