fix: harden the lockout after the branch review
Settings get upper limits (a huge period made every lock check fail open), the lock check uses the same 191-character key the history stores, login_audit.username compares like user.username, and the module gets its own icon. Docs and design notes follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
e240a9c37f
commit
059107fbaa
8 files changed
+31
-10
No files matched your search
+16
@@ -116,6 +116,22 @@ class LoginSecurityServiceTest {
|
||||
assertThat(service.isLocked("admin")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void lockCheckUsesTheSame191CharacterKeyTheHistoryStores() {
|
||||
String stored = "a".repeat(191);
|
||||
settings("Y", "10", "1", "M");
|
||||
failures(stored, NOW.minusMinutes(1));
|
||||
|
||||
assertThat(service.isLocked(stored + "bbbb")).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void settingsHaveUpperLimits() {
|
||||
assertThatThrownBy(() -> service.saveConfig(new Config(true, 1001, 15, "M"))).hasMessage("Max attempts must be at most 1000");
|
||||
assertThatThrownBy(() -> service.saveConfig(new Config(true, 5, 10001, "M"))).hasMessage("Period must be at most 10000");
|
||||
verify(properties, never()).save(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void usernameIsTrimmed() {
|
||||
settings("Y", "10", "1", "M");
|
||||
|
||||
Reference in new issue
Block a user