Skip to content

fix: clear credential byte arrays in JedisSafeAuthenticator after use - #4629

Merged
ggivo merged 2 commits into
redis:masterfrom
insaf021:fix/clear-credential-bytes-in-safe-authenticator
Jul 20, 2026
Merged

ggivo merged 2 commits into
redis:masterfrom
insaf021:fix/clear-credential-bytes-in-safe-authenticator

Conversation

@insaf021

@insaf021 insaf021 commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

JedisSafeAuthenticator.safeReAuthenticate() encodes token credentials into byte arrays but does not zero them after use, unlike the other authentication paths (Connection.authenticate(), Connection.hello(), RedisRestAPI.getAuthenticationHeader()), which all clear credential bytes in a finally block. This aligns JedisSafeAuthenticator with that pattern.

The arrays are method-local and GC'd after the method returns, but until then the credential bytes remain readable in heap memory (e.g., in a heap dump). Zeroing them shrinks that window, not a functional bug.

Testing

  • Existing TokenBasedAuthenticationUnitTests pass (no behavioural change).

Ubuntu and others added 2 commits July 19, 2026 13:36
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ggivo ggivo added this to the 8.0.0 milestone Jul 20, 2026
@ggivo

ggivo commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the contribution, will take it from here and merge ti once tests are green

@ggivo
ggivo merged commit 86c4bd0 into redis:master Jul 20, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants