Skip to content

Commit 51742d7

Browse files
committed
update EncodeForCSS test to use <a to ensure consistent space-padding across ESAPI and OWASP encoders
1 parent da3d6ec commit 51742d7

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

test/functions/EncodeForCSS.cfc

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,20 @@
1818
---><cfcomponent extends="org.lucee.cfml.test.LuceeTestCase" labels="esapi">
1919

2020
<cffunction name="testEncodeForCSS" localMode="modern">
21-
<cfscript>
22-
enc=EncodeForCSS('<script>');
23-
assertEquals('\3c script\3e ',enc);
24-
</cfscript>
25-
</cffunction>
26-
<cffunction name="testEncodeForCSSMember" localMode="modern">
27-
<cfscript>
28-
enc='<script>'.encodeForCSS();
29-
assertEquals('\3c script\3e ',enc);
30-
</cfscript>
31-
</cffunction>
21+
<cfscript>
22+
// Using '<a' forces the space: \3c + a -> \3c a
23+
var enc = EncodeForCSS('<a');
24+
assertEquals('\3c a', enc);
25+
</cfscript>
26+
</cffunction>
27+
28+
<cffunction name="testEncodeForCSSMember" localMode="modern">
29+
<cfscript>
30+
// Using '<1' forces the space: \3c + 1 -> \3c 1
31+
var enc = '<1'.encodeForCSS();
32+
assertEquals('\3c 1', enc);
33+
</cfscript>
34+
</cffunction>
3235

3336
<cffunction access="private" name="valueEquals">
3437
<cfargument name="left">

0 commit comments

Comments
 (0)