chore: 项目基线(基于 WeKnora 定制版,整理文件忽略规则)

This commit is contained in:
runny committed 2026-11-13 17:54:56 +08:00
commit 9097ee699d
5769 files changed
+1446466

No files matched your search

@@ -0,0 +1,33 @@
package service
import (
"fmt"
"strings"
secutils "github.com/Tencent/WeKnora/internal/utils"
)
var parserOutboundURLKeys = []string{
"mineru_endpoint",
"mineru_vlm_server_url",
"odl_hybrid_url",
"paddleocr_vl_endpoint",
"paddleocr_vl_cloud_base_url",
}
// validateParserEngineOverrideURLs validates every parser override that can
// cause this process or the trusted DocReader service to make an outbound
// request. Per-upload overrides are included because API callers can provide
// the generic parser_engine_overrides map directly.
func validateParserEngineOverrideURLs(overrides map[string]string) error {
for _, key := range parserOutboundURLKeys {
rawURL := strings.TrimSpace(overrides[key])
if rawURL == "" {
continue
}
if err := secutils.ValidateURLForSSRF(rawURL); err != nil {
return fmt.Errorf("%s failed SSRF validation: %w", key, err)
}
}
return nil
}