fix: validate vector store connection addresses against SSRF policy
Vector store create and raw connection-test accepted user-supplied connection addresses without SSRF validation, while every other admin-entered endpoint (e.g. model BaseURL) already runs ValidateURLForSSRF. An admin could point an engine address at an internal host and use the connection probe as an SSRF oracle. Add validateConnectionAddrSSRF, applied at the two user-input boundaries only: - CreateStore: validated before any network dial. - TestStoreRaw: a new TestRawConnection wrapper runs an engine-type allowlist, required-field validation, and SSRF validation before delegating to TestConnection. TestConnection stays validation-free for trusted callers (env stores, stored configs already validated at create time). Validation covers every address-bearing field a driver dials (Addr, qdrant Host+Port, weaviate Host and GrpcAddress) and fails closed for unmapped engine types. The Elasticsearch probe no longer follows redirects, closing a 302-to-internal bypass. docker-compose whitelists the bundled vector-store service hostnames (qdrant, milvus, weaviate, doris-fe) via SSRF_WHITELIST_EXTRA so the out-of-box experience is preserved; postgres is intentionally not whitelisted. .env.example and the OpenSearch dev guide document how to whitelist external or local-dev addresses.
This commit is contained in:
+9
-3
@@ -168,9 +168,15 @@ services:
|
||||
- SSRF_WHITELIST=${SSRF_WHITELIST:-}
|
||||
# 保留原始 URL 的图片域名白名单(逗号分隔,不替换为 provider://)
|
||||
- IMAGE_HOST_KEEP_URL=${IMAGE_HOST_KEEP_URL:-}
|
||||
# Always allow the optional searxng sidecar (compose service hostname);
|
||||
# merged on top of SSRF_WHITELIST so user overrides don't clobber it.
|
||||
- SSRF_WHITELIST_EXTRA=${SSRF_WHITELIST_EXTRA:-searxng}
|
||||
# Always allow the optional searxng sidecar and the bundled vector-store
|
||||
# service hostnames (compose service names). Vector-store create/test now
|
||||
# runs SSRF validation on user-supplied addresses, which would otherwise
|
||||
# reject these private docker-network hosts; whitelisting them keeps the
|
||||
# out-of-box experience. Merged on top of SSRF_WHITELIST so user
|
||||
# overrides don't clobber it. (postgres is intentionally NOT listed: it
|
||||
# is not a user-registerable vector store, and whitelisting the app's own
|
||||
# DB host would skip the 5432 port block.)
|
||||
- SSRF_WHITELIST_EXTRA=${SSRF_WHITELIST_EXTRA:-searxng,qdrant,milvus,weaviate,doris-fe}
|
||||
- CONCURRENCY_POOL_SIZE=${CONCURRENCY_POOL_SIZE:-5}
|
||||
- JWT_SECRET=${JWT_SECRET:-}
|
||||
# Crypto: 主密钥和盐值,用于 AppSecret 等敏感字段的 AES-256 加密
|
||||
|
||||
Reference in New Issue
Block a user