Skip to content

Commit

Permalink
check password length
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisYaoA committed Sep 17, 2024
1 parent e198f7f commit 3380f46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import hudson.util.Secret;
import jenkins.model.Jenkins;
import java.nio.charset.StandardCharsets;

import jenkins.security.FIPS140;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
Expand Down Expand Up @@ -411,6 +413,9 @@ public FormValidation doCheckServer(@QueryParameter String value, @QueryParamete
if(!Jenkins.get().hasPermission(Jenkins.ADMINISTER))
return FormValidation.ok();

if(FIPS140.useCompliantAlgorithms() && managerPassword.length() < 14)

Check warning on line 416 in src/main/java/jenkins/security/plugins/ldap/LDAPConfiguration.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 416 is only partially covered, 3 branches are missing
return FormValidation.error(Messages.LDAPSecurityRealm_AuthenticationFailedNotFipsCompliantPass());

Check warning on line 417 in src/main/java/jenkins/security/plugins/ldap/LDAPConfiguration.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 417 is not covered by tests

Context ctx = null;
try {
Hashtable<String,Object> props = new Hashtable<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LDAPSecurityRealm.LoginHeader=Login
LDAPSecurityRealm.AuthenticationSuccessful=Authentication: successful
LDAPSecurityRealm.AuthenticationFailed=Authentication: failed for user "{0}"
LDAPSecurityRealm.AuthenticationFailedEmptyPass=Authentication: failed for user "{0}" with empty password
LDAPSecurityRealm.AuthenticationFailedNotFipsCompliantPass=Authentication failed: your password must be at least 14 characters long
LDAPSecurityRealm.UserId=User ID: {0}
LDAPSecurityRealm.UserDn=User DN: {0}
LDAPSecurityRealm.UserConfiguration=User Server: {0}
Expand Down

0 comments on commit 3380f46

Please sign in to comment.