From 89f71eecd848d1eb0a0e1ff6ee6198ba7c29bfef Mon Sep 17 00:00:00 2001 From: AI Engineer Date: Thu, 7 May 2026 21:03:40 +0800 Subject: [PATCH] feat: enhance password decryption and update dependencies --- CHANGELOG.md | 19 ++++++++++++++++++- go.mod | 6 +++--- redis.go | 3 ++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf64b20..9645c02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,25 @@ # CHANGELOG - redis +## v1.0.6 (2026-05-07) +- **Security & Compatibility**: + - 增强 `Redis` 密码解密逻辑,支持 URL-safe Base64 编码的加密密码,提升多平台配置兼容性。 +- **Maintenance**: + - 升级依赖 `apigo.cc/go/cast` (v1.2.8) 与 `apigo.cc/go/log` (v1.1.9)。 + - 依赖 `apigo.cc/go/encoding` (v1.0.5) 正式转为显式引用。 + +## v1.0.5 (2026-05-06) +- **Maintenance**: + - 内部依赖对齐与升级 (`config`, `crypto`, `id`, `safe` 等至 v1.0.5/v1.0.6)。 + - 移除了冗余的 `replace` 指令,清理 `go.sum`。 + +## v1.0.4 (2026-05-06) +- **Maintenance**: + - 添加 `.gitignore` 以排除日志元数据。 + - 升级 `apigo.cc/go/log` 至 v1.1.3。 + ## v1.0.3 (2026-05-05) - **PubSub Robustness**: - - 重构 `Redis` 结构体,引入 `pubsub` 内部结构管理共享状态。 + - 重构 `Redis` 结构体,引入 `pubsub` 内部结构 management 共享状态。 - 修复了 `CopyByLogger` 场景下 `subs` map 与 `subLock` 不匹配导致的并发竞争风险。 - 优化 `Start()` 方法,增加运行状态检查,防止冗余的订阅协程启动。 - 增强 `Stop()` 方法的生命周期管理,确保协程安全退出并清理停止通道。 diff --git a/go.mod b/go.mod index 95b0d36..1bf4118 100644 --- a/go.mod +++ b/go.mod @@ -3,17 +3,17 @@ module apigo.cc/go/redis go 1.25.0 require ( - apigo.cc/go/cast v1.2.7 + apigo.cc/go/cast v1.2.8 apigo.cc/go/config v1.0.6 apigo.cc/go/crypto v1.0.5 + apigo.cc/go/encoding v1.0.5 apigo.cc/go/id v1.0.5 - apigo.cc/go/log v1.1.5 + apigo.cc/go/log v1.1.9 apigo.cc/go/safe v1.0.5 github.com/gomodule/redigo v1.9.3 ) require ( - apigo.cc/go/encoding v1.0.5 // indirect apigo.cc/go/file v1.0.6 // indirect apigo.cc/go/rand v1.0.5 // indirect apigo.cc/go/shell v1.0.5 // indirect diff --git a/redis.go b/redis.go index a73bf32..b4bff29 100644 --- a/redis.go +++ b/redis.go @@ -14,6 +14,7 @@ import ( "apigo.cc/go/cast" "apigo.cc/go/config" + "apigo.cc/go/encoding" "apigo.cc/go/log" "apigo.cc/go/safe" "github.com/gomodule/redigo/redis" @@ -75,7 +76,7 @@ func GetRedis(name string, logger *log.Logger) *Redis { conf = parseByName(name) } - if pwd, err := confAes.Decrypt([]byte(conf.Password)); err == nil { + if pwd, err := confAes.Decrypt(cast.As(encoding.UnUrlBase64FromString(conf.Password))); err == nil { conf.pwd = pwd } else { conf.pwd = safe.NewSafeBuf([]byte(conf.Password))