feat: enhance password decryption and update dependencies

This commit is contained in:
AI Engineer 2026-05-07 21:03:40 +08:00
parent 0c6b00febb
commit 89f71eecd8
3 changed files with 23 additions and 5 deletions

View File

@ -1,8 +1,25 @@
# CHANGELOG - redis # 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) ## v1.0.3 (2026-05-05)
- **PubSub Robustness**: - **PubSub Robustness**:
- 重构 `Redis` 结构体,引入 `pubsub` 内部结构管理共享状态。 - 重构 `Redis` 结构体,引入 `pubsub` 内部结构 management 共享状态。
- 修复了 `CopyByLogger` 场景下 `subs` map 与 `subLock` 不匹配导致的并发竞争风险。 - 修复了 `CopyByLogger` 场景下 `subs` map 与 `subLock` 不匹配导致的并发竞争风险。
- 优化 `Start()` 方法,增加运行状态检查,防止冗余的订阅协程启动。 - 优化 `Start()` 方法,增加运行状态检查,防止冗余的订阅协程启动。
- 增强 `Stop()` 方法的生命周期管理,确保协程安全退出并清理停止通道。 - 增强 `Stop()` 方法的生命周期管理,确保协程安全退出并清理停止通道。

6
go.mod
View File

@ -3,17 +3,17 @@ module apigo.cc/go/redis
go 1.25.0 go 1.25.0
require ( 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/config v1.0.6
apigo.cc/go/crypto v1.0.5 apigo.cc/go/crypto v1.0.5
apigo.cc/go/encoding v1.0.5
apigo.cc/go/id 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 apigo.cc/go/safe v1.0.5
github.com/gomodule/redigo v1.9.3 github.com/gomodule/redigo v1.9.3
) )
require ( require (
apigo.cc/go/encoding v1.0.5 // indirect
apigo.cc/go/file v1.0.6 // indirect apigo.cc/go/file v1.0.6 // indirect
apigo.cc/go/rand v1.0.5 // indirect apigo.cc/go/rand v1.0.5 // indirect
apigo.cc/go/shell v1.0.5 // indirect apigo.cc/go/shell v1.0.5 // indirect

View File

@ -14,6 +14,7 @@ import (
"apigo.cc/go/cast" "apigo.cc/go/cast"
"apigo.cc/go/config" "apigo.cc/go/config"
"apigo.cc/go/encoding"
"apigo.cc/go/log" "apigo.cc/go/log"
"apigo.cc/go/safe" "apigo.cc/go/safe"
"github.com/gomodule/redigo/redis" "github.com/gomodule/redigo/redis"
@ -75,7 +76,7 @@ func GetRedis(name string, logger *log.Logger) *Redis {
conf = parseByName(name) 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 conf.pwd = pwd
} else { } else {
conf.pwd = safe.NewSafeBuf([]byte(conf.Password)) conf.pwd = safe.NewSafeBuf([]byte(conf.Password))