chore: release server-v1.0.62
Deploy Server / release-deploy-server (push) Successful in 51s

服务端安全加固:多维限流(按 IP/按门店)+ 敏感接口独立速率上限抵御 DDoS/刷接口;
登录暴力破解新增按来源 IP 锁定;反代后正确识别真实客户端 IP;
门店 custom_fields 轻量配置(录入默认值)透传保存。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2Wdwo7SmgBJU37cBrkhPK
This commit is contained in:
wangjia
2026-06-19 20:20:44 +08:00
parent 0d967e899a
commit 7bbc944ae2
14 changed files with 628 additions and 57 deletions
+7 -1
View File
@@ -43,6 +43,13 @@ func main() {
r := gin.New()
r.Use(gin.Logger(), gin.Recovery())
// 真实客户端 IP:只信任本机 nginx127.0.0.1/::1)写的 X-Real-IP,丢弃客户端伪造的
// X-Forwarded-For。这样 c.ClientIP() 返回不可伪造的真实 IP,是所有按 IP 限流/审计的基础。
// 代理链:client → nginx(127.0.0.1:8445) → 后端(127.0.0.1:8080);将来若在 nginx 前再加
// 一层代理,需把其地址并入下列可信网段。
_ = r.SetTrustedProxies([]string{"127.0.0.1", "::1"})
r.RemoteIPHeaders = []string{"X-Real-IP"}
// CORS
corsOrigin := config.C.Server.CORSOrigin
r.Use(func(c *gin.Context) {
@@ -131,4 +138,3 @@ func autoMigrate(db *gorm.DB) {
}
log.Println("AutoMigrate completed")
}