Polish toLower/UpperCase Usage

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

Closes gh-965
This commit is contained in:
Josh Cummings
2024-11-14 12:51:09 -07:00
parent ec09768097
commit 1bfb466c38
8 changed files with 63 additions and 52 deletions

View File

@@ -39,6 +39,7 @@ import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Locale;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
@@ -107,7 +108,7 @@ public class IncrementalAttributeMapperITest extends AbstractJUnit4SpringContext
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 + "\"";