Skip to content

Conversation

@PrittSpadeLord
Copy link

Currently, Argon2PasswordEncoder's methods encodeNonNullPassword and matchesNonNull accept only String for rawPassword. Given that String is immutable in Java, it remains in memory until it is claimed by GC, and whether the GC zeroes out the data is also implementation-specific. This can be a security vulnerability prone to memory dumps exposing the password.

As such, I have added overloads for these methods that take in char[] directly. Users who wish to not allow passwords to linger on their JVM memory may use these methods and immediately follow it with a Arrays.fill(rawPassword, '\0') to ensure passwords never linger in the machine's memory beyond its expected lifetime.

… users who would prefer to avoid passing passwords as String

Signed-off-by: PrittSpadeLord <pritt1999@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 24, 2025
Signed-off-by: PrittSpadeLord <pritt1999@gmail.com>
@PrittSpadeLord PrittSpadeLord changed the title "Feat added overloads for encodeNonNullPassword and matchesNonNull for users who would prefer to avoid passing passwords as String Feat added overloads for encodeNonNullPassword and matchesNonNull for users who would prefer to avoid passing passwords as String Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants