@@ -127,10 +127,13 @@ public void testGetValidSafeHTML() throws Exception {
127127 // assertEquals("", result4);
128128 }
129129
130- // FIXME: Update CVE once we have a number for this.
130+ // FIXME: Change the method name to reflect the CVE once we have a number for this.
131131 // Test to confirm that CVE-2022-xxxxx (TBD) is fixed. The cause of this was
132132 // from a subtle botched regex for 'onsiteURL' in all the versions of
133133 // antsamy-esapi.xml that had been there as far back as ESAPI 1.4!
134+ //
135+ // This TBD CVE should arguably get the same CVSSv3 store as the AntiSamy
136+ // CVE-2021-35043 as the are very similar.
134137 @ Test
135138 public void testJavaScriptURL () throws Exception {
136139 System .out .println ("testJavaScriptURL" );
@@ -145,23 +148,23 @@ public void testJavaScriptURL() throws Exception {
145148
146149 // To confirm fix for CVE-2021-35043 in AntiSamy 1.6.5 and later. Actually,
147150 // it was never really "broken" in ESAPI's "default configuration" because it is
148- // triggers an Intrusion Detection when it is checking the canonicalization.
149- // This test assumes a standard default ESAPI.properties file. In
150- // particular, the Intrusion Detector must be enabled (the default) and
151- // Validator.HtmlValidationAction should be set to "throw" rather than "clean"
152- @ Test (expected =IntrusionException .class )
151+ // triggers an Intrusion Detection when it is checking the canonicalization
152+ // and the ':' trips it up, that that's pretty much irrelevant given
153+ // the (TBD) CVE mented in the previous test case.
154+ //
155+ // Note: This test assumes a standard default ESAPI.properties file. In
156+ // particular, the normal canonicalization has to be enabled.
153157 public void testAntiSamyCVE_2021_35043Fixed () {
154158 System .out .println ("testAntiSamyCVE_2021_35043Fixed" );
155159
156160 String expectedSafeText = "This is safe from XSS. Trust us!" ;
157161
158162 // Translates to '<a href="javascript:x=1,alert("boom")".
159- String badVoodoo = "<a href=\" javascript:alert('boom')>" + expectedSafeText + "</a>" ;
160- String result = null ;
163+ String badVoodoo = "<a href=\" javascript:alert(1)>" + expectedSafeText + "</a>" ;
161164 Validator instance = ESAPI .validator ();
162- ValidationErrorList errorList = new ValidationErrorList ();
163- result = instance .getValidSafeHTML ( "test " , badVoodoo , 200 , false , errorList ); //
164- assertEquals ( expectedSafeText , result );
165+ // ValidationErrorList errorList = new ValidationErrorList();
166+ boolean result = instance .isValidSafeHTML ( "CVE-2021-35043 " , badVoodoo , 200 , false );
167+ assertTrue ( result );
165168 }
166169
167170 @ Test
0 commit comments