refactor: Sanitize log inputs in user, auth, knowledge, and model handlers to enhance security

This commit is contained in:
wizardchen
2025-11-26 10:50:53 +08:00
parent 8e3c2d8547
commit 09642445de
5 changed files with 20 additions and 11 deletions
+2 -3
View File
@@ -84,7 +84,6 @@ func (h *ModelHandler) CreateModel(c *gin.Context) {
c.Error(errors.NewBadRequestError(err.Error()))
return
}
req.Name = secutils.SanitizeForLog(req.Name)
tenantID := c.GetUint64(types.TenantIDContextKey.String())
if tenantID == 0 {
logger.Error(ctx, "Tenant ID is empty")
@@ -97,10 +96,10 @@ func (h *ModelHandler) CreateModel(c *gin.Context) {
model := &types.Model{
TenantID: tenantID,
Name: req.Name,
Name: secutils.SanitizeForLog(req.Name),
Type: req.Type,
Source: req.Source,
Description: req.Description,
Description: secutils.SanitizeForLog(req.Description),
Parameters: req.Parameters,
}