fix: 慢查询/错误 SQL 日志参数化 (#6493)

* fix: parameterize slow/error SQL logs to avoid leaking credentials

* fix: validate SQL_SLOW_THRESHOLD_MS range

* fix: sanitize database driver error messages in SQL logs

* refactor: sanitize at gorm log writer seam to keep caller attribution
This commit is contained in:
feitianbubu
2026-07-27 22:21:31 +08:00
committed by GitHub
parent f01c13b086
commit c3db41407d
5 changed files with 202 additions and 20 deletions
+2
View File
@@ -33,6 +33,8 @@
# SQL_MAX_OPEN_CONNS=1000
# 数据库连接最大生命周期(秒)
# SQL_MAX_LIFETIME=60
# 慢查询日志阈值(毫秒),0 表示关闭慢查询日志,超出 0-3600000 范围回退默认值 200
# SQL_SLOW_THRESHOLD_MS=200
# 缓存相关配置