refactor: Sanitize log inputs in FAQ, Knowledge, and KnowledgeBase handlers to enhance security

This commit is contained in:
wizardchen
2025-11-26 19:52:07 +08:00
parent 85caee044a
commit 06a1c96cf2
4 changed files with 31 additions and 14 deletions
+2 -1
View File
@@ -297,7 +297,8 @@ func (h *Handler) AgentQA(c *gin.Context) {
logger.Infof(ctx, "Delegating to KnowledgeQA with knowledge bases: %s", secutils.SanitizeForLog(fmt.Sprintf("%v", knowledgeBaseIDs)))
// Use shared function to handle KnowledgeQA request (no title generation for AgentQA fallback)
h.handleKnowledgeQARequest(ctx, c, session, request.Query, knowledgeBaseIDs, assistantMessage, false, request.SummaryModelID, request.WebSearchEnabled)
h.handleKnowledgeQARequest(ctx, c, session, secutils.SanitizeForLog(request.Query),
secutils.SanitizeForLogArray(knowledgeBaseIDs), assistantMessage, false, secutils.SanitizeForLog(request.SummaryModelID), request.WebSearchEnabled)
return
}