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
@@ -9,6 +9,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"
)
// FAQHandler handles FAQ knowledge base operations.
@@ -173,7 +174,7 @@ func (h *FAQHandler) SearchFAQ(c *gin.Context) {
return
}
entries, err := h.knowledgeService.SearchFAQEntries(ctx, c.Param("id"), &req)
entries, err := h.knowledgeService.SearchFAQEntries(ctx, secutils.SanitizeForLog(c.Param("id")), &req)
if err != nil {
logger.ErrorWithFields(ctx, err, nil)
c.Error(err)