37 lines
1.6 KiB
Plaintext
37 lines
1.6 KiB
Plaintext
# Password rehash and shared login-rate-limit unit checks
|
|
|
|
Date: 2026-11-27
|
|
Stand: Windows host, Gradle 9.7.1, Java 23 toolchain
|
|
|
|
Command:
|
|
.\gradlew.bat test --tests com.example.mtusi_messenger.security.DatabaseAuthenticationProviderTest --tests com.example.mtusi_messenger.security.LoginRateLimiterTest --no-daemon --console=plain
|
|
|
|
Observed result:
|
|
BUILD SUCCESSFUL
|
|
DatabaseAuthenticationProviderTest: 5 tests, 0 failures, 0 errors
|
|
LoginRateLimiterTest: 5 tests, 0 failures, 0 errors
|
|
|
|
DatabaseAuthenticationProviderTest proves:
|
|
- a valid legacy Argon2id hash (19456 KiB, t=2, p=1) is replaced after a
|
|
successful login by a hash with the measured runtime profile
|
|
(32768 KiB, t=2, p=1);
|
|
- the replacement uses the compare-and-swap contract
|
|
replacePasswordHash(userId, expectedHash, newHash);
|
|
- a wrong password, an unknown user and an already-current hash do not
|
|
rewrite the stored hash;
|
|
- an unknown user and a non-Argon2 stored value are checked against the
|
|
dummy hash, not against attacker-controlled stored text;
|
|
- authentication failures do not echo the password or the stored hash.
|
|
|
|
LoginRateLimiterTest proves:
|
|
- two limiter instances (simulated replicas) share the same username and
|
|
source budgets through the same Redis template;
|
|
- username matching is case-insensitive;
|
|
- Redis keys are SHA-256 digests and do not contain the raw username or
|
|
source address;
|
|
- a Redis outage fails closed with AuthenticationServiceException instead
|
|
of allowing expensive password verification;
|
|
- invalid limit/window configuration is rejected.
|
|
|
|
No passwords, session tokens or password hashes are printed by these tests.
|