From 156502b3db1a2544fa267380c84897ecc51b9e8f Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Tue, 18 Nov 2025 09:16:12 -0500 Subject: [PATCH] =?UTF-8?q?fix(store/valkey):=20Redis=E2=84=A2=20Sentinel?= =?UTF-8?q?=20doesn't=20require=20a=20password?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xe Iaso --- docs/docs/admin/policies.mdx | 2 +- lib/store/valkey/factory.go | 7 +------ lib/store/valkey/valkey_test.go | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/docs/docs/admin/policies.mdx b/docs/docs/admin/policies.mdx index bc193d6d..2065f49b 100644 --- a/docs/docs/admin/policies.mdx +++ b/docs/docs/admin/policies.mdx @@ -326,7 +326,7 @@ If you are using [Redis™ Sentinel](https://redis.io/docs/latest/operate/oss_an | `clientName` | string | `Anubis` | The client name reported to Redis™ Sentinel. Set this if you want to track Anubis connections to your Redis™ Sentinel. | | `masterName` | string | `mymaster` | (Required) The name of the master in the Redis™ Sentinel configuration. This is used to discover where to find client connection hosts/ports. | | `username` | string | `azurediamond` | The username used to authenticate against the Redis™ Sentinel and Redis™ servers. | -| `password` | string | `hunter2` | (Required) The password used to authenticate against the Redis™ Sentinel and Redis™ servers. | +| `password` | string | `hunter2` | The password used to authenticate against the Redis™ Sentinel and Redis™ servers. | ## Risk calculation for downstream services diff --git a/lib/store/valkey/factory.go b/lib/store/valkey/factory.go index 99791863..309bf656 100644 --- a/lib/store/valkey/factory.go +++ b/lib/store/valkey/factory.go @@ -24,7 +24,6 @@ var ( // Sentinel validation errors ErrSentinelMasterNameRequired = errors.New("valkey.Sentinel: masterName is required") ErrSentinelAddrRequired = errors.New("valkey.Sentinel: addr is required") - ErrSentinelPasswordRequired = errors.New("valkey.Sentinel: password is required") ErrSentinelAddrEmpty = errors.New("valkey.Sentinel: addr cannot be empty") ) @@ -68,7 +67,7 @@ type Sentinel struct { Addr internal.ListOr[string] `json:"addr"` ClientName string `json:"clientName,omitempty"` Username string `json:"username,omitempty"` - Password string `json:"password"` + Password string `json:"password,omitempty"` } func (s Sentinel) Valid() error { @@ -94,10 +93,6 @@ func (s Sentinel) Valid() error { } } - if s.Password == "" { - errs = append(errs, ErrSentinelPasswordRequired) - } - if len(errs) > 0 { return errors.Join(errs...) } diff --git a/lib/store/valkey/valkey_test.go b/lib/store/valkey/valkey_test.go index 5b952702..a509e1c6 100644 --- a/lib/store/valkey/valkey_test.go +++ b/lib/store/valkey/valkey_test.go @@ -91,7 +91,7 @@ func TestFactoryValid(t *testing.T) { { name: "sentinel missing password", jsonData: `{"sentinel": {"masterName": "mymaster", "addr": ["localhost:26379"]}}`, - expectError: ErrSentinelPasswordRequired, + expectError: nil, }, { name: "sentinel with optional fields",