-
Notifications
You must be signed in to change notification settings - Fork 6.3k
HaveIBeenPwnedRestApiPasswordChecker implementations are not thread-safe #18234
Copy link
Copy link
Closed
Labels
in: coreAn issue in spring-security-coreAn issue in spring-security-corestatus: duplicateA duplicate of another issueA duplicate of another issuetype: bugA general bugA general bug
Description
HaveIBeenPwnedRestApiPasswordChecker stores a single MessageDigest instance as a field and reuses it across all invocations of check(). Since MessageDigest is not thread-safe, concurrent calls can produce incorrect hash values.
To Reproduce
- Register
HaveIBeenPwnedRestApiPasswordCheckeras a singleton bean - Call
check()concurrently from multiple threads - Hash computation becomes unreliable due to shared mutable state in
MessageDigest
Expected behavior
The checker should produce correct results under concurrent access. A new MessageDigest instance should be created per invocation instead of reusing a shared instance.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in: coreAn issue in spring-security-coreAn issue in spring-security-corestatus: duplicateA duplicate of another issueA duplicate of another issuetype: bugA general bugA general bug