File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1- component extends = " org.lucee.cfml.test.LuceeTestCase" labels = " esapi,xml " {
1+ component extends = " org.lucee.cfml.test.LuceeTestCase" labels = " esapi" {
22 function run ( testResults , testBox ) {
33 describe ( " test case for EncodeForXMLAttribute" , function () {
44 it (title = " Checking with EncodeForXMLAttribute" , body = function ( currentSpec ) {
55 var enc = EncodeForXMLAttribute (' <script>' );
6- assertEquals (' &## x3c ;script& ## x3e; ' ,enc );
6+ assertEquals (' < ;script> ' ,enc );
77 });
88
99 it (title = " Checking with EncodeForXMLAttributeMember" , body = function ( currentSpec ) {
1010 var enc = ' <script>' .EncodeForXMLAttribute ();
11- assertEquals (' &## x3c ;script& ## x3e; ' ,enc );
11+ assertEquals (' < ;script> ' ,enc );
1212 });
1313 });
1414 }
Original file line number Diff line number Diff line change @@ -4,9 +4,11 @@ component extends="org.lucee.cfml.test.LuceeTestCase"{
44 describe ( title = " Testcase for sanitizeHTML function" , body = function () {
55 it ( title = " checking sanitizeHTML() function" , body = function ( currentSpec ) {
66 var html = ' <!DOCTYPE html><html><body><h2>HTML Forms</h2><form action="/action_page.cfm"><label for="fname">First name:</label><br><input type="text" id="fname" name="fname"value="Pothys"><br></body></html>' ;
7+ var res = SanitizeHtml (html );
78
8- expect (SanitizeHtml (html )).toBe (' <h2>HTML Forms</h2>First name:<br /><br />' );
9- expect (html .SanitizeHtml ()).toBe (' <h2>HTML Forms</h2>First name:<br /><br />' ); // member function
9+ // cover result from esapi and owasp encoder library that are both valid
10+ var isValid = res == ' <h2>HTML Forms</h2>First name:<br /><br />' || res == ' <h2>HTML Forms</h2>First name:<br><br>' ;
11+ expect (isValid ).toBe (true );
1012 });
1113 });
1214 }
You can’t perform that action at this time.
0 commit comments