Skip to content

Commit c4276d6

Browse files
committed
Add forward slash encoding to DefaultEncoder's encodeForLDAP and encodeForDN (v4)
According to [1] and [2], the forward slash ('/') character should be encoded for LDAP filters and distinguished names. [1] https://docs.microsoft.com/en-us/windows/win32/adsi/search-filter-syntax [2] https://social.technet.microsoft.com/wiki/contents/articles/5312.active-directory-characters-to-escape.aspx
1 parent 0ff0ddb commit c4276d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test/java/org/owasp/esapi/reference/EncoderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ public void testEncodeForLDAPWithoutEncodingWildcards() {
548548
assertEquals("No special characters to escape", "Hi This is a test #��", instance.encodeForLDAP("Hi This is a test #��", false));
549549
assertEquals("Zeros", "Hi \\00", instance.encodeForLDAP("Hi \u0000", false));
550550
assertEquals("LDAP Christams Tree", "Hi \\28This\\29 = is * a \\5c test # � � �", instance.encodeForLDAP("Hi (This) = is * a \\ test # � � �", false));
551-
assertEquals("Forward slash for \\2fMicrosoft\\2f \\2fAD\\2f", instance.encodeForLDAP("Forward slash for /Microsoft/ /AD/"));
551+
assertEquals("Forward slash for \\/Microsoft\\/ \\/AD\\/", instance.encodeForLDAP("Forward slash for /Microsoft/ /AD/"));
552552
}
553553

554554
/**

0 commit comments

Comments
 (0)