Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

refactor: Enhance type sanitization for model creation to improve security

wizardchena162b6e7c2a2
diff --git a/internal/handler/model.go b/internal/handler/model.go
index 1bbf0899c..2666bb50c 100644
--- a/internal/handler/model.go
+++ b/internal/handler/model.go
@@ -97,7 +97,7 @@ func (h *ModelHandler) CreateModel(c *gin.Context) {
model := &types.Model{
TenantID: tenantID,
Name: secutils.SanitizeForLog(req.Name),
- Type: req.Type,
+ Type: types.ModelType(secutils.SanitizeForLog(string(req.Type))),
Source: req.Source,
Description: secutils.SanitizeForLog(req.Description),
Parameters: req.Parameters,