fix: allow rediss:// TLS endpoint with separately-configured password#2099
Merged
Ullaakut merged 2 commits intogomods:mainfrom Apr 5, 2026
Merged
Conversation
When using a TLS endpoint (rediss://host:6379) without an embedded password, redis.ParseURL succeeds but sets options.Password to "". The existing check then fires errPasswordsDoNotMatch if ATHENS_REDIS_PASSWORD is set, even though there is no actual conflict — the URL simply has no password component. Fix the check so it only errors when the URL contains a password that disagrees with the separately-configured password. When the URL has no embedded password but ATHENS_REDIS_PASSWORD is set, apply the password to options so it is actually used for AUTH. This enables the common deployment pattern of: ATHENS_REDIS_ENDPOINT=rediss://host:6379 (TLS, no password in URL) ATHENS_REDIS_PASSWORD=<secret> (injected via k8s Secret) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
Thank you for the approval! What are the steps to merge? |
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.
Problem
When using a TLS Redis endpoint (
rediss://host:6379) without an embedded password,redis.ParseURLsucceeds but returnsoptions.Password = "". The current check ingetRedisClientOptionsthen fireserrPasswordsDoNotMatchifATHENS_REDIS_PASSWORDis also set — even though there is no actual conflict, the URL simply has no password component.This makes it impossible to use the common Kubernetes deployment pattern of:
ATHENS_REDIS_ENDPOINT=rediss://host:6379(TLS scheme, no password embedded in URL)ATHENS_REDIS_PASSWORD=<secret>(injected separately via a k8s Secret)ElastiCache and other managed Redis services commonly require both TLS (
rediss://) and an auth token, and best practice is to inject credentials via secrets rather than embedding them in the endpoint URL.Fix
Only error when the URL contains a password that disagrees with the separately-configured password. When the URL has no embedded password but
ATHENS_REDIS_PASSWORDis set, apply the password tooptionsso it is used for AUTH.Test
Added a test case for
rediss://host:6379+ separate password toTest_getRedisClientOptions. All existing tests continue to pass.