fix(web-search): address review fixups for SearXNG provider
- utils: 合并 SSRF_WHITELIST 与 SSRF_WHITELIST_EXTRA,避免部署侧默认值 (如 docker-compose 注入的 searxng 主机名)被用户的 SSRF_WHITELIST 自定义值覆盖。 - docker-compose.yml: 把 searxng 默认值挪到 SSRF_WHITELIST_EXTRA。 - searxng: 抽出导出函数 ValidateSearxngBaseURL,让 service 层保存校验 和 provider 构造校验完全一致;service 改为调用同一函数。 - searxng: language 由非法的 "auto" 改为 "all";移除强制 safesearch=1 让实例 settings.yml 决定。 - searxng: publishedDate 增加多格式 fallback(RFC3339Nano/无时区/ 日期-only/RFC1123 等),无法解析时 debug 日志记录。 - searxng: 解析 unresponsive_engines;结果为空时打 warn 日志,便于排查 "配置正确却搜不到结果"的情况。 - frontend: WebSearchSettings 的 Instance URL 标签/占位符走 i18n, zh-CN / en-US / ru-RU / ko-KR 四个 locale 补齐 baseUrlLabel / baseUrlPlaceholder。
This commit is contained in:
@@ -880,9 +880,21 @@ func loadSSRFWhitelist() *ssrfWhitelistConfig {
|
||||
exactHosts: make(map[string]bool),
|
||||
}
|
||||
raw := os.Getenv("SSRF_WHITELIST")
|
||||
if raw == "" {
|
||||
// SSRF_WHITELIST_EXTRA is merged in addition to SSRF_WHITELIST so that
|
||||
// deployment-managed defaults (e.g. docker-compose injected sidecar host
|
||||
// names like "searxng") aren't accidentally clobbered when an operator
|
||||
// overrides SSRF_WHITELIST in their .env.
|
||||
extra := os.Getenv("SSRF_WHITELIST_EXTRA")
|
||||
if raw == "" && extra == "" {
|
||||
return
|
||||
}
|
||||
if extra != "" {
|
||||
if raw == "" {
|
||||
raw = extra
|
||||
} else {
|
||||
raw = raw + "," + extra
|
||||
}
|
||||
}
|
||||
for _, entry := range strings.Split(raw, ",") {
|
||||
entry = strings.TrimSpace(entry)
|
||||
if entry == "" {
|
||||
|
||||
Reference in New Issue
Block a user