feat(security): add pwned password validation#2959
Open
AlexProgrammerDE wants to merge 2 commits into
Open
Conversation
Contributor
Contributor
|
Sorry @AlexProgrammerDE , completely reworked the plugin :D |
b4f0051 to
847f977
Compare
Author
|
@Xephi PR is ready for merge/review |
There was a problem hiding this comment.
Pull request overview
Adds an optional HaveIBeenPwned “Pwned Passwords” range-API check to AuthMe’s password validation so servers can reject commonly breached passwords during registration / password changes.
Changes:
- Introduces
PwnedPasswordServiceto query the HIBP range API and parse breach counts. - Extends
ValidationService.validatePasswordto optionally reject passwords above a configurable breach-count threshold. - Adds message key + English translation and unit tests covering service + validation behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| authme-core/src/main/java/fr/xephi/authme/service/PwnedPasswordService.java | New service performing HIBP range API request and parsing response into a pwned-count result. |
| authme-core/src/main/java/fr/xephi/authme/service/ValidationService.java | Wires the pwned-password check into password validation behind a settings flag + threshold. |
| authme-core/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java | Adds config toggles for enabling the check and setting the breach-count threshold. |
| authme-core/src/main/java/fr/xephi/authme/message/MessageKey.java | Adds a new message key + placeholder for breach count. |
| authme-core/src/main/resources/messages/messages_en.yml | Adds the English message text for the new validation error. |
| authme-core/src/test/java/fr/xephi/authme/service/PwnedPasswordServiceTest.java | New unit tests for parsing + request prefix behavior + failure behavior. |
| authme-core/src/test/java/fr/xephi/authme/service/ValidationServiceTest.java | Adds tests for threshold behavior and “unavailable API” behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Xephi
requested changes
May 3, 2026
Contributor
Xephi
left a comment
There was a problem hiding this comment.
You should make it thread-safe, take a look at Copilot's review :)
Author
|
@Xephi sorry for the delay, is it good now? |
Comment on lines
+111
to
+120
| future.complete(validatePwnedPassword(password)); | ||
| } catch (RuntimeException e) { | ||
| future.completeExceptionally(e); | ||
| } catch (Error e) { | ||
| future.completeExceptionally(e); | ||
| } | ||
| }); | ||
| return future; | ||
| } | ||
|
|
Comment on lines
+62
to
+66
| validatePwnedPassword(parameters).thenAccept(passwordValidation -> { | ||
| if (passwordValidation.hasError()) { | ||
| service.send(parameters.getPlayer(), passwordValidation.getMessageKey(), | ||
| passwordValidation.getArgs()); | ||
| } else { |
Comment on lines
+51
to
55
| validationService.validatePasswordAsync(playerPass, playerName).thenAccept(passwordValidation -> { | ||
| if (passwordValidation.hasError()) { | ||
| commonService.send(sender, passwordValidation.getMessageKey(), passwordValidation.getArgs()); | ||
| return; | ||
| } |
Comment on lines
+56
to
+60
| validationService.validatePasswordAsync(newPassword, name).thenAccept(passwordValidation -> { | ||
| if (passwordValidation.hasError()) { | ||
| commonService.send(player, passwordValidation.getMessageKey(), passwordValidation.getArgs()); | ||
| } else { | ||
| management.performPasswordChange(player, oldPassword, newPassword); |
Comment on lines
+33
to
+38
| validationService.validatePasswordAsync(playerPass, playerName).thenAccept(validationResult -> { | ||
| if (validationResult.hasError()) { | ||
| commonService.send(sender, validationResult.getMessageKey(), validationResult.getArgs()); | ||
| } else { | ||
| management.performPasswordChangeAsAdmin(sender, playerName, playerPass); | ||
| } |
Comment on lines
19
to
22
| name_in_password: '&cYou can''t use your name as password, please choose another one...' | ||
| unsafe_password: '&cThe chosen password isn''t safe, please choose another one...' | ||
| pwned_password: '&cYour chosen password is not secure. It has been seen %pwned_count times before! Please use a stronger password...' | ||
| forbidden_characters: '&4Your password contains illegal characters. Allowed chars: %valid_chars' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successor of #2642 because for some reason it was closed unmerged and I didn't get a reply from the maintainers so far. Will update the code to be mergable this evening.