Polish toLower/UpperCase Usage

Apply the common security hardening
technique of specifying Locale when
calling toUpperCase and toLowerCase

Closes gh-964
This commit is contained in:
Josh Cummings
2024-11-06 13:25:28 -07:00
parent 5cfae771c7
commit faf5c3d113
8 changed files with 41 additions and 16 deletions

View File

@@ -18,6 +18,7 @@ package org.springframework.ldap.itest.ad;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Locale;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.DirContext;
@@ -112,7 +113,8 @@ public class IncrementalAttributeMapperITests extends AbstractJUnit4SpringContex
ctx.setAttributeValue("userPrincipalName", username + "@example.com");
ctx.setAttributeValue("cn", username);
ctx.setAttributeValue("description", "Dummy user");
ctx.setAttributeValue("sAMAccountName", username.toUpperCase() + "." + username.toUpperCase());
ctx.setAttributeValue("sAMAccountName",
username.toUpperCase(Locale.ENGLISH) + "." + username.toUpperCase(Locale.ENGLISH));
ctx.setAttributeValue("userAccountControl", "512");
String newQuotedPassword = "\"" + DEFAULT_PASSWORD + "\"";