Conversation
…client name The Redis collector passed the configured username to RedisURI.Builder.withClientName, which only sets the informational CLIENT SETNAME sent after connecting and plays no role in authentication. Redis 6+ ACL users configured in the monitor template therefore never authenticated as the configured user; lettuce always authenticated as the default user and the collection failed with WRONGPASS/NOAUTH. Use withAuthentication so the username and password are applied as credentials. An ACL user without a password authenticates with an empty one. Password-only configuration keeps the previous behavior. Signed-off-by: zjncs <18910855655@163.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed
The Redis collector passed the configured
usernametoRedisURI.Builder.withClientName, which only sets the informationalCLIENT SETNAMEsent after connecting and plays no role in authentication (lettuce 6.8.2 resolves the username exclusively fromRedisURIcredentials).As a result, with a Redis 6+ ACL user (e.g.
ACL SETUSER monitor on >secretpass ~* +@read) and a monitor configured withusername=monitor,password=secretpass(both exposed byapp-redis.yml), lettuce authenticated as thedefaultuser and the collection failed withWRONGPASS/NOAUTH— the username setting never worked.Fix: use
withAuthentication(username, password)so the username and password are applied as credentials. An ACL user without a password authenticates with an empty one (AUTH <username> ""); password-only configuration keeps the previouswithPasswordbehavior.Checklist
RedisCommonCollectImplTest— the module previously had no Redis collector tests).mvn -pl hertzbeat-collector/hertzbeat-collector-basic -am test: 273 tests, 0 failures).Verification
redisUriShouldUseUsernameForAuthenticationfails on master —expected: <monitor> but was: <null>(RedisURI.getUsername()is null because the username went toCLIENT NAME)withClientNamesets only the client name,withAuthentication(String, char[])sets the credentials used forAUTHAI assistance disclosure: the bug analysis, fix and tests in this PR were prepared with the help of an AI coding agent, and were verified locally by the author as described above.