feat: add STORAGE_ALLOW_LIST env var
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
stderrors "errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/repository"
|
||||
@@ -128,6 +129,11 @@ func (h *KnowledgeBaseHandler) CreateKnowledgeBase(c *gin.Context) {
|
||||
c.Error(err)
|
||||
return
|
||||
}
|
||||
provider := strings.ToLower(strings.TrimSpace(req.GetStorageProvider()))
|
||||
if provider != "" && !isStorageProviderAllowed(provider) {
|
||||
c.Error(apperrors.NewBadRequestError("Storage provider is not allowed by STORAGE_ALLOW_LIST"))
|
||||
return
|
||||
}
|
||||
|
||||
logger.Infof(ctx, "Creating knowledge base, name: %s", secutils.SanitizeForLog(req.Name))
|
||||
// Create knowledge base using the service
|
||||
|
||||
Reference in New Issue
Block a user