-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
[JENKINS-75533] Remove jbcrypt mindrot, use Spring Security instead #10604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but one comment should be updated.
test/src/test/java/hudson/security/HudsonPrivateSecurityRealmFIPSTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: James Nord <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process. Thanks!
@@ -37,6 +37,7 @@ HudsonPrivateSecurityRealm.ManageUserLinks.Description=Create/delete/modify user | |||
HudsonPrivateSecurityRealm.CreateAccount.TextNotMatchWordInImage=Text didn''t match the word shown in the image | |||
HudsonPrivateSecurityRealm.CreateAccount.PasswordNotMatch=Password didn''t match | |||
HudsonPrivateSecurityRealm.CreateAccount.FIPS.PasswordLengthInvalid=Password must be at least 14 characters long | |||
HudsonPrivateSecurityRealm.CreateAccount.BCrypt.PasswordTooLong=Jenkins’ own user database currently only supports passwords of up to 72 bytes UTF-8 (72 basic ASCII characters, 24-36 CJK characters, or 18 emoji). Please use a shorter password. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an example of a developer error message and not a user message.
For a user I would suggest something more like:
- Option 1
Jenkins’ own user database only supports passwords up to 72 characters
- Option 2
Maximum password length is 72 characters
- Option 3
Password is too long
If you really want to tweak for UTF-8 or emoji you could put a more specific error message in there only when one of these is detected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback. I acknowledge the problem in the Jira issue when I wrote
longer than 72 bytes (UTF-8, so good luck explaining this requirement to users)
but I couldn't think of a great alternative, other than providing examples what this means (and why "72 characters" isn't it -- option 1 and 2 are simply wrong).
Something more vague like the following might work, as it captures the important parts while being overall less technical.
usually 72 characters, fewer when using other characters, like Chinese characters or emoji
I like
put a more specific error message in there only when one of these is detected.
though, will take a stab at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See JENKINS-75533.
During development of this change, Spring Security added the backward compatibility I considered here, but without exposing the potential problem to users. I considered doing that for Jenkins, but there's no great way built-in to expose that information to users and ask them to change the password. I can do that if required, basically all of the code is written but I think unnecessary.
As a side effect of moving the validation into the
PasswordHashEncoder
this would address JENKINS-74918 as well, as demonstrated by the necessary test changes (password
is shorter than 14 chars).Depends on jenkinsci/active-directory-plugin#241 which would break.
Testing done
Screenshots
Regular
FIPS-140
Proposed changelog entries
org.connectbot:jbcrypt
library from core BOM.Proposed changelog category
/label developer,dependencies,internal,rfe,removed
Proposed upgrade guidelines
Unless operating in FIPS-140 mode, Jenkins' own user database no longer supports creating passwords longer than 72 bytes (UTF-8), which is the maximum length supported by the bcrypt password hashing function it uses. This length corresponds to 72 basic ASCII characters, 24-36 CJK characters, or 18 emoji 🤠.
Existing passwords longer than 72 bytes can still be used to log in.
Users with longer passwords are advised to change their password to be at most 72 bytes (and, e.g., choose from a larger character set to achieve the same complexity).
Submitter checklist
@Restricted
or have@since TODO
Javadocs, as appropriate.@Deprecated(since = "TODO")
or@Deprecated(forRemoval = true, since = "TODO")
, if applicable.eval
to ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@mention
Before the changes are marked as
ready-for-merge
:Maintainer checklist
upgrade-guide-needed
label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidate
to be considered (see query).