Skip to content

Commit a9e901b

Browse files
Copilotfelickz
andcommitted
Fix code review issues: properly trim password values
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
1 parent 40e4fe7 commit a9e901b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/org/owasp/benchmark/helpers/LDAPManager.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,15 @@ protected Hashtable<Object, Object> createEnv() {
6262

6363
// Load password from environment variable or system property
6464
String ldapPassword = System.getenv("LDAP_ADMIN_PASSWORD");
65-
if (ldapPassword == null || ldapPassword.trim().isEmpty()) {
65+
if (ldapPassword != null) {
66+
ldapPassword = ldapPassword.trim();
67+
}
68+
if (ldapPassword == null || ldapPassword.isEmpty()) {
6669
ldapPassword = System.getProperty("ldap.admin.password");
67-
if (ldapPassword == null || ldapPassword.trim().isEmpty()) {
70+
if (ldapPassword != null) {
71+
ldapPassword = ldapPassword.trim();
72+
}
73+
if (ldapPassword == null || ldapPassword.isEmpty()) {
6874
System.err.println(
6975
"WARNING: Using default LDAP password. Set LDAP_ADMIN_PASSWORD environment variable or ldap.admin.password system property for secure configuration.");
7076
ldapPassword = "secret";

0 commit comments

Comments
 (0)