refactor: Sanitize log inputs to prevent injection attacks

This commit is contained in:
wizardchen
2025-11-25 22:19:41 +08:00
parent 2f45bf7d86
commit bf35a2861c
10 changed files with 82 additions and 41 deletions
+2 -1
View File
@@ -8,6 +8,7 @@ import (
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types"
"github.com/Tencent/WeKnora/internal/types/interfaces"
secutils "github.com/Tencent/WeKnora/internal/utils"
"github.com/gin-gonic/gin"
)
@@ -92,7 +93,7 @@ func (h *ModelHandler) CreateModel(c *gin.Context) {
}
logger.Infof(ctx, "Creating model, Tenant ID: %d, Model name: %s, Model type: %s",
tenantID, req.Name, req.Type)
tenantID, secutils.SanitizeForLog(req.Name), secutils.SanitizeForLog(string(req.Type)))
model := &types.Model{
TenantID: tenantID,